package.json:
{
"main": "index.js",
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"expo": "~37.0.3",
"expo-updates": "~0.1.0",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "~0.61.5",
"react-native-gesture-handler": "~1.6.0",
"react-native-push-notification": "^3.4.0",
"react-native-reanimated": "~1.7.0",
"react-native-screens": "~2.2.0",
"react-native-unimodules": "~0.9.0",
"react-native-web": "~0.11.7"
},
"devDependencies": {
"@babel/core": "~7.9.0",
"babel-jest": "~25.2.6",
"jest": "~25.2.6",
"react-test-renderer": "~16.9.0"
},
"jest": {
"preset": "react-native"
},
"private": true
}
React Native autolink is enabled and firebase messaging is set correctly.
Issue is When I'm logging the console.log(NativeModules.RNPushNotification), It is returning null,
I'm using expo's bare-workflow and when i try to manualy add RN...package in mainapplication.java's getPagackges, it shows that module is already registered. So the module is registered, but not showing up in NativeModules
Hi @charanjit-singh
Can you share the OS tested ? iOS ? Android ?
also take a look at:
https://github.com/zo0r/react-native-push-notification#ios-manual-installation
It's on android
working great with create-react-native-app
I'm having the same problem. Works fine with plain react-native, but doesn't work in expo.
@pedrohba1 I got the exact same problem, did you figure out why it's not working in expo?
Is using packages that talk directly to the OS within expo not allowed, like notifications? I too am having the TypeError: null is not an object (evaluating 'RNPushNotification.presentLocalNotification') issue with this code:
import PushNotification, {
PushNotificationObject,
} from 'react-native-push-notification';
[...]
const message: PushNotificationObject = {
message: 'Test',
};
PushNotification.localNotification(message);
I also tried PushNotification.localNotification((notification) => console.log({notification}); with the same result.
I am running this via expo on an actual (older) Android 7 device, in case this is related to Android version. it's an old phone that I only use for testing. I have not manually linked anything so as to minimize issues with expo building things for me.
Is using packages that talk directly to the OS within expo not allowed, like notifications? I too am having the
TypeError: null is not an object (evaluating 'RNPushNotification.presentLocalNotification')issue with this code:import PushNotification, { PushNotificationObject, } from 'react-native-push-notification'; [...] const message: PushNotificationObject = { message: 'Test', }; PushNotification.localNotification(message);I also tried
PushNotification.localNotification((notification) => console.log({notification});with the same result.I am running this via expo on an actual (older) Android 7 device, in case this is related to Android version. it's an old phone that I only use for testing. I have not manually linked anything so as to minimize issues with expo building things for me.
I'm dumb. Expo has this page on it's site: https://docs.expo.io/versions/latest/sdk/notifications/
I haven't got it working yet, but I'm getting farther than I was - FYI for all the expo users watching this thread.