From 5a66f64aaffe82246330e33263c6de99f04b26e4 Mon Sep 17 00:00:00 2001 From: Traviskn Date: Thu, 11 Jun 2026 12:05:04 -0600 Subject: [PATCH] fix(ios): avoid WorkletsModule.h import that breaks worklets-enabled builds Building an app with react-native-worklets could fail compiling RNAudioAPI with "'rnworklets/rnworklets.h' file not found", because AudioAPIModule.mm imported , which transitively includes the codegen-generated rnworklets spec header that is not visible to the RNAudioAPI compile unit in all build setups (e.g. prebuilt RNWorklets on EAS builds). - Forward-declare the single WorkletsModule method the file actually uses (getWorkletsModuleProxy) instead of importing the full header. - Add ReactCodegen header search paths to the worklets-enabled HEADER_SEARCH_PATHS so generated spec headers remain resolvable. Fixes #1095 Co-Authored-By: Claude Fable 5 --- packages/react-native-audio-api/RNAudioAPI.podspec | 8 +++++++- .../ios/audioapi/ios/AudioAPIModule.mm | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/react-native-audio-api/RNAudioAPI.podspec b/packages/react-native-audio-api/RNAudioAPI.podspec index e97fce05c..39b3191f6 100644 --- a/packages/react-native-audio-api/RNAudioAPI.podspec +++ b/packages/react-native-audio-api/RNAudioAPI.podspec @@ -99,7 +99,11 @@ Pod::Spec.new do |s| "\"$(PODS_TARGET_SRCROOT)/#{external_dir_relative}/include/vorbis\"" ]) .concat($RN_AUDIO_API_FFMPEG_DISABLED ? [] : ["\"$(PODS_TARGET_SRCROOT)/#{external_dir_relative}/include_ffmpeg\""]) - .concat(worklets_enabled ? ['"$(PODS_ROOT)/Headers/Public/RNWorklets"'] : []) + .concat(worklets_enabled ? [ + '"$(PODS_ROOT)/Headers/Public/RNWorklets"', + '"$(PODS_ROOT)/Headers/Private/ReactCodegen"', + '"$(PODS_ROOT)/../build/generated/ios/ReactCodegen"', + ] : []) .join(' '), "CLANG_CXX_LANGUAGE_STANDARD" => "c++20", "GCC_PREPROCESSOR_DEFINITIONS" => '$(inherited) HAVE_ACCELERATE=1', @@ -120,6 +124,8 @@ Pod::Spec.new do |s| ] .concat(worklets_enabled ? [ '"$(PODS_ROOT)/Headers/Public/RNWorklets"', + '"$(PODS_ROOT)/Headers/Private/ReactCodegen"', + '"$(PODS_ROOT)/../build/generated/ios/ReactCodegen"', "\"$(PODS_ROOT)/#{$audio_api_config[:dynamic_frameworks_worklets_dir]}/apple\"", "\"$(PODS_ROOT)/#{$audio_api_config[:dynamic_frameworks_worklets_dir]}/Common/cpp\"" ] : []) diff --git a/packages/react-native-audio-api/ios/audioapi/ios/AudioAPIModule.mm b/packages/react-native-audio-api/ios/audioapi/ios/AudioAPIModule.mm index c09633854..0d01c4e85 100644 --- a/packages/react-native-audio-api/ios/audioapi/ios/AudioAPIModule.mm +++ b/packages/react-native-audio-api/ios/audioapi/ios/AudioAPIModule.mm @@ -3,7 +3,13 @@ #import #if RN_AUDIO_API_ENABLE_WORKLETS -#import +// Forward-declare the single method used from WorkletsModule instead of importing +// , which transitively includes the codegen-generated +// that is not visible to this compile unit in all build setups +// (e.g. prebuilt RNWorklets in EAS builds). +@interface WorkletsModule : NSObject +- (std::shared_ptr)getWorkletsModuleProxy; +@end #endif #ifdef RCT_NEW_ARCH_ENABLED #import