0
votes

I made an app on react native using expo and I want to implement alert.prompt from ios on android devices. I installed react-native-prompt but I can't use on expo it is existing other solutions for that? thank you!

3
does my solution work for you ? - trungh13

3 Answers

2
votes

Try this library, This is also compatible with expo because it is only a js API.You can create Text input, Title, Sub-title and button from it inside your prompt.

https://www.npmjs.com/package/react-native-dialog

I have also created a snack for you, have a look.

https://snack.expo.io/rkK2_63U8

0
votes
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 }
);

For more information visit https://docs.expo.io/versions/latest/react-native/alert/

0
votes

Try this one. As AlertIOS Deprecated and it now can be use with Alert 'react-native'

     Alert.prompt('Title', 'Subtitle', text =>
           console.log('You entered ' + text)
     )