Я новичок, чтобы реагировать на нативный, я пытаюсь поработать над TouchableOpacity onPress, чтобы перейти к экрану SignUp: Однако TypeError: undefined не является объектом (оценивается как «navigation.navigate»)
Ниже мой код:
import React from 'react';
import { Text, StyleSheet, TextInput, TouchableOpacity, KeyboardAvoidingView } from 'react-native';
function Regform ({navigation}) {
return (
<KeyboardAvoidingView behavior="padding" style={styles.regform}>
<Text style={styles.welcome}> Welcome! </Text>
<Text style={styles.header}>Let's begin. Please fill out the information below.</Text>
<TextInput
placeholder="Your name"
style={styles.textinput}
underlineColorAndroid={'transparent'}
onSubmitEditing={() => React.yourdob.focus()} />
<TextInput
placeholder="Your date of birth"
style={styles.textinput}
underlineColorAndroid={'transparent'}
ref={(input) => React.yourdob = input}
onSubmitEditing={() => React.youremail.focus()} />
<TextInput
placeholder="Your email"
style={styles.textinput}
underlineColorAndroid={'transparent'}
ref={(input) => React.youremail = input}
onSubmitEditing={() => React.passwordInput.focus()} />
<TextInput
placeholder="Your password"
style={styles.textinput}
secureTextEntry={true}
underlineColorAndroid={'transparent'}
ref={(input) => React.passwordInput = input} />
<TouchableOpacity style={styles.button}
**onPress={() => navigation.navigate('Login')} >**
<Text style={styles.btntext}>Sign up </Text>
</TouchableOpacity>
</KeyboardAvoidingView>
);
}
export default Regform;