In React Native, we have the option to use an Alert to notify the user in a popup. These 'simple' Alerts can be composed with:
Alert.alert('Hello world!')
Which produces an Alert with a message, no title, and an OK button.
You can also make 2 or 3 button Alerts, which are composed as follows (2 button example):
Alert.alert(
'Alert Title',
'My Alert Msg',
[
{
text: 'Ask me later',
onPress: () => console.log('Ask me later pressed')
},
{
text: 'Cancel',
onPress: () => console.log('Cancel Pressed'),
style: 'cancel',
},
{
text: 'OK',
onPress: () => console.log('OK Pressed')
},
],
{cancelable: false},
);
Notice here you have the options for an onPress
function for the buttons
What I am wondering is if I can apply an onPress
for the first case, when 'OK' is pressed, but there is no example (or any details really!) in the official docs
Perhaps it is not (yet) possible. Can anyone confirm or deny?