Use of bitwise '|' with boolean operands | XCode 14.3 fails builds using react-native Yoga
XCode IDE 升级后编辑之前的项目抛出了如上异常 ...
且 Yoga 库 code 抛出如下异常;
![](https://img.haomeiwen.com/i3095156/ed7bb9ae5bb12994.jpg)
方式一.手动将 | 替换为 ||
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
以上便是此次分享的全部内容,希望能对大家有所帮助!
网友评论