I'm using Onesignal for push notifications but am stuck in an error and could not find the solution for many days.
OneSignal SDK Configuration:
- I configured the Google Android (FCM) Configuration with Firebase Server Key and Firebase Sender ID at Onesignal and selected the React Native/Expo SDK and copied the APP ID.
Expo SDK Setup:
- I have Expo Managed Workflow so I run the command
expo install onesignal-expo-plugin
- then I executed the command
yarn add react-native-onesignal
- Added the below code into App.json
{ "plugins": [ "onesignal-expo-plugin", { "mode": "development", }] }
- After that import react-native-onesignal and used APP ID in useEffect into reuqired JS
import OneSignal from 'react-native-onesignal';
useEffect(() => { OneSignal.setAppId("Pasted Copied APP ID here"); }, []);
- After that Run the Command
expo prebuild
but getting error
TypeError: Cannot read property 'smallIcons' of undefinedn at withSmallIcons (\node_modules\onesignal-expo-plugin\build\onesignal\withOneSignalAndroid.js)
now getting this error on all console commands related to this react-native project.
I configured Onesignal through the below documentation https://documentation.onesignal.com/docs/react-native-expo-sdk-setup