Open albertkai opened 5 years ago
Hey @albertkai , I created a pull request showing how to achieve what you are looking for. You can take a look here. Hope it helps 🤓
Hi @VitaliiK91 , I think the documentation might be wrong, as passing additionalProps={{ type: 'error' }} will result in an error. That being said, the PR you created with instructions on how to use it does not match the documentation in the readme anyways, and trying to use it that way yields no results. Any help would be appreciated, thanks!
@DrySoldier what type of error are you getting? Could you share the code snippet? As you can see in PR comments, the merged code is slightly different and README has the proper instructions, basically passProps has been renamed to additionalProps
@VitaliiK91 your readme has this
{
title: 'You pressed it!',
message: 'The notification has been triggered',
onPress: () => Alert.alert('Alert', 'You clicked the notification!')
additionalProps={{ type: 'error' }}
}
and if you look at the additionalProps
line, you'll see that it's incorrect JSON structure with the =
sign. But looking at your code with the PR you mentioned above, I tried
{
title: 'You pressed it!',
message: 'The notification has been triggered',
onPress: () => Alert.alert('Alert', 'You clicked the notification!')
additionalProps: { type: 'error' }
}
and the notification doesn't change in color or style whatsoever. There is no error either. It would be great if you could update the Readme with the right structure and (maybe?) one other example with all the options passed in so we understand how extensible it is.
@stonebinox Hi, yes you absolutely correct, I will open a new PR for README fix. As for color or style change I am not sure what you mean? This prop will just pass additional props to the notificationBodyComponent
where you can access them and style notification body. Could you share your NotificationBody
component? Thank you!
@VitaliiK91 actually i figured out the NotificationBody
bit so no worries. Maybe, updating the Readme with what I pointed out should be enough.
@stonebinox Glad it worked for you. Yeah I opened a PR with a README fix, hopefully that would help! Cheers!
Got any ideas on how i can pass additional props to showNotification function, in order to be able to customise the appearance, depending on the notification type. For example, i want to show green background for success notifications, and red for error etc.