fix: add static frameworks support (#8)

This commit is contained in:
Krzysztof Moch
2025-05-05 15:19:34 +02:00
committed by GitHub
parent 35375f47d5
commit 1d97e63d42
3 changed files with 27 additions and 20 deletions
@@ -32,31 +32,28 @@ Pod::Spec.new do |s|
# Cxx to Swift bridging helpers
s.public_header_files = ["ios/Video-Bridging-Header.h"]
# 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.pod_target_xcconfig = {
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES FOLLY_MOBILE"
}
# Try to manually add the dependencies
# because they are not automatically added by expo
# when USE_FRAMEWORKS is true
if ENV["USE_FRAMEWORKS"]
s.dependency "React-Core"
# Don't install the dependencies when we run `pod install` in the old architecture.
if fabric_enabled 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
puts "[ReactNativeVideo] Detected USE_FRAMEWORKS, adding required dependencies..."
add_dependency(s, "React-jsinspector", :framework_name => "jsinspector_modern")
add_dependency(s, "React-rendererconsistency", :framework_name => "React_rendererconsistency")
# @KrzysztofMoch Note: We need to add this as well for newer versions of React Native, but it's not available in older versions
# add_dependency(s, "React-jsinspectortracing", :framework_name => 'jsinspector_moderntracing')
end
# Add all files generated by Nitrogen
load 'nitrogen/generated/ios/ReactNativeVideo+autolinking.rb'
add_nitrogen_files(s)
install_modules_dependencies(s)
end
@@ -8,7 +8,12 @@
#import "RCTFabricComponentsPlugins.h"
#import "ReactNativeVideo-Swift-Cxx-Umbrella.hpp"
#if __has_include("ReactNativeVideo/ReactNativeVideo-Swift.h")
#import "ReactNativeVideo/ReactNativeVideo-Swift.h"
#else
#import "ReactNativeVideo-Swift.h"
#endif
using namespace facebook::react;
@@ -1,7 +1,12 @@
#import "VideoView.h"
#import "ReactNativeVideo-Swift-Cxx-Umbrella.hpp"
#if __has_include("ReactNativeVideo/ReactNativeVideo-Swift.h")
#import "ReactNativeVideo/ReactNativeVideo-Swift.h"
#else
#import "ReactNativeVideo-Swift.h"
#endif
@implementation VideoView {
VideoComponentView* _view;