美文网首页
Use of bitwise '|' with boolean

Use of bitwise '|' with boolean

作者: survivorsfyh | 来源:发表于2024-05-16 14:48 被阅读0次

Use of bitwise '|' with boolean operands | XCode 14.3 fails builds using react-native Yoga

XCode IDE 升级后编辑之前的项目抛出了如上异常 ...
且 Yoga 库 code 抛出如下异常;

方式一.手动将 | 替换为 ||

node->setLayoutHadOverflow(
        node->getLayout().hadOverflow() ||
        currentRelativeChild->getLayout().hadOverflow());

方式二.通过 cocoapods 方式
项目集成了 cocoapods 后,可以通过在 Podfile 中添加如下 code 后重新 install 尝试;

post_install do |installer|
## Fix for XCode 14.3
  find_and_replace(
  "../node_modules/react-native/ReactCommon/yoga/yoga/Yoga.cpp",
  "node->getLayout().hadOverflow() |\n",
  "node->getLayout().hadOverflow() ||\n"
  )
end
 
def find_and_replace(dir, findstr, replacestr)
  Dir[dir].each do |name|
      text = File.read(name)
      replace = text.gsub(findstr,replacestr)
      if text != replace
          puts "Fix: " + name
          File.open(name, "w") { |file| file.puts replace }
          STDOUT.flush
      end
  end
  Dir[dir + '*/'].each(&method(:find_and_replace))
end

以上便是此次分享的全部内容,希望能对大家有所帮助!

相关文章

网友评论

      本文标题:Use of bitwise '|' with boolean

      本文链接:https://www.haomeiwen.com/subject/kcabfjtx.html