App crashes after pressing notification on iOS 14 Issue-Resolved
If you are facing issue related to pressing the firebase push notificaion and its crash with this error “Call must be made on main thread was thrown while invoking complete on target RNFirebaseNotificaions with params…”
You have to follow these two simple steps
1. Go to ./node_modules/react-native-firebase/ios/RNFirebase/notifications/RNFirebaseNotifications.m
and just add try-catch
2. Now you need to make patch because you change the native code of react-native-firebase
install patch-package
from https://github.com/ds300/patch-package
OR
yarn add --dev patch-package
Now you make patch just giving this command
patch-package react-native-firebase
and add post-install script in your package.json file
"postinstall" : "patch-package && ./scripts/postinstall.sh",
That’s it. Close terminal, metro bundler. Clean you project from Xcode and build it again.
Congratulations. You have resolved your iOS 14 push notification issue in react-native project.
Thank you for reading….