0

Let me explain properly what I want to do.

I have these screens in react-native mobile-app

App.js

WalletDetails.js

Then I have another screen called PaymentDetails.js amongst many other screens

So what I want to do is that I need a button with onPress that would open directly walletDetails.js screen from PaymentDetails.js.

I have this code already on the paymentdetails page

<TouchableOpacity style={styles.cardPayBtn} onPress={()=>props.navigation.navigate("WalletDetails"); }}> <Text style={styles.buttonTitle}>{userdata && userdata.usertype == 'rider' ? t('payWithCard') : t('request_payment')}</Text> </TouchableOpacity> 
  • what is screen referred to in the question? – Beginner Jan 08 '22 at 17:48
  • @Beginner Navigation. I've several app pages. There's a page where payment is made and I want a button there that can take users to my wallet page as attached in this image link https://ibb.co/vCNGfKW By screen I'm trying to say pages or views in react native – TheBoss Lakrym Jan 08 '22 at 18:14
  • Sorry, I thought It was reactJS. You should add a react-native tag to your question. – Beginner Jan 08 '22 at 18:31
  • I'm sorry about that too. It is react native. Any help would be appreciated – TheBoss Lakrym Jan 08 '22 at 18:33
  • Does this answer your question? [How to navigate between different nested stacks in react navigation](https://stackoverflow.com/questions/49826920/how-to-navigate-between-different-nested-stacks-in-react-navigation) – Vipul Jan 08 '22 at 21:42

2 Answers2

0

I think for navigating between screens, React recomments react-navigation, it's a module to handle multiple screens (I'm using it myself and I really like it).

To get started, the react-navigation getting-started-guide helps a lot!

JaRoMaster
  • 428
  • 1
  • 3
  • 26
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 09 '22 at 03:27
0

You can use for this navigation purpose between one screen to another.

onPress={()=>this.props.navigation.navigate("WalletDetails")
Apps Maven
  • 1,314
  • 1
  • 4
  • 17