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

huangapple go评论47阅读模式
英文:

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

问题

我刚刚将我的XCode更新到版本14.3,今天在Yoga文件中构建失败,错误信息如下:

使用布尔操作数进行按位“|”运算

看起来我们在iOS的Yoga包中遇到了一些问题。我不想再回退到较低的版本。如果有人可以帮助解决这个问题,那将很好。

我尝试过清除缓存数据和派生数据,然后清理构建。我还尝试过删除pods和node_modules,但都没有帮助。

英文:

Just updated my XCode to Version 14.3 today and build is failing with below error in Yoga file

Use of bitwise '|' with boolean operands

Looks like we have some issues with iOS yoga package. I don't want to rollback to lower version again. If someone can help to get over it, that would be nice.

I tried removing cached data and derived data & cleaning build. Tried removing pods and node_modules as well. But nothing has helped.

答案1

得分: 135

我通过在代码中将一个垂直线 | 替换为两个垂直线 || 来解决了这个问题。

然后清除了构建,现在在 XCode 14.3 上可以正常工作了。希望对某人有所帮助。

编辑:

上面的方法是临时解决方案。通过使用以下解决方案,我们不需要在每次 npm 安装时进行更改。这是由 @Carl G 建议的。@Mykola Odnosumov 在这个帖子中的解决方案也很有帮助,它是类似的解决方案。

感谢 @Carl G 和 @Mykola Odnosumov。

https://github.com/facebook/react-native/issues/36758#issuecomment-1496210081

  1. 安装 patch-package https://github.com/ds300/patch-package
  2. 修改源代码,就像这个提交 52d8a79
  3. 运行 npx patch-package react-native
  4. 提交你的更改。完成。
英文:

I resolved it by putting 2 Vertical bars || instead of one | in the code where it is failing.

Then cleared the build and it is working fine now on XCode 14.3. I Hope this helps someone.

Edit:

Above one is temporary solution.
By using following solution we do not need to make change on every npm installation. It is suggested by @Carl G. @Mykola Odnosumov 's Solution in this thread is also helpful, it is similar solution.
Thank you @Carl G and @Mykola Odnosumov

https://github.com/facebook/react-native/issues/36758#issuecomment-1496210081

  1. install patch-package https://github.com/ds300/patch-package
  2. Modify the source code like this commit 52d8a79
  3. run npx patch-package react-native
  4. commit your changes. Done.

答案2

得分: 41

General

此问题已在Yoga v1.19.0中修复。

查看此提交,日期为2022年4月12日,以及发布v1.19.0,日期为2021年5月21日。

How to fix

  1. 如果可能的话,将Yoga包更新到v1.19.0。
  2. 为了方便开发,请使用patch-package
    1. package.json文件中添加postinstall脚本,调用patch-package
    2. 编辑react-native/ReactCommon/yoga/yoga/Yoga.cpp以修复使用了错误运算符的问题。
    3. 执行npx patch-package react-native以生成.patch文件。
    4. 确保将patches/目录添加到git中。
英文:

General

This issue's been fixed in Yoga v1.19.0

Check out this commit dated Apr 12, 2022, and release v1.19.0 dated May 21, 2021.

How to fix

  1. Update the Yoga package to v1.19.0, if possible.
  2. Use patch-package for development ease
    1. Add postinstall script to package.json file with patch-package call
    2. Edit react-native/ReactCommon/yoga/yoga/Yoga.cpp to fix the issue with incorrect operator used
    3. Execute npx patch-package react-native to generate .patch file
    4. Make sure to add patches/ directory to git

huangapple
  • 本文由 发表于 2023年3月31日 19:08:03
  • 转载请务必保留本文链接:https://go.coder-hub.com/75897834.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定