Code added in onNotification automatically runs when notification is recived
import PushNotification from 'react-native-push-notification'
import PushNotificationIOS from '@react-native-community/push-notification-ios'
import { Linking, Platform } from 'react-native'
import { ScreenNames, Server } from './src/global'
import React from 'react'
import { useNavigation } from '@react-navigation/native'
import Axios from 'axios'
Code added in onNotification automatically runs when notification is recived
import PushNotification from 'react-native-push-notification' import PushNotificationIOS from '@react-native-community/push-notification-ios' import { Linking, Platform } from 'react-native' import { ScreenNames, Server } from './src/global' import React from 'react' import { useNavigation } from '@react-navigation/native' import Axios from 'axios'
class NotificationManager extends React.Component { configure = (userId, userType) => { PushNotification.configure({ onRegister: async function (token) { console.warn("token.token", token.token); if (userType == "Brand") { await Axios.put(
${Server.BASE_URL}/brandContactInfos/${userId}/registrationToken/${token.token}
) } else { await Axios.put(${Server.BASE_URL}/users/${userId}/registrationToken/${token.token}
) }} export const notificationManager = new NotificationManager()