react-native-onesignal icon indicating copy to clipboard operation
react-native-onesignal copied to clipboard

Couldn't Replace Default Bell Notification Icon In Android Using Expo

Open aodstraitpay opened this issue 2 years ago • 6 comments

I'm working on changing the default bell notification using this doc

Environment

"react-native": "^0.74.2",
"expo": "^51.0.11",
"react-native-onesignal": "^5.2.2",
"onesignal-expo-plugin": "^2.0.3",

app.json

{
  "plugins": [
    [
      "onesignal-expo-plugin",
      {
        "mode": "development",
         "smallIcons": [
            "./assets/notification/small_notification_icon_hdpi.png",
            "./assets/notification/small_notification_icon_mdpi.png",
            "./assets/notification/small_notification_icon_xhdpi.png",
            "./assets/notification/small_notification_icon_xxhdpi.png",
            "./assets/notification/small_notification_icon_xxxhdpi.png"
          ],
          "largeIcons": [
            "./assets/notification/large_notification_icon_hdpi.png",
            "./assets/notification/large_notification_icon_mdpi.png",
            "./assets/notification/large_notification_icon_xhdpi.png",
            "./assets/notification/large_notification_icon_xxhdpi.png",
            "./assets/notification/large_notification_icon_xxxhdpi.png"
          ]
      }
    ]
  ]
}

Steps to Reproduce Issue

  1. Create an Expo project following expo docs
  2. Generate icon from Android Asset studio
  3. Setup Push notification following OneSignal guide
  4. Build the app using the command below:
npx expo prebuild       
npx expo run:android   
  1. Send a test notification from OneSignal Dashboard

aodstraitpay avatar Oct 15 '24 16:10 aodstraitpay

Hello @aodstraitpay thanks for your patience. Are you still having this issue?

If you see the default OneSignal bell icon, it is possible you did not add all icon sizes. Please add all icon sizes and correct paths. Can you confirm that the image is white, transparent, and 256x256 in size?

More info: https://documentation.onesignal.com/docs/notification-icons

jennantilla avatar Dec 06 '24 20:12 jennantilla

  • We set mode, devTeam, smallIcons, smallIconAccentColor and iosNSEFilePath,
  • We set only one image 96x96 for it (documentation says it will be scaled)
  • We put it in config/icon/<icon>.png
  • We named it exactly ic_stat_onesignal_default.png
  • The image is exactly 96x96, the icon is only white with full transparent background

And for us Android + iOS are both working.

  [
    'onesignal-expo-plugin',
    {
      // ...
      smallIcons: ['./config/icon/ic_stat_onesignal_default.png'],
      smallIconAccentColor: '#C0FFEE',   // Random funny color
      // ... 
    }
  ]

Our folder structure

android
ios
config
 └─  icon
      ├─  ...
      ├─  ic_stat_onesignal_default.png
      └─  ...
...
app.config.ts

Martinocom-Switcho avatar Feb 24 '25 14:02 Martinocom-Switcho

@fadi-george This is highly missleading, considering Expo is the recommended way to develop react-native apps at this moment. Setup documentation for OneSignal + Expo clearly indicates to use Expo plugin. But you stated that it's deprecated, so I expected to have at least an alternative setup for expo + CNG projects

But there are no alternatives to CNG projects right now.

Are we compelled to write our own expo plugins to configure OneSignal? We don't touch native code in our solution (.gitignoring android and ios folder entirely).

Martinocom-Switcho avatar Dec 22 '25 07:12 Martinocom-Switcho

@Martinocom-Switcho

The original comment was accidentally deleted.

This repository has been resurrected and we apologize for the inconvenience. Also, this ticket will be worked upon shortly.

abdulraqeeb33 avatar Dec 29 '25 20:12 abdulraqeeb33

Hello, Please go to https://github.com/OneSignal/onesignal-expo-plugin/issues and create the issue there if its related to expo.

fadi-george avatar Mar 13 '26 21:03 fadi-george

Will try to see if I can merge this next week https://github.com/OneSignal/onesignal-expo-plugin/pull/279 .

fadi-george avatar Mar 14 '26 01:03 fadi-george