Created
March 30, 2019 08:40
-
-
Save wickstjo/85ebd086f4b27b64793e6a13dfdc16b5 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, | |
} | |
}, | |
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