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

feat(iOS): add shadow to custom push pop transitions #2239

Merged
merged 5 commits into from
Jul 23, 2024

Conversation

maksg
Copy link
Contributor

@maksg maksg commented Jul 8, 2024

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

  1. Run Test2227 in TestsExample app.
  2. Push screen with Go to Details.
  3. Swipe back with full screen swipe gesture.
  4. Before this fix there would be no shadow during transition with full screen swipe back.

Checklist

@maksg maksg force-pushed the @maksg/shadow-during-custom-push-pop branch from 15a9ac9 to 5c864c4 Compare July 9, 2024 10:46
Copy link
Member

@WoLewicki WoLewicki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some comments.

### `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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Copy link
Member

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;
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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?

Copy link
Member

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The things we lack here:

  1. Update codegen interfaces for Android: run build on FabricExample & copy interfaces for Paper or wait for merge of this PR and then trigger build on Android / add a commit.
  2. Add a stub implementation for Android as done here, for example.

@@ -216,6 +217,9 @@ const RouteView = ({
if (fullScreenSwipeEnabled === undefined) {
fullScreenSwipeEnabled = true;
}
if (fullScreenSwipeShadowEnabled === undefined) {
fullScreenSwipeShadowEnabled = true;
Copy link
Member

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.

Copy link
Member

@kkafar kkafar left a 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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fullScreenSwipeShadowEnabled,
fullScreenSwipeShadowEnabled = false,

Comment on lines 228 to 230
if (fullScreenSwipeShadowEnabled === undefined) {
fullScreenSwipeShadowEnabled = false;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (fullScreenSwipeShadowEnabled === undefined) {
fullScreenSwipeShadowEnabled = false;
}

react-navigation Outdated
Copy link
Member

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.

satya164 pushed a commit to react-navigation/react-navigation that referenced this pull request Jul 22, 2024
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.
@kkafar
Copy link
Member

kkafar commented Jul 23, 2024

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.

@maksg maksg requested review from kkafar and WoLewicki July 23, 2024 11:11
Copy link
Member

@kkafar kkafar left a 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! 🎉

ja1ns pushed a commit to WiseOwlTech/react-native-screens that referenced this pull request Oct 9, 2024
…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
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

Successfully merging this pull request may close these issues.

3 participants