React native 如何更改react native中警报的颜色

React native 如何更改react native中警报的颜色,react-native,react-native-android,React Native,React Native Android,如何更改react native中警报框的背景颜色和字体大小?我在点击按钮后发出警报。我不知道如何设计这个,谢谢你的帮助 Alert.alert( 'Plate', 'Plate has been sent for printing!', [ {text: 'OK', onPress: () => console.log('OK Pressed')}, ], { cancelable: false } ) 你可以使用这个图书馆。它的高度可定制的库具有针对不同网

如何更改react native中警报框的背景颜色和字体大小?我在点击按钮后发出警报。我不知道如何设计这个,谢谢你的帮助

Alert.alert(
  'Plate',
  'Plate has been sent for printing!',
  [
    {text: 'OK', onPress: () => console.log('OK Pressed')},
  ],
  { cancelable: false }
)
你可以使用这个图书馆。它的高度可定制的库具有针对不同网络类型警报的预定义样式。代码是这样的

    <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
}
// ...

// !!! 确保它是文档树中的最后一个组件。
this.dropdown=ref}
onClose={(数据)=>this.onClose(数据)}/>
// ...
HandlerRequestCallback(错误,响应){
if(err!=null){
this.dropdown.alertWithType('error','error',err)
}
}
// ...
onClose(数据){
//数据={类型、标题、消息、操作}
//操作表示解除警报的方式。返回:自动、编程、点击、平移或取消
}
// ...
  • 打开
    android/app/src/main/res/values/styles.xml
  • 标记中添加
    #000000
  • 您将获得以下信息:

    <resources>
    
        <!-- Base application theme. -->
        <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
            <item name="colorAccent">#000000</item>
        </style>
    </resources>
    
    
    #000000
    
    这将改变整个应用程序(警报、日历等)的颜色。

    可能重复的