Skip to content

feat: [SDK-4157] add React Native New Architecture support (TurboModules)#1920

Merged
fadi-george merged 25 commits intomainfrom
fadi/sdk-4157-react-native-new-architecture-support-turbomodules-fabric
Mar 18, 2026
Merged

feat: [SDK-4157] add React Native New Architecture support (TurboModules)#1920
fadi-george merged 25 commits intomainfrom
fadi/sdk-4157-react-native-new-architecture-support-turbomodules-fabric

Conversation

@fadi-george
Copy link
Copy Markdown
Collaborator

@fadi-george fadi-george commented Mar 12, 2026

Description

One Line Summary

Migrate the SDK to React Native's New Architecture using TurboModules, Fabric, and Bridgeless Mode, dropping legacy Bridge support.

Details

Motivation

React Native 0.76+ enables the New Architecture by default. The SDK needed native TurboModule support to work correctly with apps using TurboModules, Fabric renderer, and Bridgeless Mode. This is tracked in #1675 and SDK-4157.

Implementation follows the official Turbo Native Modules guide from the React Native working group, including the event emitter pattern using CodegenTypes.EventEmitter.

Scope

This is a breaking change (v6.0.0). The minimum React Native version is now 0.76.0.

What changed:

  • Added NativeOneSignal.ts TurboModule spec with codegen configuration
  • Android: RNOneSignal.java extends codegen-generated NativeOneSignalSpec, package registration uses BaseReactPackage
  • iOS: Renamed .m to .mm, module extends NativeOneSignalSpecBase, implements getTurboModule: for JSI registration
  • Event system migrated from NativeEventEmitter to CodegenTypes.EventEmitter with direct onXxx subscriptions
  • Removed all #ifdef RCT_NEW_ARCH_ENABLED conditionals (legacy arch no longer supported)
  • Removed 4 deprecated sync methods (getPushSubscriptionId, getPushSubscriptionToken, getOptedIn, hasPermission)
  • Public API methods (addTags, addAliases, addTriggers) now use Record<string, string> types
  • Removed runtime type coercion/validation (TypeScript enforces at compile time)
  • Hot reload cleanup via globalThis to prevent duplicate event subscriptions

What is not affected:

  • All existing public API method signatures remain the same (except removed deprecated methods)
  • Native SDK versions are unchanged
  • Push notification delivery, IAM, outcomes, sessions behavior unchanged

Testing

Unit testing

All 246 unit tests pass. Tests updated to mock TurboModuleRegistry and codegen-generated event emitters instead of NativeModules and NativeEventEmitter.

Manual testing

Tested on iOS simulator and Android emulator with the demo app covering initialization, push permission, notifications (foreground/background/click), login/logout, tags, aliases, email/SMS, IAM triggers, outcomes, and event observers.

cd into examples/demo and run either bun run ios or bun run android.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

@fadi-george fadi-george requested a review from a team as a code owner March 12, 2026 19:03
@fadi-george fadi-george changed the title feat: add React Native New Architecture support (TurboModules) feat!: add React Native New Architecture support (TurboModules) Mar 12, 2026
@fadi-george fadi-george requested a review from nan-li March 12, 2026 19:58
@abdulraqeeb33
Copy link
Copy Markdown

@fadi-george how sure are we that this works well for us? with the entire architecture update
would it support older devices?
would it be a breaking change?
Do we have to upgrade libraries to accommodate this change?

@fadi-george
Copy link
Copy Markdown
Collaborator Author

fadi-george commented Mar 12, 2026

@fadi-george how sure are we that this works well for us? with the entire architecture update would it support older devices? would it be a breaking change? Do we have to upgrade libraries to accommodate this change?

Device support would be depedent on the Android SDK so still Android 6.0+ (API 24).

@fadi-george fadi-george force-pushed the fadi/sdk-4157-react-native-new-architecture-support-turbomodules-fabric branch 13 times, most recently from 8188d28 to ee4d7c6 Compare March 13, 2026 03:01
@fadi-george fadi-george force-pushed the fadi/sdk-4157-react-native-new-architecture-support-turbomodules-fabric branch from ee4d7c6 to b043706 Compare March 18, 2026 18:16
@fadi-george fadi-george changed the title feat!: add React Native New Architecture support (TurboModules) feat: [SDK-4157] add React Native New Architecture support (TurboModules) Mar 18, 2026
@fadi-george fadi-george requested a review from nan-li March 18, 2026 19:42
@fadi-george fadi-george force-pushed the fadi/sdk-4157-react-native-new-architecture-support-turbomodules-fabric branch from 38f670e to 891680c Compare March 18, 2026 21:14
@fadi-george fadi-george force-pushed the fadi/sdk-4157-react-native-new-architecture-support-turbomodules-fabric branch from 00a99db to b34904c Compare March 18, 2026 21:29
@fadi-george fadi-george force-pushed the fadi/sdk-4157-react-native-new-architecture-support-turbomodules-fabric branch from 5090bef to cf81d92 Compare March 18, 2026 21:58
@fadi-george fadi-george merged commit 46e22f1 into main Mar 18, 2026
7 checks passed
@fadi-george fadi-george deleted the fadi/sdk-4157-react-native-new-architecture-support-turbomodules-fabric branch March 18, 2026 22:14
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.

3 participants