Skip to content

Commit 9c31ae9

Browse files
committed
fix: use install_modules_dependencies to fix compilation issues on RN 0.73 with Fabric
1 parent 620f379 commit 9c31ae9

1 file changed

Lines changed: 27 additions & 14 deletions

File tree

react-native-keyboard-controller.podspec

Lines changed: 27 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
44

55
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
66

7+
new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
8+
79
Pod::Spec.new do |s|
810
s.name = "react-native-keyboard-controller"
911
s.version = package["version"]
@@ -18,15 +20,9 @@ Pod::Spec.new do |s|
1820
s.source_files = "ios/**/*.{h,m,mm,swift}"
1921
s.public_header_files = "ios/**/*.h"
2022

21-
s.dependency "React-Core"
22-
2323
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
24-
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
25-
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
26-
s.pod_target_xcconfig = {
27-
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"${PODS_ROOT}/Headers/Private/Yoga\"",
28-
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
29-
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
24+
if new_arch_enabled then
25+
s.pod_target_xcconfig = {
3026
# This is handy when we want to detect if new arch is enabled in Swift code
3127
# and can be used like:
3228
# #if KEYBOARD_CONTROLLER_NEW_ARCH_ENABLED
@@ -36,12 +32,29 @@ Pod::Spec.new do |s|
3632
# #endif
3733
"OTHER_SWIFT_FLAGS" => "-DKEYBOARD_CONTROLLER_NEW_ARCH_ENABLED"
3834
}
35+
end
3936

40-
s.dependency "React-RCTFabric"
41-
s.dependency "React-Codegen"
42-
s.dependency "RCT-Folly"
43-
s.dependency "RCTRequired"
44-
s.dependency "RCTTypeSafety"
45-
s.dependency "ReactCommon/turbomodule/core"
37+
# install_modules_dependencies has been defined since React Native 71
38+
if defined?(install_modules_dependencies)
39+
install_modules_dependencies(s)
40+
else
41+
s.dependency 'React-Core'
42+
43+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
44+
if new_arch_enabled then
45+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
46+
s.pod_target_xcconfig = s.pod_target_xcconfig | {
47+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
48+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
49+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
50+
}
51+
52+
s.dependency "React-RCTFabric"
53+
s.dependency "React-Codegen"
54+
s.dependency "RCT-Folly"
55+
s.dependency "RCTRequired"
56+
s.dependency "RCTTypeSafety"
57+
s.dependency "ReactCommon/turbomodule/core"
58+
end
4659
end
4760
end

0 commit comments

Comments
 (0)