Skip to content

Instantly share code, notes, and snippets.

@stan229
Created March 14, 2017 04:19
Show Gist options
  • Save stan229/d3f6a2a97c9ebdc11195b8480fbef354 to your computer and use it in GitHub Desktop.
Save stan229/d3f6a2a97c9ebdc11195b8480fbef354 to your computer and use it in GitHub Desktop.
React Navigation sample
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