Closed Zilleabbas10 closed 4 years ago
@Zilleabbas10 I have implemented using following:
<DropdownAlert
successColor={Colors.primary} <-- here you can specify the background color
renderImage={() => {}} // no icon
titleNumOfLines={0}
defaultContainer={{
padding: 8,
paddingTop: StatusBar.currentHeight,
flexDirection: "row"
}}
ref={ref => AlertHelper.setDropDown(ref)}
onClose={() => AlertHelper.invokeOnClose()}
/>
You can see that in DropdownAlertProps file:
Then use it:
export class AlertHelper {
static dropDown;
static onClose;
static setDropDown(dropDown) {
this.dropDown = dropDown;
}
static show(type, title, message) {
if (this.dropDown) {
this.dropDown.alertWithType(type, title, message);
}
}
static setOnClose(onClose) {
this.onClose = onClose;
}
static invokeOnClose() {
if (typeof this.onClose === "function") {
this.onClose();
}
}
}
Import and use: AlertHelper.show("success", "Incorrect Email or Password");
I can change background color using props successColor={'white'}
and containerStyle={{backgroundColor: 'white'}}
. Keep in mind, using successColor
implies you will invoke success
alert type and using containerStyle
implies you will invoke with empty or custom
alert type. And thanks @matapo for providing an example.
Short Description
I am trying to provide custom style to match my theme, but the Alert will not change the backgroundColor.
Steps to Reproduce / Code Snippets / Usage
is throws TS error contentContainerStyle={{backgroundColor: Colors.white}}
Expected Results
background of the notification should turn white
Additional Information