Skip to content

Instantly share code, notes, and snippets.

@wickstjo
Created March 30, 2019 22:30
Show Gist options
  • Save wickstjo/0d75e96a9879c93f830738dcce4c2400 to your computer and use it in GitHub Desktop.
Save wickstjo/0d75e96a9879c93f830738dcce4c2400 to your computer and use it in GitHub Desktop.
imports ...
class App extends Component {
state = {
routes: storage.get_profiles()
}
add = () => {
this.setState({
routes: [...this.state.routes, 'foo']
})
}
remove = (id, header) => {
this.setState({
routes: this.state.routes.filter((value, index) => index !== id)
})
}
render() {
const MainNavigator = createStackNavigator({
Home: {
screen: Home,
navigationOptions: {
header: null,
},
params: {
routes: this.state.routes,
remove: this.remove
}
},
Create: {
screen: Create,
navigationOptions: {
header: null,
},
params: {
add: this.add
}
},
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