Last active
June 28, 2017 09:08
-
-
Save FreddyPoly/a6c1d4a2b76c526055373d830552bc82 to your computer and use it in GitHub Desktop.
[REACT NATIVE] Navigation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AppRegistry } from 'react-native'; | |
import App from './src/index'; | |
AppRegistry.registerComponent('obexto_expensemanager', () => App); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AppRegistry } from 'react-native'; | |
import App from './src/index'; | |
AppRegistry.registerComponent('obexto_expensemanager', () => App); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Provider } from 'react-redux'; | |
import { createStore } from 'redux'; | |
import { Root } from './config/router'; | |
import rootReducer from './config/store'; | |
import SplashScreen from 'react-native-smart-splash-screen'; | |
class App extends Component { | |
componentDidMount () { | |
SplashScreen.close({ | |
animationType: SplashScreen.animationType.scale, | |
duration: 100, | |
delay: 0, | |
}); | |
} | |
render() { | |
return ( | |
<Provider store = {createStore(rootReducer)} > | |
<Root /> | |
</Provider> | |
) | |
} | |
} | |
export default App; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { StackNavigator, DrawerNavigator, TabNavigator } from 'react-navigation'; | |
// Import des commponents | |
import BurgerMenu from '../components/BurgerMenu'; | |
import DrawerView from '../components/DrawerView'; | |
// Import des écrans | |
import LoginContainer from '../scenes/login/LoginContainer'; | |
import MenuView from '../scenes/menu/MenuView'; | |
import CameraView from '../scenes/addReport/camera/CameraView'; | |
import CameraEdit from '../scenes/addReport/camera/CameraEdit'; | |
import EditContainer from '../scenes/addReport/edit/EditContainer'; | |
import ReadyContainer from '../scenes/listReport/ready/ReadyContainer'; | |
import DraftsContainer from '../scenes/listReport/drafts/DraftsContainer'; | |
// Import du thème | |
import { THEME } from './env.js'; | |
export const ListReports = TabNavigator({ | |
Ready: { | |
screen: ReadyContainer, | |
navigationOptions: { | |
tabBarLabel: THEME.listExpenseReadyTabTitle, | |
} | |
}, | |
Drafts: { | |
screen: DraftsContainer, | |
navigationOptions: { | |
tabBarLabel: THEME.listExpenseDraftTabTitle, | |
} | |
}, | |
}, { | |
initialRouteName: 'Ready', | |
tabBarOptions: { | |
activeTintColor: '#e91e63', | |
}, | |
lazy: true, | |
swipeEnabled: false, | |
}); | |
export const AppDrawer = DrawerNavigator({ | |
Menu: { | |
screen: MenuView, | |
navigationOptions: { | |
title: THEME.menuHeaderTitle, | |
}, | |
}, | |
'Nouvelle note de frais': { | |
screen: CameraView, | |
navigationOptions: { | |
header: false, | |
} | |
}, | |
'CameraEdit': { | |
screen: CameraEdit, | |
navigationOptions: { | |
header: false, | |
} | |
}, | |
Edit: { | |
screen: EditContainer, | |
navigationOptions: { | |
title: THEME.editHeaderTitle, | |
} | |
}, | |
'Vos notes de frais': { | |
screen: ListReports, | |
navigationOptions: { | |
title: THEME.listExpenseHeaderTitle, | |
}, | |
} | |
}, { | |
initialRouteName: 'Menu', | |
contentComponent: props => <DrawerView {...props} /> | |
}); | |
export const Root = StackNavigator({ | |
Login: { | |
screen: LoginContainer, | |
navigationOptions: { | |
header: false, | |
} | |
}, | |
App: { | |
screen: AppDrawer, | |
navigationOptions: ({navigation}) => ({ | |
headerLeft: <BurgerMenu nav = {navigation} />, | |
}) | |
} | |
}, { | |
headerMode: 'screen', | |
initialRouteName: 'Login', | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment