Skip to content

Instantly share code, notes, and snippets.

@jaromirnyklicek
Created July 13, 2017 12:45
Show Gist options
  • Save jaromirnyklicek/a311abdf58688aaf2a8d887a059798e8 to your computer and use it in GitHub Desktop.
Save jaromirnyklicek/a311abdf58688aaf2a8d887a059798e8 to your computer and use it in GitHub Desktop.
React native app with navigation
import React from 'react';
import {StackNavigator} from "react-navigation";
import {AppRegistry, Button} from "react-native";
class MainScreen extends React.Component {
static navigationOptions = {
title: 'Main'
};
render() {
const {navigate} = this.props.navigation;
console.log(this.props);
return (
<Button
title="Profil"
onPress={() => navigate('Profile')}
/>
);
}
}
class ProfileScreen extends React.Component {
static navigationOptions = {
title: 'Profil'
};
render() {
const {goBack} = this.props.navigation;
return (
<Button
title="Go back"
onPress={() => goBack()}
/>
);
}
}
export default StackNavigator({
Main: {screen: MainScreen},
Profile: {screen: ProfileScreen},
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment