2017-06-21 68 views
2

如何更改我的警报框的反应本机的背景颜色,字体大小?点击一个按钮后,我放了我的警报。我不知道如何风格这一个,感谢您的帮助如何更改我的警报颜色在原生反应

Alert.alert(
    'Plate', 
    'Plate has been sent for printing!', 
    [ 
    {text: 'OK', onPress:() => console.log('OK Pressed')}, 
    ], 
    { cancelable: false } 
) 
+2

的可能的复制[自定义警告对话框反应本土?](https://stackoverflow.com/questions/37535263/custom-alert-dialog-in-react-native) –

回答

-1

您可以使用此库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 
} 
// ... 
相关问题