1 回答

TA貢獻1803條經驗 獲得超3個贊
就像評論中提到的那樣,您將不得不將基于類的組件轉換為功能組件,
function Profile() {
const { state, signOutFunction, clearMessage } = useContext(AuthContext);
const onSignOut = async () => {
Alert.alert(
'Sign out',
'Are you sure you want to Sign out?',
[
{
text: 'Cancel',
onPress: () => null,
style: 'cancel',
},
{ text: 'OK', onPress: signOutFunction() },
],
{ cancelable: true }
);
};
const onImagePress = () => {
ToastAndroid.show('Hi', ToastAndroid.SHORT);
};
return (
<View style={styles.container}>
<BackHeader route="Home" title="PROFILE" type="row" backIcon="ios-arrow-dropright" />
<ScrollView>
<ProfileTab data={dummyText} imagePress={onImagePress} />
<RoundButtonArray btnArray={btnArray} />
<Spacer />
<FlatButton name="Log Out" onClick={onSignOut} />
</ScrollView>
</View>
);
};
添加回答
舉報