Created
March 14, 2017 04:19
-
-
Save stan229/d3f6a2a97c9ebdc11195b8480fbef354 to your computer and use it in GitHub Desktop.
React Navigation sample
This file contains hidden or 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 { AppRegistry, View, Text, Button } from "react-native"; | |
import { StackNavigator } from "react-navigation"; | |
const LoginScreen = props => ( | |
<View> | |
<Button | |
title="Log In" | |
onPress={() => { | |
props.navigation.navigate("Main"); | |
}} | |
/> | |
</View> | |
); | |
class MainScreen extends Component { | |
static navigationOptions = { | |
title: "Welcome" | |
}; | |
render() { | |
return ( | |
<View> | |
<Text>Welcome to React Navigation</Text> | |
</View> | |
); | |
} | |
} | |
const App = StackNavigator({ | |
Login: { screen: LoginScreen }, | |
Main: { screen: MainScreen } | |
}); | |
AppRegistry.registerComponent("NCAPRNRedux", () => App); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment