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>
);
};
添加回答
举报