Repository navigation
Integration With Existing iOS Project failed: 'CSSLayout/CSSLayout.h' file not found #11272
Description
Activity
It seems there is a workaround in #9014 which is
adding a recursive user header search path would also work (you could do that from your own Podfile
but I really don't know how to set that config.
and it seems like the pr https://github.com/facebook/react-native/commit/6e216d20343fccbb7bf9853ffb06a0d2628e9fc5 won't be merged until 0.40
I bumped into this same issue with the react-native-youtube library when trying to upgrade to 0.39.x. See davidohayon669/react-native-youtube#88
Reacted by How-Choong Hugo and Andrew ShiniI wrote a
post_installfunction to handle this issue, along with #11502 (only tested on React Native 0.39.2)# only for React Native ^0.39.[0-2] afaik def patch_csslayout(installer) version = `node -p -e "require('#{REACT_NATIVE_PATH}/package.json').version"` unless version =~ /^0\.39\.[0-2]$/ puts ">> Unsure if I should patch for CSSLayout on React Native #{version}. Skipping." return end puts ">> Patching for CSSLayout on React Native #{version}" # patch header files # https://github.com/facebook/react-native/issues/11272 `find #{REACT_NATIVE_PATH} \\( -name *.h -o -name *.m \\) -print0 | xargs -0 sed -i '' -e 's:<CSSLayout/\\(.*\\)>:"\\1":g'` # exclude duplicate symbols # https://github.com/facebook/react-native/issues/11502 installer.pods_project.targets.each do |target| next unless target.name == 'React' source_files = target.source_build_phase.files uniqs = source_files.uniq { |f| f.file_ref.path } (source_files - uniqs).each { |dup| source_files.delete(dup) } end end
Use as follows:
post_install do |installer| patch_csslayout(installer) end
Hope that helps unblock others on 0.39.2!
Also: I first tried the "add a header search path" version. It builds the library fine, but broken when building the Swift module/bridge. It might be fine for objc projects though, so here's the code if it's useful to anyone:
post_install do |installer| installer.pods_project.targets.each do |target| next unless target.name == 'React' target.build_configurations.each do |config| xcconfig_path = config.base_configuration_reference.real_path # read from xcconfig to build_settings dictionary build_settings = Hash[*File.read(xcconfig_path).lines.map { |x| x.split(/\s*=\s*/, 2) }.flatten] # modify HEADER_SEARCH_PATHS path = "${PODS_ROOT}/../#{REACT_NATIVE_PATH}/ReactCommon/**" build_settings['HEADER_SEARCH_PATHS'] = '' unless build_settings['HEADER_SEARCH_PATHS'] build_settings['HEADER_SEARCH_PATHS'].rstrip! << " #{path}" unless build_settings['HEADER_SEARCH_PATHS'].include?(path) # write build_settings dictionary to xcconfig File.open(xcconfig_path, 'w+') do |file| build_settings.each do |key, value| file.puts "#{key} = #{value}" end end end end end
Then you can
cat /Users/joshua/dev/work/Taxfix/taxfix-ios/Pods/Target\ Support\ Files/React/React.xcconfigto verify it's there afterward.Reacted by hitbear518 and Peter Oladimeji ShodeindeReacted by hitbear518At a glance (I'm not using pods in my current project), it looks like 7c91f89 undid some of #9544 and broke pod builds again for the same reason as 4e056e9 did -
CSSLayoutbuilds as part of theReactframework in open-source/pods world, even after moving files toReactCommon, and a framework shouldn't import its own internal headers using angle brackets. There was a hack/compromise to allow open-source to work while FB does its own thing internally, but that's been removed. cc @javacheFWIW CSSLayout was renamed on latest react-native 7f8c298
- added a commit that references this issue
on Feb 9, 2017 - added a commit that references this issue
on Feb 14, 2017 - locked as resolved and limited conversation to collaborators
on May 24, 2018 - addedResolution: LockedThis issue was locked by the bot.This issue was locked by the bot.
on Jul 19, 2018
Description
After upgrade to react-native@0.39, Integration With Existing Empty iOS Project failed, and old workaround
"postinstall": "find ./node_modules/react-native \\( -name *.h -o -name *.m \\) -print0 | xargs -0 sed -i '' -e 's:<CSSLayout/\\(.*\\)>:\"\\1\":g'"doesn't work nowreact-native@0.38 works just fine
Reproduction
Additional Information