<TouchableOpacity onPress={() => this.login.bind(this).then(( )=> {this.navigate("Sikayet")})} style={styles.button}>
<Text style={styles.buttonText}>GİRİŞ</Text>
</TouchableOpacity>
答案 0 :(得分:0)
请尝试使用此代码:
<TouchableOpacity
onPress={() => {
this.login().then(() => {
this.navigate("Sikayet")
})
}}
style={styles.button}>
<Text style={styles.buttonText}>GİRİŞ</Text>
</TouchableOpacity>
或者,要在login
功能中稍微清理一下,请在那里处理导航部分,如下所示:
// in render function:
<TouchableOpacity
onPress={this.login.bind(this)}
style={styles.button}>
<Text style={styles.buttonText}>GİRİŞ</Text>
</TouchableOpacity>
// in login function:
login() {
otherFunction(email, password).then(() => {
this.navigate("Sikayet")
}).catch(error => {
// invalid login credentials
alert('Invalid email and password')
})
}