Created
March 30, 2019 08:39
-
-
Save wickstjo/4907a3aa5750dfb628701a4f38fe450e to your computer and use it in GitHub Desktop.
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
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