我正面临一个奇怪的问题.在我的react-native 应用程序中,我有customAlert
个,它显示如果该语句为false,则当前只显示console.
import CustomAlert from '../components/CustomAlert';
const [modalVisible, setModalVisible] = useState(false);
<View style={{ marginTop: `30%`, alignItems: 'center' }}>
<GoogleSigninButton
style={{ width: 252, height: 58 }}
size={GoogleSigninButton.Size.Wide}
color={GoogleSigninButton.Color.Dark}
onPress={() => {
if (fingerprint === true) {
googleLogin();
}
else {
console.log("Alert should pop up");
<CustomAlert
modalVisible={modalVisible}
setModalVisible={setModalVisible}
title={'Message'}
message={'Please enable your Touch ID/PIN to your device'}
buttons={[{
text: 'Ok',
func: () => { console.log('Yes Pressed') }
}]}
/>
}
}
}
/>
</View>