th3rdwave / react-native-safe-area-context

A flexible way to handle safe area insets in JS. Also works on Android and Web!
MIT License
2.08k stars 191 forks source link

Support use_frameworks! #416

Open jankosecki opened 12 months ago

jankosecki commented 12 months ago

Hi,

we are using RN 0.72 with new architecture and we've tried to use use_frameworks! :linkage => static to upgrade our dependency of Firebase. However after doing that compilation of react-native-safe-area-context fails due to missing header files.

I'm trying to fix the issues by modifying spec via Podfile:

      if target.name == "react-native-safe-area-context" then
        target.build_configurations.each do |config|
          header_search = {"HEADER_SEARCH_PATHS" => [
            "$(PODS_TARGET_SRCROOT)/common/cpp/",
            "$(PODS_ROOT)/Headers/Public/hermes-engine/",
            "$(PODS_ROOT)/Headers/Public/RCTRequired/",
            "$(PODS_ROOT)/Headers/Public/FBLazyVector/",
            "$(PODS_ROOT)/Headers/Public/React-callinvoker/",
            "$(PODS_ROOT)/RCT-Folly/",
            "$(PODS_ROOT)/boost/",
            "$(PODS_ROOT)/DoubleConversion/",
            "$(PODS_CONFIGURATION_BUILD_DIR)/React-NativeModulesApple/React_NativeModulesApple.framework/Headers/",
            "$(PODS_CONFIGURATION_BUILD_DIR)/React-Codegen/React_Codegen.framework/Headers/",
            "$(PODS_CONFIGURATION_BUILD_DIR)/React-Fabric/React_Fabric.framework/Headers/",
            "$(PODS_CONFIGURATION_BUILD_DIR)/React-utils/React_utils.framework/Headers/",
            "$(PODS_CONFIGURATION_BUILD_DIR)/React-debug/React_debug.framework/Headers",
            "$(PODS_CONFIGURATION_BUILD_DIR)/React-RCTFabric/RCTFabric.framework/Headers",
            "$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers",
            "$(PODS_CONFIGURATION_BUILD_DIR)/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios/",
            "$(PODS_CONFIGURATION_BUILD_DIR)/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core",
          ]}
          config.build_settings.merge!(header_search)
        end
      end

but I wonder if there is a better way to support static frameworks than this

jacobp100 commented 12 months ago

I don’t think any of the maintainers are likely to pick this up, but we will review and merge PRs if you want to submit one

janicduplessis commented 12 months ago

Have you tried 4.7.0? I updated the way we setup the pod for new arch so I'm hoping this will fix those issues.

jankosecki commented 12 months ago

Yes, I did but that didn't help.

Unfortunately I don't know iOS ecosystem well enough to understand exactly what use_frameworks! does and why suddenly so many header files cannot be found, but the modification applied in post_install of my Podfile allowed me to compile our app for iOS

snowdigital commented 11 months ago

need to add

s.pod_target_xcconfig = { 'FRAMEWORK_SEARCH_PATHS' =>

in podpec file

and replace header imports with named ones