ex-navigation icon indicating copy to clipboard operation
ex-navigation copied to clipboard

Re-render on tab switch.

Open arthur-tse7 opened this issue 8 years ago • 6 comments

Hi, I'm fairly new to React-Native but this library has already been awesome to work with. I've gotten the TabNavigation working with each tab with its own StackNavigation. I would like to re-render each time I press on the a tab. For example, if I have tabs Home, Posts, and Profiles, if I press on any, it will re-render the content. How can I implement this ? Let me know if I should post a code snippet of what I've got so far. If this isn't doable right now, I would love to contribute to get this working !

arthur-tse7 avatar Dec 02 '16 01:12 arthur-tse7

I've had this PR pending since October. Would like to have some comment on it. :)

https://github.com/exponentjs/ex-navigation/pull/163

jozan avatar Dec 14 '16 10:12 jozan

Doesn't the lazy prop handle this? e.g. <TabNavigation lazy />

JulianKingman avatar Dec 27 '16 17:12 JulianKingman

Wrong button. @JulianKingman the lazy prop only works for the sliding tab.

arthur-tse7 avatar Dec 29 '16 18:12 arthur-tse7

@arthur-tse7 how did you manage to solve this? I want to execute some code to fetch from an http API, everytime a tab is selected. I have tried a lot and still have no idea

hecontreraso avatar Jan 03 '17 05:01 hecontreraso

@hecontreraso I didn't. I misclicked 'Close and comment'. The solution that Julian suggested only works for the SlidingTabBar.

arthur-tse7 avatar Jan 03 '17 05:01 arthur-tse7

The react-native-tab-view also mentions using the navigationState prop for this. I'm not sure how to do it, read on here: https://github.com/react-native-community/react-native-tab-view#caveats

JulianKingman avatar Mar 13 '17 17:03 JulianKingman