Description
Objective: implement an ios extension (share extension) which opens a react native view and calls extension completeRequest from the RN view in new architecture with the help of turbo module NativeShareUIModule.
Issue I'm encountering is: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeShareUIModule' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes
Main app targets compile successfully and also I can see specs
`@implementation NativeShareUIModuleSpecBase
- (void)setEventEmitterCallback:(EventEmitterCallbackWrapper *)eventEmitterCallbackWrapper
{
_eventEmitterCallback = std::move(eventEmitterCallbackWrapper->_eventEmitterCallback);
}
@end
namespace facebook::react {
static facebook::jsi::Value __hostFunction_NativeShareUIModuleSpecJSI_completeRequest(facebook::jsi::Runtime& rt, TurboModule &turboModule, const facebook::jsi::Value* args, size_t count) {
return static_cast<ObjCTurboModule&>(turboModule).invokeObjCMethod(rt, PromiseKind, "completeRequest", @selector(completeRequest:resolve:reject:), args, count);
}
NativeShareUIModuleSpecJSI::NativeShareUIModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms)
: ObjCTurboModule(params) {
methodMap_["completeRequest"] = MethodMetadata {1, __hostFunction_NativeShareUIModuleSpecJSI_completeRequest};
}
} // namespace facebook::react
`
ios/
├── MyApp/
├── ShareExt/
│ ├── ShareViewController.swift
│ ├── ExtensionContextProvider.m
│ ├── ExtensionContextProvider.h
│ ├── ShareExt-Bridging-Header.h
│ ├── WUINativeModule.h
│ ├── WUINativeModule.mm
|── build
ShareExt.zip
I've shared a zip files of what I'm doing
in podfile, I've added a post-install to link codegen generated files with my share extension but that's not helping
`post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
if target.name != "Sentry"
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
end
end
end
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)
# Link Codegen-generated TurboModules to Share Extension
share_ext_target = installer.pods_project.targets.find { |t| t.name == 'ShareExt' }
if share_ext_target
# Adjust path based on your structure
codegen_dir = File.join(__dir__, './build/generated/ios')
extensions = ['h', 'm', 'mm', 'cpp']
Dir.glob("#{codegen_dir}/**/*.{#{extensions.join(',')}}").each do |file_path|
relative_path = Pathname.new(file_path).relative_path_from(Pathname.new(installer.pods_project.path.dirname)).to_s
file_ref = installer.pods_project.new_file(relative_path)
# Avoid duplication
unless share_ext_target.source_build_phase.files_references.include?(file_ref)
share_ext_target.add_file_references([file_ref])
end
end
end
end`
`function IssuerUIExtension() {
return (
<View style={{ flex: 1, backgroundColor: 'red' }}>
<Text
style={{ color: 'white', textAlign: 'center', marginTop: 20 }}
onPress={() => NativeShareUIModule.completeRequest('true')}
>
Issuer UI Extension Placeholder
</Text>
</View>
);
}
export default IssuerUIExtension;`
package.json codegen config:
"codegenConfig": {
"name": "ZappSpec",
"type": "modules",
"jsSrcsDir": "./app/spec",
"android": {
"javaPackageName": "com.zeller.zellerapp"
},
"turbomoduleTemplates": [
{
"name": "shareExtensionNativeModule",
"type": "modules",
"jsSrcsDir": "./app/spec/extension"
}
]
}
Steps to reproduce
build the app and run ios share extension
React Native Version
0.76.9
Affected Platforms
Runtime - iOS
Areas
Bridgeless - The New Initialization Flow
Output of npx @react-native-community/cli info
System:
OS: macOS 15.5
CPU: (11) arm64 Apple M3 Pro
Memory: 306.81 MB / 18.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.18.0
path: /usr/local/bin/node
Yarn:
version: 4.1.0
path: /opt/homebrew/bin/yarn
npm:
version: 10.8.2
path: /usr/local/bin/npm
Watchman:
version: 2025.05.26.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK:
API Levels:
- "31"
- "33"
- "34"
- "35"
Build Tools:
- 29.0.2
- 33.0.1
- 34.0.0
- 35.0.0
System Images:
- android-29 | Google Play ARM 64 v8a
- android-33 | Desktop ARM 64 v8a
- android-34 | Google APIs ARM 64 v8a
- android-34 | Google Play ARM 64 v8a
- android-35 | Google Play ARM 64 v8a
Android NDK: Not Found
IDEs:
Android Studio: 2024.1 AI-241.19072.14.2412.12360217
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.11
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /Users/nehalsanklecha/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Stacktrace or Logs
Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeShareUIModule' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes
MANDATORY Reproducer
https://github.com/Nehal-Zeller/reproducer-react-native
Screenshots and Videos
No response
Description
Objective: implement an ios extension (share extension) which opens a react native view and calls extension completeRequest from the RN view in new architecture with the help of turbo module NativeShareUIModule.
Issue I'm encountering is: Invariant Violation: TurboModuleRegistry.getEnforcing(...): 'NativeShareUIModule' could not be found. Verify that a module by this name is registered in the native binary., js engine: hermes
Main app targets compile successfully and also I can see specs
`@implementation NativeShareUIModuleSpecBase
ios/
├── MyApp/
├── ShareExt/
│ ├── ShareViewController.swift
│ ├── ExtensionContextProvider.m
│ ├── ExtensionContextProvider.h
│ ├── ShareExt-Bridging-Header.h
│ ├── WUINativeModule.h
│ ├── WUINativeModule.mm
|── build
ShareExt.zip
I've shared a zip files of what I'm doing
in podfile, I've added a post-install to link codegen generated files with my share extension but that's not helping
`post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings["ONLY_ACTIVE_ARCH"] = "NO"
if target.name != "Sentry"
config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'NO'
end
end
end
end`
package.json codegen config:
Steps to reproduce
build the app and run ios share extension
React Native Version
0.76.9
Affected Platforms
Runtime - iOS
Areas
Bridgeless - The New Initialization Flow
Output of
npx @react-native-community/cli infoStacktrace or Logs
MANDATORY Reproducer
https://github.com/Nehal-Zeller/reproducer-react-native
Screenshots and Videos
No response