Skip to content

fix: [SDK-4346] resolve strict CodeGen rules preventing RN/Expo apps from building#1939

Merged
fadi-george merged 2 commits intomainfrom
fadi/sdk-4346-strict-codegen-rules-prevent-rnexpo-apps-from-building
Apr 9, 2026
Merged

fix: [SDK-4346] resolve strict CodeGen rules preventing RN/Expo apps from building#1939
fadi-george merged 2 commits intomainfrom
fadi/sdk-4346-strict-codegen-rules-prevent-rnexpo-apps-from-building

Conversation

@fadi-george
Copy link
Copy Markdown
Collaborator

@fadi-george fadi-george commented Apr 9, 2026

One Line Summary

Fix EventEmitter import path in NativeOneSignal.ts so React Native CodeGen doesn't fail for New Architecture builds on RN 0.76+.

See error:

> Task :react-native-onesignal:generateCodegenSchemaFromJavaScript FAILED
/Users/fadigeorge/Documents/Code/SDK/react-native-onesignal/examples/demo2/node_modules/@react-native/codegen/lib/parsers/parsers-commons.js:663
        throw parsingErrors[0];
        ^

UnsupportedModulePropertyParserError: Module NativeOneSignal: TypeScript interfaces extending TurboModule must only contain 'FunctionTypeAnnotation's or non nullable 'EventEmitter's. Property 'onPermissionChanged' refers to a 'TSTypeReference'.

Motivation

React Native 0.76+ with New Architecture enabled uses stricter CodeGen module resolution. The previous CodegenTypes.EventEmitter import from react-native doesn't resolve correctly under these stricter rules, causing a CodeGen error that prevents the app from building entirely.

This affects any RN 0.76+ or Expo user with New Architecture enabled. Importing EventEmitter directly from react-native/Libraries/Types/CodegenTypes fixes the resolution and allows CodeGen to process the TurboModule spec successfully.

Linear: SDK-4346

Scope

  • src/NativeOneSignal.ts -- changed EventEmitter import from CodegenTypes.EventEmitter (via react-native) to a direct import from react-native/Libraries/Types/CodegenTypes. This resolves the CodeGen failure for New Architecture builds on RN 0.76+.
  • examples/run-android.sh / examples/run-ios.sh -- removed stale cd into demo directory (unrelated cleanup)

Testing

  • Build the example app with New Architecture enabled on RN 0.76+ (npx expo run:ios) and confirm CodeGen no longer errors
  • Verify push notifications still fire event callbacks at runtime

Affected code checklist

  • TypeScript source (TurboModule spec)
  • Example app helper scripts
  • Native Android
  • Native iOS
  • Tests/CI

Checklist

  • Followed repo coding conventions
  • Changes are limited to what's described above
  • No secrets or credentials included

@fadi-george fadi-george requested a review from a team as a code owner April 9, 2026 19:12
@fadi-george fadi-george merged commit f1fd368 into main Apr 9, 2026
8 checks passed
@fadi-george fadi-george deleted the fadi/sdk-4346-strict-codegen-rules-prevent-rnexpo-apps-from-building branch April 9, 2026 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants