导航到另一个屏幕,同时提交信息:handleSubmit
方法如下:
<View style={CreditRegStyle.button}>
<Button
style={CreditRegStyle.button}
title="Sign Up!"
onPress={this.handleSubmit}
/>
</View>
export default class CreditRegister extends Component {
handleSubmit = () => {
const value = this._form.getValue();
console.log('value: ', value);
}
render() {
return (
<>
如果您正在使用react-navigation模块,您可以在handlessubmit方法中提交您的信息,并在方法的末尾调用this.props.navigation.navigate(...)
,如这里所述:https://reactnavigation.org/docs/connecting-navigation-prop
export default class CreditRegister extends Component {
handleSubmit = () => {
const value = this._form.getValue();
try {
await submitYourInformation(value);
} catch (e) {
console.log(e);
}
this.props.navigation.navigate(screenName);
}
render() {
return (
<>