GithubHelp home page GithubHelp logo

Comments (10)

junshengpierre avatar junshengpierre commented on June 11, 2024 4

Hi, I've tried setting sensitivity to 1 but it's not working for me on an android device. The touch event is incredibly difficult to trigger and requires me to press the list item a few times quickly to work.
It works perfectly on an iOS device.

The following is my renderRow code:

<Swipeout
    scroll={event => this._allowScroll(event)}
    sensitivity={1}
    autoClose={true}
    right={swipeoutButtons}>
    <TouchableOpacity
       style={styles.transaction}
       key={rowData.id}
       onPress={() => { this._goToScreen(rowData) }}>
         <View style={styles.listItemContainer}
            {...}
          </View>
     </TouchableOpacity>
 </Swipeout>

react-native 0.40.0
Samsung Galaxy S6
Android 6.0.1

Anyone knows what I might have done wrong?

from react-native-swipeout.

braco avatar braco commented on June 11, 2024

@dancormier: would it make sense to add an onPress to the Swipeout component?

from react-native-swipeout.

esutton avatar esutton commented on June 11, 2024

The Swipeout onOpen function appears to be *** super *** sensitive on Android.

Is there any configuration for sensitivity?

I have to press a ListView row 4 or 5 times. I have to press very deliberate and straight and perpendicular to the tablet.

See:
#78

Using:
Android 6.0
Nexus 7 tablet
"react": "15.0.2",
"react-native": "^0.26.2",
[email protected]

from react-native-swipeout.

esutton avatar esutton commented on June 11, 2024

Using adb logacat, I can see that the _handlePanResponderGrant function gets called almost every time the ListView row is touched. Unless you press straight and quick ( not very easy ).

This seems to prevent the ListView row's onPress method being called. I assume until the gesture has ended?

https://github.com/dancormier/react-native-swipeout/blob/master/index.js

  _handlePanResponderGrant: function(e: Object, gestureState: Object) {
    console.log('_handlePanResponderGrant:', gestureState);
    if(this.props.onOpen){
      this.props.onOpen(this.props.sectionID, this.props.rowID);
    }
    this.refs.swipeoutContent.measure((ox, oy, width, height) => {
      this.setState({
        btnWidth: (width/5),
        btnsLeftWidth: this.props.left ? (width/5)*this.props.left.length : 0,
        btnsRightWidth: this.props.right ? (width/5)*this.props.right.length : 0,
        swiping: true,
        timeStart: (new Date()).getTime(),
      });
    });
  },

Perhaps there is someway to de-bounce or de-sensitive PanResponder to make it not detect a PAN gesture so easily? Set a deltaX or deltaY threshold?

I cannot find anything in the react-native PanResponder documentation.

06-07 15:48:55.681 11603 12179 I ReactNativeJS: '_handlePanResponderGrant:', { stateID: 0.45550999348051846,
06-07 15:48:55.681 11603 12179 I ReactNativeJS:   moveX: 482.1539611816406,
06-07 15:48:55.681 11603 12179 I ReactNativeJS:   moveY: 87,
06-07 15:48:55.681 11603 12179 I ReactNativeJS:   x0: 482.1539611816406,
06-07 15:48:55.681 11603 12179 I ReactNativeJS:   y0: 87,
06-07 15:48:55.681 11603 12179 I ReactNativeJS:   dx: 0,
06-07 15:48:55.681 11603 12179 I ReactNativeJS:   dy: 0,
06-07 15:48:55.681 11603 12179 I ReactNativeJS:   vx: -9.19479990933698e-7,
06-07 15:48:55.681 11603 12179 I ReactNativeJS:   vy: 1.608545913133419e-7,
06-07 15:48:55.681 11603 12179 I ReactNativeJS:   numberActiveTouches: 1,

https://facebook.github.io/react-native/docs/panresponder.html

from react-native-swipeout.

chkchk avatar chkchk commented on June 11, 2024

set sensitivity to 1, it works for me

from react-native-swipeout.

esutton avatar esutton commented on June 11, 2024

@chkchk Thank you!

I searched this repo for "sensitivity".

I see it being used but not referenced. How can sensitivity be doing anything?

I will give it a try anyway.

https://github.com/dancormier/react-native-swipeout

Props

Prop Type Optional Default Description
autoClose bool Yes false auto close on button press
backgroundColor string Yes '#dbddde'
close bool Yes close swipeout
left array Yes [] swipeout buttons on left
onOpen func Yes
right array Yes [] swipeout buttons on right
scroll func Yes prevent parent scroll
style style Yes style of the container
sensitivity number Yes 0 change the sensitivity of gesture

from react-native-swipeout.

minzhitang avatar minzhitang commented on June 11, 2024

thanks @chkchk works for me too

from react-native-swipeout.

philographer avatar philographer commented on June 11, 2024

It works for me too nicely! Thanks

from react-native-swipeout.

wp2123 avatar wp2123 commented on June 11, 2024

Still hard to trigger onPress event of TouchableOpacity after set sensitivity to 1.
react-native 0.43.3
iPhone 6s

from react-native-swipeout.

benevbright avatar benevbright commented on June 11, 2024

I just published extension of Swipeout to make it works like Android behavior on Android.
Try this.
https://www.npmjs.com/package/react-native-swipeout-longpressforandroid

from react-native-swipeout.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.