kandi background
Explore Kits

react-native-push-notification | React Native Local and Remote Notifications | iOS library

 by   zo0r Java Version: 8.0.1 License: MIT

 by   zo0r Java Version: 8.0.1 License: MIT

Download this library from

kandi X-RAY | react-native-push-notification Summary

react-native-push-notification is a Java library typically used in Mobile, iOS, React Native, React applications. react-native-push-notification has no bugs, it has no vulnerabilities, it has a Permissive License and it has high support. However react-native-push-notification build file is not available. You can install using 'npm i fanapptic-react-native-push-notification' or download it from GitHub, npm.
React Native Local and Remote Notifications for iOS and Android.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • react-native-push-notification has a highly active ecosystem.
  • It has 6059 star(s) with 1837 fork(s). There are 96 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 228 open issues and 1558 have been closed. On average issues are closed in 358 days. There are 10 open pull requests and 0 closed requests.
  • It has a negative sentiment in the developer community.
  • The latest version of react-native-push-notification is 8.0.1
This Library - Support
Best in #iOS
Average in #iOS
This Library - Support
Best in #iOS
Average in #iOS

quality kandi Quality

  • react-native-push-notification has 0 bugs and 0 code smells.
This Library - Quality
Best in #iOS
Average in #iOS
This Library - Quality
Best in #iOS
Average in #iOS

securitySecurity

  • react-native-push-notification has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • react-native-push-notification code analysis shows 0 unresolved vulnerabilities.
  • There are 0 security hotspots that need review.
This Library - Security
Best in #iOS
Average in #iOS
This Library - Security
Best in #iOS
Average in #iOS

license License

  • react-native-push-notification is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
This Library - License
Best in #iOS
Average in #iOS
This Library - License
Best in #iOS
Average in #iOS

buildReuse

  • react-native-push-notification releases are available to install and integrate.
  • Deployable package is available in npm.
  • react-native-push-notification has no build file. You will be need to create the build yourself to build the component from source.
  • Installation instructions, examples and code snippets are available.
  • It has 2116 lines of code, 117 functions and 32 files.
  • It has high code complexity. Code complexity directly impacts maintainability of the code.
This Library - Reuse
Best in #iOS
Average in #iOS
This Library - Reuse
Best in #iOS
Average in #iOS
Top functions reviewed by kandi - BETA

kandi has reviewed react-native-push-notification and discovered the below as its top functions. This is intended to give you an instant insight into react-native-push-notification implemented functionality, and help decide if they suit your requirements.

  • Sends notification to the notification centre .
    • Handle the received notification .
      • Convert this event to a JSON representation .
        • Handle a new token .
          • Sets the big - end icon for the specified URL .
            • Initialize Flipper .
              • Extracts the bundle from intent .
                • Converts a bundle to a JSON object .
                  • Handles local notification .
                    • Get a string value from manifest .

                      Get all kandi verified functions for this library.

                      Get all kandi verified functions for this library.

                      react-native-push-notification Key Features

                      Check out for changes and migration in the CHANGELOG:.

                      Android manual Installation

                      copy iconCopydownload iconDownload
                      ext {
                          googlePlayServicesVersion = "<Your play services version>" // default: "+"
                          firebaseMessagingVersion = "<Your Firebase version>" // default: "21.1.0"
                      
                          // Other settings
                          compileSdkVersion = <Your compile SDK version> // default: 23
                          buildToolsVersion = "<Your build tools version>" // default: "23.0.1"
                          targetSdkVersion = <Your target SDK version> // default: 23
                          supportLibVersion = "<Your support lib version>" // default: 23.1.1
                      }
                      

                      If you use remote notifications

                      copy iconCopydownload iconDownload
                      
                      buildscript {
                          ...
                          dependencies {
                              ...
                              classpath('com.google.gms:google-services:4.3.3')
                              ...
                          }
                      }
                      

                      If you don't use autolink

                      copy iconCopydownload iconDownload
                      ...
                      include ':react-native-push-notification'
                      project(':react-native-push-notification').projectDir = file('../node_modules/react-native-push-notification/android')
                      

                      Usage

                      copy iconCopydownload iconDownload
                      import PushNotificationIOS from "@react-native-community/push-notification-ios";
                      import PushNotification from "react-native-push-notification";
                      
                      // Must be outside of any component LifeCycle (such as `componentDidMount`).
                      PushNotification.configure({
                        // (optional) Called when Token is generated (iOS and Android)
                        onRegister: function (token) {
                          console.log("TOKEN:", token);
                        },
                      
                        // (required) Called when a remote is received or opened, or local notification is opened
                        onNotification: function (notification) {
                          console.log("NOTIFICATION:", notification);
                      
                          // process the notification
                      
                          // (required) Called when a remote is received or opened, or local notification is opened
                          notification.finish(PushNotificationIOS.FetchResult.NoData);
                        },
                      
                        // (optional) Called when Registered Action is pressed and invokeApp is false, if true onNotification will be called (Android)
                        onAction: function (notification) {
                          console.log("ACTION:", notification.action);
                          console.log("NOTIFICATION:", notification);
                      
                          // process the action
                        },
                      
                        // (optional) Called when the user fails to register for remote notifications. Typically occurs when APNS is having issues, or the device is a simulator. (iOS)
                        onRegistrationError: function(err) {
                          console.error(err.message, err);
                        },
                      
                        // IOS ONLY (optional): default: all - Permissions to register.
                        permissions: {
                          alert: true,
                          badge: true,
                          sound: true,
                        },
                      
                        // Should the initial notification be popped automatically
                        // default: true
                        popInitialNotification: true,
                      
                        /**
                         * (optional) default: true
                         * - Specified if permissions (ios) and token (android and ios) will requested or not,
                         * - if not, you must call PushNotificationsHandler.requestPermissions() later
                         * - if you are not using remote notification or do not have Firebase installed, use this:
                         *     requestPermissions: Platform.OS === 'ios'
                         */
                        requestPermissions: true,
                      });
                      

                      Handling Notifications

                      copy iconCopydownload iconDownload
                      {
                          foreground: false, // BOOLEAN: If the notification was received in foreground or not
                          userInteraction: false, // BOOLEAN: If the notification was opened by the user from the notification area or not
                          message: 'My Notification Message', // STRING: The notification message
                          data: {}, // OBJECT: The push data or the defined userInfo in local notifications
                      }
                      

                      Local Notifications

                      copy iconCopydownload iconDownload
                      PushNotification.localNotification({
                        /* Android Only Properties */
                        channelId: "your-channel-id", // (required) channelId, if the channel doesn't exist, notification will not trigger.
                        ticker: "My Notification Ticker", // (optional)
                        showWhen: true, // (optional) default: true
                        autoCancel: true, // (optional) default: true
                        largeIcon: "ic_launcher", // (optional) default: "ic_launcher". Use "" for no large icon.
                        largeIconUrl: "https://www.example.tld/picture.jpg", // (optional) default: undefined
                        smallIcon: "ic_notification", // (optional) default: "ic_notification" with fallback for "ic_launcher". Use "" for default small icon.
                        bigText: "My big text that will be shown when notification is expanded", // (optional) default: "message" prop
                        subText: "This is a subText", // (optional) default: none
                        bigPictureUrl: "https://www.example.tld/picture.jpg", // (optional) default: undefined
                        bigLargeIcon: "ic_launcher", // (optional) default: undefined
                        bigLargeIconUrl: "https://www.example.tld/bigicon.jpg", // (optional) default: undefined
                        color: "red", // (optional) default: system default
                        vibrate: true, // (optional) default: true
                        vibration: 300, // vibration length in milliseconds, ignored if vibrate=false, default: 1000
                        tag: "some_tag", // (optional) add tag to message
                        group: "group", // (optional) add group to message
                        groupSummary: false, // (optional) set this notification to be the group summary for a group of notifications, default: false
                        ongoing: false, // (optional) set whether this is an "ongoing" notification
                        priority: "high", // (optional) set notification priority, default: high
                        visibility: "private", // (optional) set notification visibility, default: private
                        ignoreInForeground: false, // (optional) if true, the notification will not be visible when the app is in the foreground (useful for parity with how iOS notifications appear). should be used in combine with `com.dieam.reactnativepushnotification.notification_foreground` setting
                        shortcutId: "shortcut-id", // (optional) If this notification is duplicative of a Launcher shortcut, sets the id of the shortcut, in case the Launcher wants to hide the shortcut, default undefined
                        onlyAlertOnce: false, // (optional) alert will open only once with sound and notify, default: false
                        
                        when: null, // (optional) Add a timestamp (Unix timestamp value in milliseconds) pertaining to the notification (usually the time the event occurred). For apps targeting Build.VERSION_CODES.N and above, this time is not shown anymore by default and must be opted into by using `showWhen`, default: null.
                        usesChronometer: false, // (optional) Show the `when` field as a stopwatch. Instead of presenting `when` as a timestamp, the notification will show an automatically updating display of the minutes and seconds since when. Useful when showing an elapsed time (like an ongoing phone call), default: false.
                        timeoutAfter: null, // (optional) Specifies a duration in milliseconds after which this notification should be canceled, if it is not already canceled, default: null
                      
                        messageId: "google:message_id", // (optional) added as `message_id` to intent extras so opening push notification can find data stored by @react-native-firebase/messaging module. 
                      
                        actions: ["Yes", "No"], // (Android only) See the doc for notification actions to know more
                        invokeApp: true, // (optional) This enable click on actions to bring back the application to foreground or stay in background, default: true
                      
                        /* iOS only properties */
                        category: "", // (optional) default: empty string
                        subtitle: "My Notification Subtitle", // (optional) smaller title below notification title
                      
                        /* iOS and Android properties */
                        id: 0, // (optional) Valid unique 32 bit integer specified as string. default: Autogenerated Unique ID
                        title: "My Notification Title", // (optional)
                        message: "My Notification Message", // (required)
                        picture: "https://www.example.tld/picture.jpg", // (optional) Display an picture with the notification, alias of `bigPictureUrl` for Android. default: undefined
                        userInfo: {}, // (optional) default: {} (using null throws a JSON value '<null>' error)
                        playSound: false, // (optional) default: true
                        soundName: "default", // (optional) Sound to play when the notification is shown. Value of 'default' plays the default sound. It can be set to a custom sound such as 'android.resource://com.xyz/raw/my_sound'. It will look for the 'my_sound' audio file in 'res/raw' directory and play it. default: 'default' (default sound is played)
                        number: 10, // (optional) Valid 32 bit integer specified as string. default: none (Cannot be zero)
                        repeatType: "day", // (optional) Repeating interval. Check 'Repeating Notifications' section for more info.
                      });
                      

                      Scheduled Notifications

                      copy iconCopydownload iconDownload
                      PushNotification.localNotificationSchedule({
                        //... You can use all the options from localNotifications
                        message: "My Notification Message", // (required)
                        date: new Date(Date.now() + 60 * 1000), // in 60 secs
                        allowWhileIdle: false, // (optional) set notification to work while on doze, default: false
                      
                        /* Android Only Properties */
                        repeatTime: 1, // (optional) Increment of configured repeatType. Check 'Repeating Notifications' section for more info.
                      });
                      

                      Get the initial notification

                      copy iconCopydownload iconDownload
                      PushNotification.popInitialNotification((notification) => {
                        console.log('Initial Notification', notification);
                      });
                      

                      Custom sounds

                      copy iconCopydownload iconDownload
                      soundName: 'my_sound.mp3'
                      

                      Channel Management (Android)

                      copy iconCopydownload iconDownload
                      import PushNotification, {Importance} from 'react-native-push-notification';
                      ...
                        PushNotification.createChannel(
                          {
                            channelId: "channel-id", // (required)
                            channelName: "My channel", // (required)
                            channelDescription: "A channel to categorise your notifications", // (optional) default: undefined.
                            playSound: false, // (optional) default: true
                            soundName: "default", // (optional) See `soundName` parameter of `localNotification` function
                            importance: Importance.HIGH, // (optional) default: Importance.HIGH. Int value of the Android notification importance
                            vibrate: true, // (optional) default: true. Creates the default vibration pattern if true.
                          },
                          (created) => console.log(`createChannel returned '${created}'`) // (optional) callback returns whether the channel was created, false means it already existed.
                        );
                      

                      List channels

                      copy iconCopydownload iconDownload
                      PushNotification.getChannels(function (channel_ids) {
                        console.log(channel_ids); // ['channel_id_1']
                      });
                      

                      Channel exists

                      copy iconCopydownload iconDownload
                      PushNotification.channelExists(channel_id, function (exists) {
                        console.log(exists); // true/false
                      });
                      

                      Channel blocked

                      copy iconCopydownload iconDownload
                      PushNotification.channelBlocked(channel_id, function (blocked) {
                        console.log(blocked); // true/false
                      });
                      

                      Delete channel

                      copy iconCopydownload iconDownload
                      PushNotification.deleteChannel(channel_id);
                      

                      1) cancelLocalNotification

                      copy iconCopydownload iconDownload
                      PushNotification.localNotification({
                          ...
                          id: '123'
                          ...
                      });
                      PushNotification.cancelLocalNotification('123');
                      

                      2) cancelAllLocalNotifications

                      copy iconCopydownload iconDownload
                      PushNotification.cancelAllLocalNotifications()
                      

                      3) removeAllDeliveredNotifications

                      copy iconCopydownload iconDownload
                      PushNotification.removeAllDeliveredNotifications();
                      

                      4) getDeliveredNotifications

                      copy iconCopydownload iconDownload
                      PushNotification.getDeliveredNotifications(callback);
                      

                      5) removeDeliveredNotifications

                      copy iconCopydownload iconDownload
                      PushNotification.removeDeliveredNotifications(identifiers);
                      

                      6) getScheduledLocalNotifications

                      copy iconCopydownload iconDownload
                      PushNotification.getScheduledLocalNotifications(callback);
                      

                      Android

                      copy iconCopydownload iconDownload
                      PushNotification.localNotificationSchedule({
                          ...
                          repeatType: 'day',
                          repeatTime: 2,
                          ...
                      });
                      

                      Notification Actions

                      copy iconCopydownload iconDownload
                        <receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationActions" />
                      

                      Handling Custom Payloads

                      copy iconCopydownload iconDownload
                      RNPushNotification.IntentHandlers.add(new RNPushNotification.RNIntentHandler() {
                        @Override
                        public void onNewIntent(Intent intent) {
                          // If your provider requires some parsing on the intent before the data can be
                          // used, add that code here. Otherwise leave empty.
                        }
                      
                        @Nullable
                        @Override
                        public Bundle getBundleFromIntent(Intent intent) {
                          // This should return the bundle data that will be serialized to the `notification.data`
                          // property sent to the `onNotification()` handler. Return `null` if there is no data
                          // or this is not an intent from your provider.
                          
                          // Example:
                          if (intent.hasExtra("MY_NOTIFICATION_PROVIDER_DATA_KEY")) {
                            return intent.getBundleExtra("MY_NOTIFICATION_PROVIDER_DATA_KEY");
                          }
                          return null;
                        }
                      });
                      

                      Reactnative IOS pushotification/PushNotificationIOS onNotification does not called directly when notification received

                      copy iconCopydownload iconDownload
                      import {Platform} from 'react-native';
                      import PushNotification from 'react-native-push-notification';
                      import PushNotificationIOS from "@react-native-community/push-notification-ios"; 
                      if (Platform.OS === 'ios') {
                      // Must be outside of any component LifeCycle (such as `componentDidMount`).
                      PushNotification.configure({
                          onNotification: function (notification) {
                              console.log("NOTIFICATION:", notification);
                              const { foreground, userInteraction, title, message } = notification;
                              if (foreground && (title || message) && !userInteraction) PushNotification.localNotification(notification);
                              notification.finish(PushNotificationIOS.FetchResult.NoData);
                          },
                      
                          permissions: {
                              // alert: true,
                              // badge: true,
                              sound: true
                            },
                      });
                      }
                      

                      react native import Carousel from "react-native-snap-carousel" not working

                      copy iconCopydownload iconDownload
                      npm install --save @types/react-native-snap-carousel
                      
                      $ npm install --save react-native-snap-carousel
                      
                      npm install --save @types/react-native-snap-carousel
                      
                      $ npm install --save react-native-snap-carousel
                      

                      Expo SDK 44 upgrade ERROR - App.js: [BABEL]: Unexpected token '.'

                      copy iconCopydownload iconDownload
                      expo update 43.0.0
                      
                      "babel-preset-expo": "9.0.2",
                      

                      this permision (android.permission.QUERY_ALL_PACKAGES) was automatically added to Manifest

                      copy iconCopydownload iconDownload
                      <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"
                              tools:node="remove" tools:ignore="QueryAllPackagesPermission" />
                      

                      Navgigation.navigate(param) with PushNotification in react native and react navigation

                      copy iconCopydownload iconDownload
                      export const Drawer = createDrawerNavigator();
                      
                      export const MyDrawer = () => {
                        return(
                          <Drawer.Navigator initialRouteName="Accueil">
                            <Drawer.Screen name="Accueil" component={Home} />
                            <Drawer.Screen name="Qui sommes-nous ?" component={Who} />
                            <Drawer.Screen name="Nos Services" component={Services} />
                            <Drawer.Screen name="Nos Biens" component={Bien} />
                          </Drawer.Navigator>
                        )
                      }
                      
                      export const Bottom = createBottomTabNavigator();
                      
                      export const MyBottom = () => {
                        return(
                          <Bottom.Navigator
                            screenOptions={({ route }) => ({
                              tabBarIcon: ({ focused, color, size }) => {
                                let iconName;
                      
                                if (route.name === 'Home') {
                                  iconName = focused
                                    ? 'home'
                                    : 'folder';
                                } else if (route.name === 'Mon Profil') {
                                  iconName = focused ? 'alert-circle' : 'aperture-sharp';
                                }
                      
                                // You can return any component that you like here!
                                return <Ionicons name={iconName} size={size} color={color} />;
                              },
                              tabBarActiveTintColor: 'tomato',
                              tabBarInactiveTintColor: 'gray',
                            })}
                          >
                            <Bottom.Screen name="Home" component={MyDrawer} options={{ headerShown: false }}/>
                            <Bottom.Screen name="Mon Profil" component={Profil} options={{ headerShown: false }}/>
                          </Bottom.Navigator>
                      
                        )
                      }
                      
                      
                      
                      export const navigationRef = createNavigationContainerRef()
                      
                      export function navigate(name, params) {
                          if (navigationRef.isReady()) {
                            navigationRef.navigate(name, params);
                          }
                        }
                      
                      
                      const RootStack = createNativeStackNavigator();
                      
                      export default function AppMenu() {
                        return (
                          <NavigationContainer ref={navigationRef} independent={true}>
                            <RootStack.Navigator initialRouteName="Accueil">
                      
                              // Here, I return My Bottom which is the principal menu that return itself MyDrawer menu
                              <RootStack.Screen name="Home2" component={MyBottom} options={{ headerShown: false }}/>
                            </RootStack.Navigator>
                          </NavigationContainer>
                        );
                      }
                      

                      React Native Push Notifications not working in Android but works fine on iOS

                      copy iconCopydownload iconDownload
                      function pushNotif(){
                        PushNotification.createChannel(
                          {
                            channelId: "specialid", // (required)
                            channelName: "Special messasge", // (required)
                            channelDescription: "Notification for special message", // (optional) default: undefined.
                            importance: 4, // (optional) default: 4. Int value of the Android notification importance
                            vibrate: true, // (optional) default: true. Creates the default vibration patten if true.
                          },
                          (created) => console.log(`createChannel returned '${created}'`) // (optional) callback returns whether the channel was created, false means it already existed.
                        );
                        PushNotification.localNotification({
                          channelId:'specialid', //his must be same with channelid in createchannel
                          title:'hello',
                          message:'test message'
                        })
                       }

                      Push Notifications with RealmDB (MongoDB) and react-native-push-notification

                      copy iconCopydownload iconDownload
                      PushNotification.subscribeToTopic('topic-id-in-realm-console');
                      
                      import PushNotificationIOS from '@react-native-community/push-notification-ios';
                      import PushNotification from 'react-native-push-notification';
                      
                      PushNotification.configure({
                        onRegister: function (token) {
                          console.log('TOKEN:', token);
                        },
                      
                        onNotification: function (notification) {
                          console.log('NOTIFICATION:', notification);
                          notification.finish(PushNotificationIOS.FetchResult.NoData);
                        },
                      
                        onAction: function (notification) {
                          console.log('ACTION:', notification.action);
                          console.log('NOTIFICATION:', notification);
                        },
                      
                        onRegistrationError: function (err) {
                          console.error(err.message, err);
                        },
                      
                        permissions: {
                          alert: true,
                          badge: true,
                          sound: true,
                        },
                        popInitialNotification: true,
                        requestPermissions: true,
                      });
                      
                      PushNotification.subscribeToTopic('topic-id-in-realm-console');// <== HERE
                      
                      PushNotification.subscribeToTopic('topic-id-in-realm-console');
                      
                      import PushNotificationIOS from '@react-native-community/push-notification-ios';
                      import PushNotification from 'react-native-push-notification';
                      
                      PushNotification.configure({
                        onRegister: function (token) {
                          console.log('TOKEN:', token);
                        },
                      
                        onNotification: function (notification) {
                          console.log('NOTIFICATION:', notification);
                          notification.finish(PushNotificationIOS.FetchResult.NoData);
                        },
                      
                        onAction: function (notification) {
                          console.log('ACTION:', notification.action);
                          console.log('NOTIFICATION:', notification);
                        },
                      
                        onRegistrationError: function (err) {
                          console.error(err.message, err);
                        },
                      
                        permissions: {
                          alert: true,
                          badge: true,
                          sound: true,
                        },
                        popInitialNotification: true,
                        requestPermissions: true,
                      });
                      
                      PushNotification.subscribeToTopic('topic-id-in-realm-console');// <== HERE
                      

                      React native firebase - android not able to build

                      copy iconCopydownload iconDownload
                      buildscript {
                          ext {
                          .....
                          firebaseMessagingVersion = "21.1.0"
                      }
                      

                      Alternative useState in react-native class component

                      copy iconCopydownload iconDownload
                      class App extends Component {
                      
                          componentDidMount() {
                              fcmService.registerAppWithFCM();
                              fcmService.register(this.onRegister, this.onNotification, this.onOpenNotification);
                              localNotificationService.configure(this.onOpenNotification)
                          }
                      
                          onRegister = (token) => {
                            console.log("[App] Token", token);
                          }
                      
                          onNotification = (notify) => {
                            // console.log("[App] onNotification", notify);
                            const options = {
                                soundName: 'default',
                                playSound: true,
                            }
                      
                            localNotificationService.showNotification(0,notify.notification.title,
                                  notify.notification.body, notify, options,)
                          }
                      
                          onOpenNotification = async (notify) => {
                              console.log('notify', notify);
                          }
                      }
                      

                      react-native-push-notification issue on building app

                      copy iconCopydownload iconDownload
                      buildscript {
                        ext {
                          buildToolsVersion = "28.0.3"
                          ...rest of your code
                        }
                        ...rest of your code
                      }
                      

                      Community Discussions

                      Trending Discussions on react-native-push-notification
                      • Reactnative IOS pushotification/PushNotificationIOS onNotification does not called directly when notification received
                      • react native import Carousel from &quot;react-native-snap-carousel&quot; not working
                      • Could not find com.google.android:flexbox:1.0.0 react-native-intercom
                      • Expo SDK 44 upgrade ERROR - App.js: [BABEL]: Unexpected token '.'
                      • this permision (android.permission.QUERY_ALL_PACKAGES) was automatically added to Manifest
                      • Navgigation.navigate(param) with PushNotification in react native and react navigation
                      • Invariant Violation: withNavigation can only be used on a view hierarchy of a navigator
                      • React Native Push Notifications not working in Android but works fine on iOS
                      • Push Notifications with RealmDB (MongoDB) and react-native-push-notification
                      • i cant run this app on my emulator CAN someone help me
                      Trending Discussions on react-native-push-notification

                      QUESTION

                      Reactnative IOS pushotification/PushNotificationIOS onNotification does not called directly when notification received

                      Asked 2022-Mar-22 at 14:51

                      I used reactnative PushNotification/PushNotificationIOS modules , My issue is when notification received on foreground to my device IOS ,the function onNotification: function(notification) {} does not called directly is called by click only . I want to fetch data notification paylaod sent via pububnub console directly without any user interaction ,this function is working fine in android but ios not all. the console does not show anything can help me to solve this issue and thanks.

                      This the function and imports module:

                      import PushNotification from "react-native-push-notification";
                      import PushNotificationIOS from "@react-native-community/push-notification-ios";
                      
                      onNotification: function(notification) {
                      if (Platform.OS=='ios')
                      {
                      
                        console.log('notif',notification)
                      
                       
                      notification.finish(PushNotificationIOS.FetchResult.NoData);
                      
                      },
                       
                          onAction: function (notification) {
                        
                          },
                         
                          onRegistrationError: function(err) {
                        
                          },
                        permissions: {
                            alert: true,
                            badge: true,
                            sound: true,
                          },
                         popInitialNotification: true,
                          requestPermissions: true,
                          senderID: FIREBASE_SENDER_ID,
                      })
                      }
                      

                      and this the object pubnub to send :

                      {"pn_apns":{
                            "aps":{
                              "alert": {
                                  "body": "Course disponible",
                                  "title": "My course"
                              },
                              "sound": "beep.wav",
                                  
                      "data": { "reference": "ND1004332", "startstation": ""  }
                                },
                      
                      
                            "pn_push":[
                               {
                                  "push_type":"alert",
                                  "auth_method":"token",
                                  "targets":[
                                     {
                                        "environment":"development",
                                        "topic":"com.test.fr"
                                     }
                                  ],
                                  "version":"v2"
                               }
                            ]
                      
                      }
                            
                      }  
                      

                      ANSWER

                      Answered 2022-Mar-22 at 14:51
                      import {Platform} from 'react-native';
                      import PushNotification from 'react-native-push-notification';
                      import PushNotificationIOS from "@react-native-community/push-notification-ios"; 
                      if (Platform.OS === 'ios') {
                      // Must be outside of any component LifeCycle (such as `componentDidMount`).
                      PushNotification.configure({
                          onNotification: function (notification) {
                              console.log("NOTIFICATION:", notification);
                              const { foreground, userInteraction, title, message } = notification;
                              if (foreground && (title || message) && !userInteraction) PushNotification.localNotification(notification);
                              notification.finish(PushNotificationIOS.FetchResult.NoData);
                          },
                      
                          permissions: {
                              // alert: true,
                              // badge: true,
                              sound: true
                            },
                      });
                      }
                      

                      Source https://stackoverflow.com/questions/71235403

                      Community Discussions, Code Snippets contain sources that include Stack Exchange Network

                      Vulnerabilities

                      No vulnerabilities reported

                      Install react-native-push-notification

                      The component uses PushNotificationIOS for the iOS part. You should follow their installation instructions.
                      If not using a built in Android color (@android:color/{name}) for the notification_color meta-data item. In android/app/src/main/res/values/colors.xml (Create the file if it doesn't exist).

                      Support

                      Maintainers are welcome ! Feel free to contact me :wink:.

                      DOWNLOAD this Library from

                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 430 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      Explore Related Topics

                      Share this Page

                      share link
                      Reuse Pre-built Kits with react-native-push-notification
                      Consider Popular iOS Libraries
                      Compare iOS Libraries with Highest Support
                      Compare iOS Libraries with Highest Quality
                      Compare iOS Libraries with Highest Security
                      Compare iOS Libraries with Permissive License
                      Compare iOS Libraries with Highest Reuse
                      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
                      over 430 million Knowledge Items
                      Find more libraries
                      Reuse Solution Kits and Libraries Curated by Popular Use Cases
                      Explore Kits

                      Save this library and start creating your kit

                      • © 2022 Open Weaver Inc.