Push Notifications on React Native
Using Firebase, you can easily configure Gameball in-app notification and messages on your React native app.
Gameball uses Firebase to deliver maximum experience in your app. This includes push notifications, interactive in-app messaging and referrals support.
Configure Gameball With Your Firebase
Before you start, you must configure your Firebase on your Gameball account. Follow the steps in Configure your Firebase account on Gameball for mobile push notifications article from our Help Center related to push notifications.
Handling Push Notifications Integration
For notifications handling, add this code to the onNotification function in your app:
Import InAppNotification
InAppNotification takes the following props:
Parameter | Required | Description | Type |
| Required | Whether to show the notification or not | Bool: true/false |
| Required | Pass a function that convert isVisible prop from true to false | CallBack Function |
| Required | Pass the notification data received from the server | Notification |
You can use it in different two ways: one is by adding it directly underneath the main app like shown.
Another which is a suggested approach to import it inside a component so that you can use it to pass the props value using redux or state as follows. You had created a new component called NotificationComponent and imported in it the InAppNotification as described above, now in the render function:
After that, add it underneath your main app component as follows.
Your users can now receive push notifications from Gameball.
Last updated