Skip to content

Instantly share code, notes, and snippets.

@alaingoldman
Created October 31, 2017 20:09
Show Gist options
  • Select an option

  • Save alaingoldman/7dc7df6bef7ce8c272cb98bd5ad27cd5 to your computer and use it in GitHub Desktop.

Select an option

Save alaingoldman/7dc7df6bef7ce8c272cb98bd5ad27cd5 to your computer and use it in GitHub Desktop.
import {
StackNavigator,
} from 'react-navigation';
import Login from './Login';
import Register from './Register';
const App = StackNavigator({
Login: { screen: Login },
Register: { screen: Register },
});
export default App;
import { AppRegistry } from 'react-native';
import App from './App';
AppRegistry.registerComponent('someapp', () => App);
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableHighlight,
} from 'react-native';
export default class Login extends React.Component {
static navigationOptions = {
title: 'Login',
};
linker(){
this.props.navigation.navigate("Register");
}
render() {
const { navigate } = this.props.navigation;
return (
<View>
<TouchableHighlight onPress={this.linker.bind(this)}>
<Text> Login page </Text>
</TouchableHighlight>
</View>
);
}
}
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View
} from 'react-native';
export default class Register extends React.Component {
static navigationOptions = {
title: 'Register',
};
render() {
const { navigate } = this.props.navigation;
return (
<View>
<Text> Register page </Text>
</View>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment