Skip to content

Instantly share code, notes, and snippets.

@oseifrimpong
Created September 23, 2017 02:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oseifrimpong/b8b0be82f8721217d97d428be845b616 to your computer and use it in GitHub Desktop.
Save oseifrimpong/b8b0be82f8721217d97d428be845b616 to your computer and use it in GitHub Desktop.
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;
@spencercarli
Copy link

It should be static propTypes = {...} (lower case p)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment