android react native expo的警报提示



我使用expo在react native上制作了一个应用程序,我想在android设备上从ios实现alert.prompt。我安装了react native prompt,但我不能在expo上使用它是现有的其他解决方案吗?非常感谢。

尝试这个库,它也与expo兼容,因为它只是一个js API。您可以在提示中创建文本输入、标题、子标题和按钮。

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

我还为你制作了一款小吃,看看吧。

https://snack.expo.io/rkK2_63U8

试试这个。由于AlertOS已弃用,现在可以与Alert"react native"一起使用

Alert.prompt('Title', 'Subtitle', text =>
console.log('You entered ' + text)
)
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 }
);

欲了解更多信息,请访问https://docs.expo.io/versions/latest/react-native/alert/

最新更新