Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swiping laggy in ios when setting state to prevent multiple activations #20

Open
Vaintti opened this issue Jun 30, 2017 · 5 comments
Open

Comments

@Vaintti
Copy link

Vaintti commented Jun 30, 2017

Swiping is laggy on ios when I set state on onSwipeStart and onSwipeRelease

@Vaintti Vaintti changed the title Swiping laggy when child element is touchable Swiping laggy in ios when setting state to prevent multiple activations Jul 3, 2017
@Vaintti
Copy link
Author

Vaintti commented Jul 3, 2017

I think onSwipeRelease triggering before it should has something to do with this. I use the component as listView row.

@jshanson7
Copy link
Owner

@Vaintti do you think this could be the same issue as #3? The current fix is to set scrollEnabled to false when a row is being swiped. See also https://github.com/jshanson7/react-native-swipeable#common-issues

@Jagadeesh-Govindaraj
Copy link

Jagadeesh-Govindaraj commented Aug 8, 2017

Here is my working solution.(this.setState() is make to swipe slower so prefer local variables in your swipe actions)

_disableScroll() {
      //debugger;
      this._list.getScrollResponder().setNativeProps({
          scrollEnabled: false
      })
  }

  _enableScroll() {
      this._list.getScrollResponder().setNativeProps({
          scrollEnabled: true
      })
  }

swipeView

 <Swipeable
                onSwipeStart={this._disableScroll.bind(this)}
                onSwipeRelease={this._enableScroll.bind(this)}>
</Swipeable>

ListView

<ListView ref={ref => this._list = ref} />

@rxb
Copy link

rxb commented Sep 13, 2017

@Jagadeesh-Govindaraj thank you so much, that is a great fix for the lag.

@glebselyukov
Copy link

@Jagadeesh-Govindaraj best method ever!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants