Created
September 23, 2017 02:17
-
-
Save oseifrimpong/b8b0be82f8721217d97d428be845b616 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { PropTypes } from 'prop-types'; | |
import React, { Component } from 'react'; | |
import { View, Text, StyleSheet, Image, TouchableOpacity } from 'react-native'; | |
// import { StackNavigator } from 'react-navigation'; | |
// import SignUp from './SignUp'; | |
const styles = StyleSheet.create({ | |
container: { | |
flex: 1, | |
justifyContent: 'center', | |
alignItems: 'center', | |
}, | |
imagePic: { | |
width: 250, | |
height: 250, | |
}, | |
WelcomeText: { | |
color: '#707071', | |
width: 300, | |
textAlign: 'center', | |
fontSize: 20, | |
}, | |
buttonWrapper: { | |
flexDirection: 'row', | |
justifyContent: 'space-between', | |
}, | |
buttonContainer: { | |
backgroundColor: '#38def3', | |
width: 120, | |
padding: 10, | |
alignItems: 'center', | |
margin: 20, | |
borderRadius: 6, | |
}, | |
buttonText: { | |
color: '#fff', | |
fontSize: 20, | |
textAlign: 'center', | |
}, | |
}); | |
class Welcome extends Component { | |
static PropTypes = { | |
navigation: PropTypes.object, | |
}; | |
componentWillMount() { | |
// functions | |
handlePressLogin = () => { | |
this.props.navigation.navigate('Login'); //the error this line : "Navigation is missing in props validation | |
}; | |
handlePressSignUp = () => { | |
this.props.navigation.navigate('SignUp'); // same error here too | |
}; | |
} | |
render() { | |
// const { navigate } = this.props.navigation; | |
return ( | |
<View style={styles.container}> | |
<Text style={styles.WelcomeText}>Secure Your Future with a Click</Text> | |
<Image style={styles.imagePic} source={require('../../app/images/SplashIcon.png')} /> | |
<View style={styles.buttonWrapper}> | |
<TouchableOpacity style={styles.buttonContainer}> | |
<Text onPress={() => this.handlePressLogin()} style={styles.buttonText}> | |
Login | |
</Text> | |
</TouchableOpacity> | |
<TouchableOpacity style={styles.buttonContainer}> | |
<Text onPress={() => this.handlePressSignUp()} style={styles.buttonText}> | |
Sign Up | |
</Text> | |
</TouchableOpacity> | |
</View> | |
</View> | |
); | |
} | |
} | |
export default Welcome; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It should be
static propTypes = {...}
(lower case p)