Skip to content

Instantly share code, notes, and snippets.

@amandeepmittal
Created July 25, 2018 08:13
Show Gist options
  • Save amandeepmittal/04828abfa4bd12ceff146ee7b74528a5 to your computer and use it in GitHub Desktop.
Save amandeepmittal/04828abfa4bd12ceff146ee7b74528a5 to your computer and use it in GitHub Desktop.
// ScreenThree.js
import React, { Component } from 'react';
import { StyleSheet, View, Text, TouchableHighlight } from 'react-native';
class ScreenThree extends Component {
static navigationOptions = ({ navigation }) => ({
title: `Welcome ${navigation.state.params.screen}`
});
render() {
const { params } = this.props.navigation.state;
return (
<View style={styles.container}>
<Text style={styles.titleText}>{params.screen}</Text>
<TouchableHighlight
style={styles.button}
onPress={() => this.props.navigation.goBack()}
>
<Text style={styles.buttonText}>Go Back</Text>
</TouchableHighlight>
</View>
);
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center'
},
titleText: {
fontSize: 22
},
button: {
alignSelf: 'stretch',
marginRight: 25,
marginLeft: 25,
marginTop: 20,
borderRadius: 20,
backgroundColor: '#ff0044',
height: 50,
justifyContent: 'center'
},
buttonText: {
color: 'white',
fontSize: 18,
alignSelf: 'center'
}
});
export default ScreenThree;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment