-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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 support for custom screen transitions with native-stack v7 #12225
base: main
Are you sure you want to change the base?
feat: add support for custom screen transitions with native-stack v7 #12225
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. |
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, usegestureType
prop on the desired screen.Ready to paste code 🍝
Presentation
Screen.Recording.2024-04-16.at.18.18.51.mov