Skip to content

Instantly share code, notes, and snippets.

@wickstjo
Created March 30, 2019 08:39
Show Gist options
  • Save wickstjo/4907a3aa5750dfb628701a4f38fe450e to your computer and use it in GitHub Desktop.
Save wickstjo/4907a3aa5750dfb628701a4f38fe450e to your computer and use it in GitHub Desktop.
imports ...
class App extends Component {
state = {
routes: storage.get_profiles()
}
add_route = () => {
this.setState({
routes: [...this.state.routes, 'foo']
})
}
remove_route = (id, header) => {
this.setState({
routes: this.state.routes.filter((value, index) => index !== id)
})
}
render() {
const MainNavigator = createStackNavigator({
Home: {
screen: (props) => {
return <Home
navigation={ props.navigation }
routes={ this.state.routes }
remove_route={ this.remove_route }
/>
},
navigationOptions: {
header: null,
screenProps: {
foo: 'bar'
}
}
},
Create: {
screen: (props) => {
return <Create
navigation={ props.navigation }
add_route={ this.add_route }
/>
},
navigationOptions: {
header: null,
}
},
Profile: {
screen: Profile,
navigationOptions: {
header: null
}
}
});
const AppContainer = createAppContainer(MainNavigator);
return ( <AppContainer />)
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment