Skip to content

[Bug] Runtime error - [TypeError: this.RNOneSignal.onPermissionChanged is not a function (it is undefined)] #1930

Description

@suprith-lumber

I am using snippet:

export const initOneSignal = async () => {
  OneSignal.initialize(config.ONE_SIGNAL_APP_ID);
  OneSignal.Debug.setLogLevel(LogLevel.Verbose);

  if (await OneSignal.Notifications.canRequestPermission()) {
    let permission = OneSignal.Notifications.getPermissionAsync();
    if (!permission) {
      await OneSignal.Notifications.requestPermission(true);
    }
  }
  await OneSignal.Notifications.requestPermission(true);
  OneSignal.setConsentRequired(true);
  OneSignal.setConsentGiven(true);
  const subscriptionId = await OneSignal.User.pushSubscription.getIdAsync();
  return subscriptionId;
};

version - ^5.4.0

these are all my dependencies:

  "dependencies": {
    "@expo/react-native-action-sheet": "^4.1.1",
    "@react-native-async-storage/async-storage": "2.2.0",
    "@react-native-community/image-editor": "^4.3.0",
    "@react-native-masked-view/masked-view": "0.3.2",
    "@react-navigation/bottom-tabs": "^7.2.0",
    "@react-navigation/native": "^7.1.6",
    "@react-navigation/native-stack": "^7.3.10",
    "@sentry/react-native": "^7.3.0",
    "@tanstack/query-async-storage-persister": "^5.75.7",
    "@tanstack/react-query": "^5.72.2",
    "@tanstack/react-query-persist-client": "^5.75.7",
    "axios": "^1.8.4",
    "dayjs": "^1.11.13",
    "easy-peasy": "^6.1.0",
    "expo": "^54.0.0",
    "expo-application": "~7.0.8",
    "expo-av": "~16.0.8",
    "expo-blur": "~15.0.8",
    "expo-build-properties": "~1.0.10",
    "expo-clipboard": "~8.0.8",
    "expo-constants": "~18.0.13",
    "expo-dev-client": "~6.0.20",
    "expo-device": "~8.0.10",
    "expo-document-picker": "~14.0.8",
    "expo-file-system": "~19.0.21",
    "expo-font": "~14.0.11",
    "expo-haptics": "~15.0.8",
    "expo-image": "~3.0.11",
    "expo-image-manipulator": "~14.0.8",
    "expo-image-picker": "~17.0.10",
    "expo-linear-gradient": "~15.0.8",
    "expo-linking": "~8.0.11",
    "expo-localization": "~17.0.8",
    "expo-navigation-bar": "~5.0.10",
    "expo-router": "~6.0.23",
    "expo-secure-store": "~15.0.8",
    "expo-sharing": "~14.0.8",
    "expo-splash-screen": "~31.0.13",
    "expo-status-bar": "~3.0.9",
    "expo-symbols": "~1.0.8",
    "expo-system-ui": "~6.0.9",
    "expo-updates": "~29.0.16",
    "expo-video": "~3.0.16",
    "expo-web-browser": "~15.0.10",
    "i18n-js": "^4.5.1",
    "lodash": "^4.17.21",
    "lodash.isequal": "^4.5.0",
    "lottie-react-native": "^7.2.2",
    "mixpanel-react-native": "^3.1.2",
    "moment": "^2.30.1",
    "moment-timezone": "^0.6.0",
    "onesignal-expo-plugin": "^2.0.3",
    "react": "19.1.0",
    "react-dom": "19.1.0",
    "react-native": "0.81.5",
    "react-native-blob-util": "^0.24.6",
    "react-native-gesture-handler": "~2.28.0",
    "react-native-get-random-values": "^1.11.0",
    "react-native-image-crop-picker": "^0.51.1",
    "react-native-image-zoom-viewer": "^3.0.1",
    "react-native-international-phone-number": "^0.10.5",
    "react-native-keyboard-controller": "1.18.5",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-modal": "^14.0.0-rc.1",
    "react-native-onesignal": "^5.4.0",
    "react-native-paper": "^5.13.1",
    "react-native-pdf": "^7.0.3",
    "react-native-pdf-page-image": "^0.2.1",
    "react-native-qrcode-svg": "^6.3.15",
    "react-native-reanimated": "^3.19.5",
    "react-native-safe-area-context": "~5.6.0",
    "react-native-screens": "~4.16.0",
    "react-native-share": "^12.2.6",
    "react-native-skeleton-placeholder-masked-view-fix": "^5.2.4-fix",
    "react-native-svg": "15.12.1",
    "react-native-ui-datepicker": "^3.1.2",
    "react-native-view-shot": "~4.0.3",
    "react-native-web": "^0.21.0",
    "react-native-webview": "13.15.0"
  },

None of the functions work, not even the initialize().

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions