Skip to content

Update Expo/Worklets integration and stabilizing the Android/iOS bridge - #33

Open
falleco wants to merge 2 commits into
borndotcom:masterfrom
falleco:master
Open

Update Expo/Worklets integration and stabilizing the Android/iOS bridge#33
falleco wants to merge 2 commits into
borndotcom:masterfrom
falleco:master

Conversation

@falleco

@falleco falleco commented Jul 23, 2026

Copy link
Copy Markdown

Summary

Hey, guys! Not sure if you wanna bring this on, but I was always dealing with the same problems when starting a new project that uses this repo (awesome work, btw). So, this PR tries modernizes react-native-godot for the current Expo and React Native ecosystem, improves support for hoisted monorepos, and consolidates some native bridge stability fixes.

It also fixes Android dependency resolution so consumers no longer need to manually configure a repository path through expo-build-properties.

Main changes

Expo and React Native compatibility

  • Updated the example to Expo SDK 57, React Native 0.86, and React 19.2.
  • Replaced react-native-worklets-core with react-native-worklets.
  • Updated the native integration for the current React Native New Architecture, codegen, Gradle, CocoaPods, and CMake behavior.
  • Simplified the example and removed obsolete configuration and leftover code.

Expo config plugin

The package now includes an Expo config plugin that configures the required Android settings automatically:

  • Sets minSdkVersion to 29, which is required by the Android SurfaceControl implementation.
  • Restricts native builds to the supported ARM architectures:
    • armeabi-v7a
    • arm64-v8a
  • Registers the bundled LibGodot Maven repository automatically.
  • Resolves the repository from the package's actual installed location.
  • Generates a path relative to the native Android project, making it work with:
    • regular applications;
    • hoisted Yarn/npm workspaces;
    • deeply nested monorepo applications;
    • Git and workspace package installations.
  • Preserves Maven repositories configured by other plugins.

Now other devs no longer need to use this type of workaround:

[
  'expo-build-properties',
  {
    android: {
      minSdkVersion: 29,
      extraMavenRepos: [
        '../../../../node_modules/@borndotcom/react-native-godot/android/libs/libgodot-android/4.5.1.migeran.2',
      ],
    },
  },
]

Expo applications installed through Git or a workspace only need to register the package plugin:

plugins: ['@borndotcom/react-native-godot']

The Android library also retains a Gradle-side fallback for non-Expo React Native applications.

Monorepo support

  • React Native and native dependency paths are resolved through Node instead of assuming a fixed node_modules layout.
  • Resolved paths are normalized before being passed to Gradle and CMake.
  • Metro uses Expo's standard configuration without application-specific monorepo path hacks.
  • The example can consume the library through a workspace while preserving React Native package resolution.

Android stability

  • Fixed LibGodot Maven dependency resolution.
  • Updated Prefab and CMake integration for modern React Native builds.
  • Improved JNI thread attachment and reference ownership.
  • Improved activity, context, window, and SurfaceControl lifecycle handling.
  • Added safer cleanup when Godot views are detached or destroyed.
  • Fixed lifecycle races that could crash the application when starting or switching Godot instances.
  • Ensured the packaged APK contains both the Godot and bridge native libraries for every supported ABI.

iOS stability

  • Improved native invocation scheduling and lifecycle cleanup.
  • Reviewed and incorporated the relevant bridge stability changes from the existing community patches.
  • Limited the render loop according to the display refresh rate, avoiding unnecessary unrestricted rendering while preserving normal animation behavior.

Compatibility notes

  • Android now requires API 29 or newer.
  • Android native artifacts currently support ARM devices only.
  • Applications must use react-native-worklets and have it installed instead of react-native-worklets-core.
  • Expo applications using a Git or workspace dependency must explicitly register the package config plugin because Expo cannot discover plugins from unpublished package metadata during dependency resolution.

References

The implementation was heavily based on other's works and adapted from the following community work:

Let me know if you wanna change something or just drop this, I wanted to use it as a drop-in replacement of your lib, so in practice to use it we just need to point to the fork repo, instead of using version 1.0.1.

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