How can I make a transition back to previous screen on swipe from left to right in a specific screen?
If you are using @react-navigation/native-stack
, you may want to use @react-navigation/stack
. Because in @react-navigation/stack
comes with swipe back and you don't need to make any configuration.
one note from reactnavigation.org : One thing to keep in mind is that while @react-navigation/stack is extremely customizable, it's implemented in JavaScript. While it runs animations and gestures using natively, the performance may not be as fast as a native implementation. This may not be an issue for a lot of apps, but if you're experiencing performance issues during navigation, consider using @react-navigation/native-stack instead - which uses native navigation primitives.
simply you can use react-native-swipe-gestures and you can write your function to go back on swiping left to right
onSwipeLeft(gestureState) {
// your function to go back
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With