Skip to content

React Native New Architecture: Android TurboModule support#2902

Closed
wmathurin wants to merge 13 commits into
forcedotcom:devfrom
wmathurin:rn-migration
Closed

React Native New Architecture: Android TurboModule support#2902
wmathurin wants to merge 13 commits into
forcedotcom:devfrom
wmathurin:rn-migration

Conversation

@wmathurin
Copy link
Copy Markdown
Contributor

Summary

  • Convert all 4 React Native bridge modules from Java to Kotlin
  • Add TurboModule interface to all bridges
  • Unify callback pattern to single callback(error, result) matching iOS
  • Update SalesforceReactActivity and ReactBridgeHelper for new pattern

Changes

Bridge Conversion (Java → Kotlin + TurboModule)

  • SalesforceOauthReactBridge.java.kt
  • SalesforceNetReactBridge.java.kt
  • SmartStoreReactBridge.java.kt
  • MobileSyncReactBridge.java.kt

Supporting Changes

  • ReactBridgeHelper.java — new invokeSuccess()/invokeError() methods
  • SalesforceReactActivity.java — single-callback authenticate(), getAuthCredentials(), logout()
  • build.gradle.kts — added kotlin { jvmToolchain(17) }
  • package.json — points at wmathurin#rn-migration for test bundle
  • docs/salesforcereact/ARCHITECTURE.md — new architecture section

Testing

  • ./gradlew :libs:SalesforceReact:assembleDebug passes
  • All 4 RN templates build successfully on Android
  • App launches without crash on emulator

Related PRs

Before merging

  • Revert libs/SalesforceReact/package.json react-native-force to forcedotcom#dev
  • Run connected Android tests with credentials

wmathurin added 10 commits May 18, 2026 20:59
The libs.versions.toml had a TODO note about updating react-android in
a dedicated work item; this is the right work item.

- gradle/libs.versions.toml: react-android 0.79.3 -> 0.81.5
- libs/SalesforceReact/build.gradle.kts: removed the TODO comment

Verified: ./gradlew :libs:SalesforceReact:assembleDebug succeeds.

Note on remaining Android work for new architecture: the Java bridge
modules (SalesforceOauthReactBridge, etc.) use @ReactMethod with separate
success and error callbacks. Under new architecture interop mode, RN
can wrap legacy @ReactMethod modules without code changes. Switching
the test app to new architecture requires migrating its ReactNativeHost
to DefaultReactNativeHost; that is best handled as a follow-up.
- Convert all 4 bridge modules from Java to Kotlin
- Add TurboModule interface to all bridges
- Unify callback pattern: single callback(error, result) matching iOS
- Update SalesforceReactActivity for single-callback pattern
- Update ReactBridgeHelper with invokeSuccess/invokeError methods
- Add kotlin jvmToolchain(17) to build.gradle.kts
- Update architecture documentation
NOTE: This must be reverted before merging to dev.
@github-actions
Copy link
Copy Markdown

1 Warning
⚠️ Big PR, try to keep changes smaller if you can.

Generated by 🚫 Danger

In bridgeless/new architecture mode, modules registered via plain
ReactPackage.createNativeModules() are not discoverable through
TurboModuleRegistry. Switch to BaseReactPackage with getModule()
and ReactModuleInfoProvider so modules are found by name.
wmathurin added 2 commits May 22, 2026 16:05
BaseReactPackage approach didn't work at runtime. Reverting to plain
ReactPackage with createNativeModules(). Since our modules implement
TurboModule, the RN interop layer should make them available via
TurboModuleRegistry.get() automatically.
Create a proper Kotlin class for the package registration to ensure
BaseReactPackage is recognized by ReactPackageTurboModuleManagerDelegate
in bridgeless new architecture mode.
@wmathurin wmathurin marked this pull request as draft May 23, 2026 00:31
@wmathurin wmathurin closed this May 23, 2026
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.

1 participant