[英]undefined is not a function React-native
<TouchableOpacity onPress={() => this.login.bind(this).then(( )=> {this.navigate("Sikayet")})} style={styles.button}>
<Text style={styles.buttonText}>GİRİŞ</Text>
</TouchableOpacity>
嘗試使用此代替:
<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')
})
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.