2017-06-21 66 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 
} 
// ... 
相關問題