Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created July 25, 2018 08:13
Show Gist options
  • Save amandeepmittal/cf65178d8a13b4a2e169ce49c6fd2ecc to your computer and use it in GitHub Desktop.
Save amandeepmittal/cf65178d8a13b4a2e169ce49c6fd2ecc to your computer and use it in GitHub Desktop.
// ScreenOne.js
import React, { Component } from 'react';
import { View, StyleSheet, TouchableHighlight, Text } from 'react-native';
class ScreenOne extends Component {
static navigationOptions = {
title: 'Welcome'
};
render() {
const { navigate } = this.props.navigation;
return (
<View style={styles.container}>
<TouchableHighlight
onPress={() => navigate('ScreenTwo', { screen: 'Screen Two' })}
style={styles.button}
>
<Text style={styles.buttonText}>Screen One </Text>
</TouchableHighlight>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
button: {
alignSelf: 'stretch',
marginLeft: 10,
marginRight: 10,
borderRadius: 5,
height: 40,
justifyContent: 'center'
},
buttonText: {
color: 'teal',
fontSize: 22,
alignSelf: 'center'
}
});
export default ScreenOne;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment