反应原生的自定义警报对话框? [英] Custom alert dialog in react native?
问题描述
我正在尝试创建一个带有图像背景和一些自定义样式的自定义警报对话框,但似乎无法找到如何在 react-native 中使用 Alert 或 AlertIOS 来执行此操作.这是可能的,还是有一些图书馆可以帮助我?
I'm trying to create a custom alert dialog with an image background and some custom styling, but can't seem to find out how to do this using Alert or AlertIOS in react-native. Is this possible, or is there some library that can help me out?
推荐答案
Alert
和 AlertIOS
都利用每个平台的原生简单警报对话框.在 iOS 上,底层原生组件非常简单,只接受标题、消息和按钮,Android 上的情况类似.
Both Alert
and AlertIOS
utilise each platform's native simple alert dialog. On iOS the underlying native component is simplistic and only accepts a title, message, and buttons, with a similar case on Android.
对于更自定义的方法,您可以使用 React Native Modalbox 或 React Native Modal - 两者都提供高度可定制的模态组件.
For a more custom approach you could use React Native Modalbox, or React Native Modal - both of which provide a highly-customisable modal component.
以后我建议使用 JS.coach 来获取优质 React Native 组件的完整列表.
In future I'd recommend using JS.coach for a comprehensive list of quality React Native components.
这篇关于反应原生的自定义警报对话框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!