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 in production mode sticks half way through and doesn't swipe all the way. #122

Closed
kevinmcalear opened this issue Feb 28, 2018 · 6 comments

Comments

@kevinmcalear
Copy link

While developing using this library, everything works smooth and amazing. I switch it to production mode, and now the behavior mentioned above happens. I have added a recording to show you what I mean. Any help would be so great. Thanks!

img_0558 trim

@alexbrillant
Copy link
Owner

What RN version are you using ? I will take a look at it as soon as possible. Thanks :-)

@kevinmcalear
Copy link
Author

@alexbrillant we are using 0.46.4. Thanks for your help!!

@kevinmcalear
Copy link
Author

@alexbrillant after lots of digging around, I am sure that this is an issue with how UXCam works with this library. For some reason, only on iOS, UXCam has an issue that creates lag around various actions (scrolling for example). see this uxcam issue

It seems to also effect the swipe of this library, stopping it from swiping fully. I can repro this issue by simply adding my UXCam account key, which initializes UXCam to my staging env. If UXCam is initialized, This swiping issue exists. If UXCam is never initialized, everything works perfectly. We only use UXCam in production which is why I was only seeing this problem in production mode.

I'm currently working with UXCam to resolve this issue and have tried this fix, which fixes laggy scrolling issues but doe not fix this swiping problem.

@richardgroves
Copy link

Hi @kevinmcalear - this is the same problem as the linked one.

The react-native touch handling is treating other gesture recognisers as though they are in competition - it wont let the UXCam observing GRs run while there are react-native GRs active.

To work around it:

Find the react-native source file: RCTTouchHandler.m
(path: $/node_modules/react-native/React/Base/RCTTouchHandler.m)

In the last method in that file edit it to be 'return NO'

so the method becomes:

  • (BOOL)gestureRecognizer:(__unused UIGestureRecognizer *)gestureRecognizer shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
    {
    return NO;
    // Same condition for failure of as for be prevented by.
    //return [self canBePreventedByGestureRecognizer:otherGestureRecognizer];
    }
    Explanation:

This stops the react-native touch handler from deciding that it will reject gesture recognisers for it's own views when some other part of the code is also using a UIGestureRecognizer (as UXCam is doing in this case, but some other module could also do the same).

I reported this on the other thread back in August but never had any feedback from anyone using it as to whether it causes any other issues. I'm happy to raise an issue with the react-native project but really don't have enough experience in react to know whether this is a sensible change or will negatively impact other projects.

@kevinmcalear
Copy link
Author

@richardgroves You are amazing. This fixed my issue! Thanks again! 🎉

I'm going to put this fix into our code base to get our issue resolved. I'll let you know if there are any problems that arise from doing this. It seems this change facebook/react-native#15606 (comment) added the additional logic in react-native. Since you have so much context with this issue in general, I think you should open an issue with react-native to get an answer either way. If you need anything from me, just say the word! :)

@alexbrillant
Copy link
Owner

@kevinmcalear thanks for digging 👍 closing the issue

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

3 participants