Skip to content

Commit 354cdcb

Browse files
committed
fix(Worklets): networking in Bundle Mode on some setups
Fix the folly/JSI header imports in WorkletsNetworking.mm so they resolve across setups: import folly convert via `react/utils/FollyConvert.h` (adding the React-utils iOS platform header path in the podspec), `jsi/JSIDynamic.h` directly, and `ReactCommon/RCTTurboModule.h` instead of `FBReactNativeSpec`. Drop the now-unused `FBReactNativeSpec` import from WorkletsModule.mm. Also eagerly `require` TurboModuleRegistry in `initializeNetworking` so `globalThis.TurboModules` is populated before it is used.
1 parent ee9d9e5 commit 354cdcb

4 files changed

Lines changed: 7 additions & 5 deletions

File tree

packages/react-native-worklets/RNWorklets.podspec

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Pod::Spec.new do |s|
5757

5858
s.dependency 'React-jsi'
5959
s.dependency 'React-hermes'
60-
60+
6161
s.pod_target_xcconfig = {
6262
"USE_HEADERMAP" => "YES",
6363
"DEFINES_MODULE" => "YES",
@@ -70,6 +70,7 @@ Pod::Spec.new do |s|
7070
'"$(PODS_ROOT)/DoubleConversion"',
7171
'"$(PODS_ROOT)/Headers/Private/React-Core"',
7272
'"$(PODS_ROOT)/Headers/Private/Yoga"',
73+
'"$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers/react/utils/platform/ios"',
7374
].join(' '),
7475
"FRAMEWORK_SEARCH_PATHS" => '"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes"',
7576
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",

packages/react-native-worklets/apple/worklets/apple/Networking/WorkletsNetworking.mm

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
#import <mutex>
77

8-
#import <FBReactNativeSpec/FBReactNativeSpec.h>
9-
#import <React-Core/React/RCTFollyConvert.h>
10-
#import <React-jsi/jsi/JSIDynamic.h>
8+
#import <ReactCommon/RCTTurboModule.h>
9+
#import <react/utils/FollyConvert.h>
10+
#import <jsi/JSIDynamic.h>
1111
#import <React/RCTAssert.h>
1212
#import <React/RCTConvert.h>
1313
#import <React/RCTHTTPRequestHandler.h>

packages/react-native-worklets/apple/worklets/apple/WorkletsModule.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#import <React/RCTCallInvoker.h>
1414

1515
#ifdef WORKLETS_FETCH_PREVIEW_ENABLED
16-
#import <FBReactNativeSpec/FBReactNativeSpec.h>
1716
#import <React/RCTNetworking.h>
1817
#import <ReactCommon/RCTTurboModule.h>
1918
#import <worklets/apple/Networking/WorkletsNetworking.h>

packages/react-native-worklets/src/bundleMode/network.native.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
* The NetworkingModule itself is injected via C++.
77
*/
88
export function initializeNetworking() {
9+
// eslint-disable-next-line @typescript-eslint/no-require-imports
10+
require('react-native/Libraries/TurboModule/TurboModuleRegistry');
911
const TurboModules = globalThis.TurboModules;
1012

1113
TurboModules.set('FileReaderModule', makeMockTurboModule('FileReaderModule'));

0 commit comments

Comments
 (0)