Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to swipe left to right to navigate back in react native

Tags:

react-native

How can I make a transition back to previous screen on swipe from left to right in a specific screen?

like image 728
Nodir Nasirov Avatar asked Oct 14 '25 18:10

Nodir Nasirov


2 Answers

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.

like image 192
kordiseps Avatar answered Oct 17 '25 11:10

kordiseps


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
  }
like image 27
sachin mathew Avatar answered Oct 17 '25 12:10

sachin mathew