Skip to content

Commit b4c7469

Browse files
committed
Update Podspec to detect React Native package name
1 parent 5b89deb commit b4c7469

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

packages/host/scripts/patch-hermes.rb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,18 @@
44
raise "React Native Node-API cannot reliably patch JSI when React Native Core is prebuilt."
55
end
66

7+
def get_react_native_package
8+
if caller.any? { |frame| frame.include?("node_modules/react-native-macos/") }
9+
return "react-native-macos"
10+
elsif caller.any? { |frame| frame.include?("node_modules/react-native/") }
11+
return "react-native"
12+
else
13+
raise "Unable to determine React Native package from call stack."
14+
end
15+
end
16+
717
if ENV['REACT_NATIVE_OVERRIDE_HERMES_DIR'].nil?
8-
VENDORED_HERMES_DIR ||= `npx react-native-node-api vendor-hermes --silent '#{Pod::Config.instance.installation_root}'`.strip
18+
VENDORED_HERMES_DIR ||= `npx react-native-node-api vendor-hermes --react-native-package '#{get_react_native_package()}' --silent '#{Pod::Config.instance.installation_root}'`.strip
919
# Signal the patched Hermes to React Native
1020
ENV['BUILD_FROM_SOURCE'] = 'true'
1121
ENV['REACT_NATIVE_OVERRIDE_HERMES_DIR'] = VENDORED_HERMES_DIR

0 commit comments

Comments
 (0)