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:
Expo SDK Setup:
expo install onesignal-expo-plugin
yarn add react-native-onesignal
{ "plugins": [ "onesignal-expo-plugin", { "mode": "development", }] }
import OneSignal from 'react-native-onesignal';
useEffect(() => { OneSignal.setAppId("Pasted Copied APP ID here"); }, []);
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
I solved it. actually, the error was occurring in the below code
"plugins": [
"onesignal-expo-plugin",
{
"mode": "development"
}
]
adding the extra Square brackets [ ] solved the "Cannot read property 'smallIcons' of undefined" problem
"plugins": [
[
"onesignal-expo-plugin",
{
"mode": "development"
}
]
]