Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing type prop ('success', 'error', 'info' etc) to showNotification #37

Open
albertkai opened this issue Jul 15, 2019 · 7 comments
Open

Comments

@albertkai
Copy link

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.

@VitaliiK91
Copy link
Contributor

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 🤓

@DrySoldier
Copy link

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!

@VitaliiK91
Copy link
Contributor

@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

@stonebinox
Copy link

@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.

@VitaliiK91
Copy link
Contributor

@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!

@stonebinox
Copy link

@VitaliiK91 actually i figured out the NotificationBody bit so no worries. Maybe, updating the Readme with what I pointed out should be enough.

@VitaliiK91
Copy link
Contributor

@stonebinox Glad it worked for you. Yeah I opened a PR with a README fix, hopefully that would help! Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants