如何更改我的警报颜色在原生反应
问题描述:
如何更改我的警报框的反应本机的背景颜色,字体大小?点击一个按钮后,我放了我的警报。我不知道如何风格这一个,感谢您的帮助如何更改我的警报颜色在原生反应
Alert.alert(
'Plate',
'Plate has been sent for printing!',
[
{text: 'OK', onPress:() => console.log('OK Pressed')},
],
{ cancelable: false }
)
答
您可以使用此库React-Native_DropDown-Alert。其高度可自定义的库,提供不同类型警报的预定义样式。代码会这样。
<View>
// !!! Make sure it's the last component in your document tree.
<DropdownAlert
ref={(ref) => this.dropdown = ref}
onClose={(data) => this.onClose(data)} />
</View>
// ...
handleRequestCallback(err, response) {
if (err != null) {
this.dropdown.alertWithType('error', 'Error', err)
}
}
// ...
onClose(data) {
// data = {type, title, message, action}
// action means how the alert was dismissed. returns: automatic, programmatic, tap, pan or cancel
}
// ...
的可能的复制[自定义警告对话框反应本土?](https://*.com/questions/37535263/custom-alert-dialog-in-react-native) –