diff --git a/example/ios/.xcode.env.local b/example/ios/.xcode.env.local index 9bc4d314..8b137891 100644 --- a/example/ios/.xcode.env.local +++ b/example/ios/.xcode.env.local @@ -1,2 +1 @@ -export NODE_BINARY=/private/var/folders/jd/67zkvtb16kq6d4pqn3bcjrhr0000gn/T/xfs-fbe94b7a/node diff --git a/example/ios/IosModalExample.xcodeproj/project.pbxproj b/example/ios/IosModalExample.xcodeproj/project.pbxproj index 93854c2b..8cfcd3f8 100644 --- a/example/ios/IosModalExample.xcodeproj/project.pbxproj +++ b/example/ios/IosModalExample.xcodeproj/project.pbxproj @@ -45,7 +45,7 @@ 5DCACB8F33CDC322A6C60F78 /* libPods-IosModalExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-IosModalExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = IosModalExample/LaunchScreen.storyboard; sourceTree = ""; }; 89C6BE57DB24E9ADA2F236DE /* Pods-IosModalExample-IosModalExampleTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-IosModalExample-IosModalExampleTests.release.xcconfig"; path = "Target Support Files/Pods-IosModalExample-IosModalExampleTests/Pods-IosModalExample-IosModalExampleTests.release.xcconfig"; sourceTree = ""; }; - C9B913807777FC589D42B994 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; name = PrivacyInfo.xcprivacy; path = IosModalExample/PrivacyInfo.xcprivacy; sourceTree = ""; }; + C9B913807777FC589D42B994 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = IosModalExample/PrivacyInfo.xcprivacy; sourceTree = ""; }; ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -472,6 +472,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = ZC7A6XV8GR; ENABLE_BITCODE = NO; INFOPLIST_FILE = IosModalExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( @@ -499,6 +500,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = 1; + DEVELOPMENT_TEAM = ZC7A6XV8GR; INFOPLIST_FILE = IosModalExample/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", diff --git a/example/ios/IosModalExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/ios/IosModalExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 00000000..18d98100 --- /dev/null +++ b/example/ios/IosModalExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index cf8cf4e2..033f16f4 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -956,6 +956,7 @@ PODS: - React-ImageManager - react-native-ios-utilities - React-NativeModulesApple + - React-RCTAppDelegate - React-RCTFabric - React-rendererdebug - React-utils @@ -1432,8 +1433,8 @@ SPEC CHECKSUMS: React-jsitracing: 0fa7f78d8fdda794667cb2e6f19c874c1cf31d7e React-logger: 29fa3e048f5f67fe396bc08af7606426d9bd7b5d React-Mapbuffer: bf56147c9775491e53122a94c423ac201417e326 - react-native-ios-modal: 44a55397a8b56c7ba03e728809b72499205a9baf - react-native-ios-utilities: 250dbc4f6ed59987f6d5d066fc72e76be57b77a0 + react-native-ios-modal: b722db282ae7172e1d62e0875d8e3176bec80c00 + react-native-ios-utilities: 65214d6a461519cd4db295e6205a6179b2c6d5af React-nativeconfig: 9f223cd321823afdecf59ed00861ab2d69ee0fc1 React-NativeModulesApple: ff7efaff7098639db5631236cfd91d60abff04c0 React-perflogger: 32ed45d9cee02cf6639acae34251590dccd30994 diff --git a/react-native-ios-modal.podspec b/react-native-ios-modal.podspec index 6e73fede..f68c671b 100644 --- a/react-native-ios-modal.podspec +++ b/react-native-ios-modal.podspec @@ -1,46 +1,132 @@ -require "json" +require 'json' -package = JSON.parse(File.read(File.join(__dir__, "package.json"))) -folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' +package = JSON.parse(File.read(File.join(__dir__, 'package.json'))) + +reactNativeVersion = '0.0.0' +begin + reactNativeVersion = `node --print "require('react-native/package.json').version"` +rescue + reactNativeVersion = '0.0.0' +end + +reactNativeTargetVersion = reactNativeVersion.split('.')[1].to_i + +fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1' +fabric_compiler_flags = '-DRN_FABRIC_ENABLED -DRCT_NEW_ARCH_ENABLED' +folly_version = '2022.05.16.00' +folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -Wno-comma -Wno-shorten-64-to-32' Pod::Spec.new do |s| - s.name = "react-native-ios-modal" - s.version = package["version"] - s.summary = package["description"] - s.homepage = package["homepage"] - s.license = package["license"] - s.authors = package["author"] + s.name = "react-native-ios-modal" + s.version = package["version"] + s.summary = package["description"] + s.homepage = package["homepage"] + s.license = package["license"] + s.authors = package["author"] + + s.platforms = { :ios => min_ios_version_supported } + s.source = { :git => "https://github.com/dominicstop/react-native-ios-modal.git", :tag => "#{s.version}" } + + s.swift_version = '5.4' + + s.static_framework = true + s.header_dir = 'react-native-ios-modal' + + header_search_paths = [ + '"$(PODS_ROOT)/boost"', + '"$(PODS_ROOT)/DoubleConversion"', + '"$(PODS_ROOT)/RCT-Folly"', + '"${PODS_ROOT}/Headers/Public/React-hermes"', + '"${PODS_ROOT}/Headers/Public/hermes-engine"', + '"${PODS_ROOT}/Headers/Private/React-Core"', + '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/Swift Compatibility Header"', + '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-modal/Swift Compatibility Header"', + #'"${PODS_ROOT}/Headers/Public/react-native-ios-utilities"', + #'"${PODS_ROOT}/Headers/Private/react-native-ios-utilities"', + #'"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/Swift Compatibility Header"', + ] + + # Swift/Objective-C compatibility + s.pod_target_xcconfig = { + 'USE_HEADERMAP' => 'YES', + 'DEFINES_MODULE' => 'YES', + 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20', + 'SWIFT_COMPILATION_MODE' => 'wholemodule', + 'HEADER_SEARCH_PATHS' => header_search_paths.join(' '), + "FRAMEWORK_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes\"", + 'OTHER_SWIFT_FLAGS' => "$(inherited) #{fabric_enabled ? fabric_compiler_flags : ''}" + } + user_header_search_paths = [ + '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/Swift Compatibility Header"', + '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/**"', + '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-modal/Swift Compatibility Header"', + + + #'"$(PODS_ROOT)/Headers/Private/react-native-ios-utilities"', + #'"$(PODS_ROOT)/Headers/Public/react-native-ios-utilities"', + + '"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging"', + '"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers"', + '"$(PODS_ROOT)/Headers/Private/Yoga"', + ] + if fabric_enabled && ENV['USE_FRAMEWORKS'] + user_header_search_paths << "\"$(PODS_ROOT)/DoubleConversion\"" + user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\"" + user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\"" + user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\"" + user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\"" + user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\"" + user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\"" + end + + s.user_target_xcconfig = { + "HEADER_SEARCH_PATHS" => user_header_search_paths, + } + + # s.xcconfig = { + # 'HEADER_SEARCH_PATHS' => [ + # '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/Swift Compatibility Header"', + # '"${PODS_CONFIGURATION_BUILD_DIR}/react-native-ios-utilities/**"', + # ], + # } - s.platforms = { :ios => min_ios_version_supported } - s.source = { :git => "https://github.com/dominicstop/react-native-ios-modal.git", :tag => "#{s.version}" } + compiler_flags = folly_compiler_flags + ' ' + "-DREACT_NATIVE_TARGET_VERSION=#{reactNativeTargetVersion}" + if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1' + compiler_flags += ' -DUSE_HERMES' + end - s.source_files = "ios/**/*.{h,m,mm}" + s.dependency 'React-Core' + s.dependency 'ReactCommon/turbomodule/core' + s.dependency 'React-RCTAppDelegate' if reactNativeTargetVersion >= 71 + s.dependency 'React-NativeModulesApple' if reactNativeTargetVersion >= 72 s.dependency 'react-native-ios-utilities' s.dependency 'DGSwiftUtilities' s.dependency 'ComputableLayout' - # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0. - # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79. - if respond_to?(:install_modules_dependencies, true) - install_modules_dependencies(s) - else - s.dependency "React-Core" - - # Don't install the dependencies when we run `pod install` in the old architecture. - if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then - s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1" - s.pod_target_xcconfig = { - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"", - "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1", - "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" - } - s.dependency "React-RCTFabric" - s.dependency "React-Codegen" - s.dependency "RCT-Folly" - s.dependency "RCTRequired" - s.dependency "RCTTypeSafety" - s.dependency "ReactCommon/turbomodule/core" - end + if fabric_enabled + compiler_flags << ' ' << fabric_compiler_flags + + s.dependency 'React-RCTFabric' + s.dependency 'RCT-Folly', folly_version end + + unless defined?(install_modules_dependencies) + # `install_modules_dependencies` is defined from react_native_pods.rb. + # when running with `pod ipc spec`, this method is not defined and we have to require manually. + require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods") + end + install_modules_dependencies(s) + + s.source_files = 'ios/**/*.{h,m,mm,swift,cpp}', 'common/cpp/**/*.{h,cpp}' + + exclude_files = ['ios/Tests/'] + if !fabric_enabled + exclude_files.append('ios/Fabric/') + exclude_files.append('common/cpp/fabric/') + end + + s.exclude_files = exclude_files + s.compiler_flags = compiler_flags + s.private_header_files = ['ios/**/*+Private.h', 'ios/**/Swift.h'] end