wix / react-native-notifications

React Native Notifications
MIT License
3.25k stars 764 forks source link

Android 11 and above crashing on notification open #910

Closed qasimkhan23 closed 1 year ago

qasimkhan23 commented 2 years ago

The app crashes while opening the notification and shows the following message java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object android.os.Bundle.clone()' on a null object reference

currently using version 4.3.1

this patch fixes the problem fiel path: react-native-notifications/lib/android/app/src/main/java/com/wix/reactnativenotifications/core/notification/PushNotification.java

#

 private void notifyOpenedToJS() { 
     Bundle response = new Bundle(); 
     response.putBundle("notification", mNotificationProps.asBundle()); 
     mJsIOHelper.sendEventToJS(NOTIFICATION_OPENED_EVENT_NAME, response, mAppLifecycleFacade.getRunningReactContext()); 
 }

to

 private void notifyOpenedToJS() {
        Bundle response = new Bundle();
        try {
            response.putBundle("notification", mNotificationProps.asBundle());
        } catch (NullPointerException e) {
            Log.e(LOGTAG, "notifyOpenedToJS: Null pointer exception");
        }
stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] commented 1 year ago

The issue has been closed for inactivity.

kg-currenxie commented 1 year ago

The patch worked. This should be merged 😓 Too bad wix has abandoned the repo?