I use react-navigation
and here is my structure:
Root Stack Navigator:
export const Root = StackNavigator({
Index: {
screen: Index,
navigationOptions: ({ navigation }) => ({
}),
},
Cart: {
screen: Cart,
navigationOptions: ({ navigation }) => ({
title: 'Votre panier',
drawerLabel: 'Cart',
drawerIcon: ({ tintColor }) => <Icon theme={{ iconFamily: 'FontAwesome' }} size={26} name="shopping-basket" color={tintColor} />
}),
},
...
My structure is as follows:
- StackNavigator (Root)
- DrawerNavigator (Index)
- Tabnavigator
- Mypage
- MyPage (same page formatted with different data)
- ...
So my question is: where to download my data, initialize my application? I need to call somewhere once, call in front of other pages.
The first page displayed in my application is the MyPage page. But, as you can see, due to TabNavigator, if I put my functions inside, it will be called many times.
, splashscreen, .
App.js, , , ?
const MyApp = () => {
ApplicationManager.loadData(store);
SplashScreen.hide();
return (
<Provider store={store}>
<Root/>
</Provider>
);
};
?