Mitesh Baraiya
Mitesh Baraiya

Reputation: 3873

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

Just updated my Xcode to Version 14.3 today and the build is failing with the following error in the Yoga file:

Use of bitwise '|' with boolean operands

Looks like we have some issues with the 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 and cleaning the build. Tried removing pods and node_modules as well. But nothing has helped.

Upvotes: 94

Views: 61036

Answers (2)

Mitesh Baraiya
Mitesh Baraiya

Reputation: 3873

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.

Upvotes: 156

Mykola Odnosumov
Mykola Odnosumov

Reputation: 511

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

Upvotes: 51

Related Questions