-
-
Notifications
You must be signed in to change notification settings - Fork 514
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
feat: add swipe direction on iOS #1260
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
I really like the implementation - it's very simple and elegant 👏
-
On the other hand, the developer experience while using this prop is quite terrible. I'd suggest making all of these props set for the developer automatically by default:
fullScreenSwipeEnabled: true,
customAnimationOnSwipe: true,
stackAnimation: 'slide_from_bottom'
when setting swipeDirection
to vertical
.
- I could also see this prop as
verticalSwipeEnabled
but I'm okay withswipeDirection
ios/RNSScreenStack.m
Outdated
if ([gestureRecognizer isKindOfClass:[RNSPanGestureRecognizer class]]) { | ||
if (([gestureRecognizer isKindOfClass:[RNSPanGestureRecognizerHorizontal class]] && | ||
topScreen.swipeDirection == RNSScreenSwipeDirectionHorizontal) || | ||
([gestureRecognizer isKindOfClass:[RNSPanGestureRecognizerVertical class]] && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As vertical swipe doesn't really make sense without fullScreenSwipeEnabled
:
Screen.Recording.2022-01-26.at.09.48.44.mov
we should set it to true
by default when developer sets swipeDirection
to vertical
swipeDirection is still missing on react-navigation. Also transition duration. @kacperkapusciak would you mind to make a upstream PR? |
@WoLewicki the finish transition seems to be too fast (after finishing swiping). Opposed to the |
@dylancom it might come from the fact that we use |
Description
Added
swipeDirection
prop oniOS
. Be aware that you need to also applycustomAnimationOnSwipe: true
in order for the swipe to resolve in the animation of the screen andfullScreenSwipeEnabled
since you want the gesture to be recognized on the whole screen most probably. Requested in #946.Test code and steps to reproduce
Test1260.tsx
.Checklist