Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions ReactNativeNavigation.podspec
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
require 'json'
require 'find'

package = JSON.parse(File.read(File.join(__dir__, 'package.json')))

fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'

# Detect if this is a Swift project by looking for user AppDelegate.swift files
dependency_paths = ['/node_modules/', '/Pods/', '/build/', '/Build/', '/DerivedData/']
swift_project = Dir.glob('**/AppDelegate.swift')
.reject { |file| dependency_paths.any? { |path| file.include?(path) } }
.any?
start_dir = File.expand_path('../../', __dir__)
swift_delegate_path = nil
Find.find(start_dir) do |path|
if path =~ /AppDelegate\.swift$/
swift_delegate_path = path
break
end
end

swift_project = File.exist?(swift_delegate_path)

# Debug output
if swift_project
puts "ReactNativeNavigation: Swift AppDelegate detected - enabling Swift-compatible configuration"
else
else
puts "ReactNativeNavigation: Objective-C AppDelegate detected - using standard configuration"
end

Expand Down Expand Up @@ -43,19 +50,19 @@ Pod::Spec.new do |s|
end

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

# Base xcconfig settings
xcconfig_settings = {
'HEADER_SEARCH_PATHS' => '"$(PODS_ROOT)/boost" "$(PODS_ROOT)/boost-for-react-native" "$(PODS_ROOT)/RCT-Folly" "$(PODS_ROOT)/Headers/Private/React-Core" "$(PODS_ROOT)/Headers/Private/Yoga"',
"CLANG_CXX_LANGUAGE_STANDARD" => "c++20",
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
}

# Only add DEFINES_MODULE for Swift projects
if swift_project
xcconfig_settings["DEFINES_MODULE"] = "YES"
end

s.pod_target_xcconfig = xcconfig_settings

if fabric_enabled
Expand Down
Loading