-
-
Notifications
You must be signed in to change notification settings - Fork 537
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(iOS): add shadow to custom push pop transitions #2239
Conversation
15a9ac9
to
5c864c4
Compare
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.
Left some comments.
guides/GUIDE_FOR_LIBRARY_AUTHORS.md
Outdated
### `fullScreenSwipeShadowEnabled` (iOS only) | ||
|
||
Boolean indicating whether the full screen dismiss gesture has shadow under view during transition. The gesture uses custom transition and thus | ||
doesn't have a shadow by default. When enabled a custom shadow view is added during the transition which tries to mimick the |
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.
doesn't have a shadow by default. When enabled a custom shadow view is added during the transition which tries to mimick the | |
doesn't have a shadow by default. When enabled, a custom shadow view is added during the transition, which tries to mimick the |
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.
Same for other occourences of this comment.
@@ -216,6 +217,9 @@ const RouteView = ({ | |||
if (fullScreenSwipeEnabled === undefined) { | |||
fullScreenSwipeEnabled = true; | |||
} | |||
if (fullScreenSwipeShadowEnabled === undefined) { | |||
fullScreenSwipeShadowEnabled = true; |
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.
If you do it like this, isn't it true
by default?
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 was thinking the same but fullScreenSwipeEnabled
does it this way and it also is false
by default. I think it is set elsewhere as false
so this doesn't matter. But I can change that and maybe fullScreenSwipeEnabled
also.
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.
But the false
value must be set somewhere right? Better to make this explicit.
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.
Maybe it would be better to remove this altogether? Now I see that this is only set when swipeDirection === 'vertical'
so it doesn't make sense to keep it there if it's not set for other swipe directions. Unless I should move it out of this if
.
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 think this prop is not dependent on any other props so we can remove it?
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.
@@ -216,6 +217,9 @@ const RouteView = ({ | |||
if (fullScreenSwipeEnabled === undefined) { | |||
fullScreenSwipeEnabled = true; | |||
} | |||
if (fullScreenSwipeShadowEnabled === undefined) { | |||
fullScreenSwipeShadowEnabled = true; |
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.
But the false
value must be set somewhere right? Better to make this explicit.
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.
Other than the points I emphasise below I think we're good.
@@ -202,6 +202,7 @@ const RouteView = ({ | |||
let { | |||
customAnimationOnSwipe, | |||
fullScreenSwipeEnabled, | |||
fullScreenSwipeShadowEnabled, |
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.
fullScreenSwipeShadowEnabled, | |
fullScreenSwipeShadowEnabled = false, |
if (fullScreenSwipeShadowEnabled === undefined) { | ||
fullScreenSwipeShadowEnabled = false; | ||
} |
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.
if (fullScreenSwipeShadowEnabled === undefined) { | |
fullScreenSwipeShadowEnabled = false; | |
} |
react-navigation
Outdated
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.
The problem with bumping react-navigation
in such way is that it will be overridden by next PR that tries to do the same. We need a PR to react-navigation
, merge it there to main & bump react-navigation
here to new main revision.
This change should be reverted & we should wait for progress on react-navigation
PR.
This is a PR to add a prop for enabling shadow during full screen swipe transition on iOS. Required for software-mansion/react-native-screens#2239.
Hey, if we are to proceed this one, you need to bump react navigation to it's recent main & incorporate these changes here. Obviously also resolve the merge conflicts. |
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.
Okay, I think we're good here. Great job! 🎉
This is a PR to add a prop for enabling shadow during full screen swipe transition on iOS. Required for software-mansion/react-native-screens#2239.
…adow during swipe gesture (software-mansion#2239) ## Description When using full screen swipe back there was no shadow under the view. Related PR software-mansion#2234 with discussion about this change. Corresponding PR in `react-navigation`: * react-navigation/react-navigation#12053 ## Changes Added shadow to transition in animateSimplePushWithTransitionContext:toVC:fromVC:. ## Test code and steps to reproduce 1. Run `Test2227` in TestsExample app. 2. Push screen with Go to Details. 3. Swipe back with full screen swipe gesture. 5. Before this fix there would be no shadow during transition with full screen swipe back. ## Checklist - [x] Included code example that can be used to test this change - [ ] Updated TS types - [x] Updated documentation: <!-- For adding new props to native-stack --> - [x] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [x] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [x] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [x] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
Description
When using full screen swipe back there was no shadow under the view.
Related PR #2234 with discussion about this change.
Corresponding PR in
react-navigation
:This PR add
fullScreenSwipeShadowEnabled
prop.Changes
Added shadow to transition in animateSimplePushWithTransitionContext:toVC:fromVC:.
Test code and steps to reproduce
Test2227
in TestsExample app.Checklist