feat: add support for custom screen transitions with native-stack v7 #12225
feat: add support for custom screen transitions with native-stack v7 #12225maciekstosio wants to merge 20 commits intomainfrom
Conversation
Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
|
The Expo app for the example from this branch is ready! |
✅ Deploy Preview for react-navigation-example ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
## Description This PR replaces passing screenRefs into using context. This avoids unnecessary logic on react-navigation side. ## Changes Create Context that holds screen refs and add this ref in ScreenStackItem instead of doing same on react-navigation part. See the changes there: react-navigation/react-navigation#12225 ## Testing See Example App > Swipe Back Animation (changes from react-navigation required: react-navigation/react-navigation#12225) OR react-navigation: TestScreenAnimation.tsx native-stack v5: TestScreenAnimationV5.tsx |native-stack v5|react-navigation| |-|-| |<video src="https://github.com/user-attachments/assets/0af1422c-4e61-4c7c-ba6d-1c6a852d4e13" />|<video src="https://github.com/user-attachments/assets/03af7230-198f-4081-ba6d-2b78325ebaa7" />| ## Checklist - [x] Included code example that can be used to test this change - [x] Updated TS types - [ ] Updated documentation: <!-- For adding new props to native-stack --> - [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
|
The solution feature works, but the PR is still in draft because I'm getting an error about CST.x.ReactNavigation.mov |
It's a warning, React Native core does not fully support strict mode. Likely unrelated to your changes. |
|
Hey @maciekstosio - is there still something blocking this PR from proceeding? |
|
This should not be merged until we figure out the issue in interaction between gesture handler and RN pressables, described here: software-mansion/react-native-screens#2819 |
## Description This PR replaces passing screenRefs into using context. This avoids unnecessary logic on react-navigation side. ## Changes Create Context that holds screen refs and add this ref in ScreenStackItem instead of doing same on react-navigation part. See the changes there: react-navigation/react-navigation#12225 ## Testing See Example App > Swipe Back Animation (changes from react-navigation required: react-navigation/react-navigation#12225) OR react-navigation: TestScreenAnimation.tsx native-stack v5: TestScreenAnimationV5.tsx |native-stack v5|react-navigation| |-|-| |<video src="https://github.com/user-attachments/assets/0af1422c-4e61-4c7c-ba6d-1c6a852d4e13" />|<video src="https://github.com/user-attachments/assets/03af7230-198f-4081-ba6d-2b78325ebaa7" />| ## Checklist - [x] Included code example that can be used to test this change - [x] Updated TS types - [ ] Updated documentation: <!-- For adding new props to native-stack --> - [ ] https://github.com/software-mansion/react-native-screens/blob/main/guides/GUIDE_FOR_LIBRARY_AUTHORS.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/native-stack/README.md - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/types.tsx - [ ] https://github.com/software-mansion/react-native-screens/blob/main/src/native-stack/types.tsx - [ ] Ensured that CI passes
1573758 to
05ca74a
Compare
Continuation of #12204 and #11943. Changes from original version:
In general, the idea suggested by @satya164 was that we could move more logic into react-native-screens and avoid leaking it to @react-navigation.
Original description:
Motivation
This PR intents to add implementation of custom screen transitions, recently added in react-native-screens. You can find more about this feature here.
Test plan
Go to the code of the native stack in example (NativeStack.tsx) and wrap whole navigator with (import from
react-native-screens/gesture-handler). After that, usegestureTypeprop on the desired screen.Ready to paste code 🍝
Presentation
Screen.Recording.2024-04-16.at.18.18.51.mov