简体   繁体   中英

react native: How to pass an action to a screen react navigation, (without Redux)?

I almost finished my first react-native app (i'm a beginner), but i've got a big problem, i can't pass an action between my 2 screens 'Home.js' and 'Favoris.js', i want when i click on the save button, my 'favoris' screen refresh the content, but i didn't find. (No redux please)

I write in files: index.android.js and in the components folder with 'Home.js' and 'Favoris.js'

i put all my code in github: https://github.com/igaman/inspiness

Thanks a lot

You need to create a method in index.android.js and pass it to home.js as prop. Pass this method further to quoteDetail.js as prop. Call this method from quoteDetail.js. When this method is called, it is executed inside index.android.js. From inside the method's body in index.android.js, you can call a navigator to favoris screen.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM