Use of bitwise '|' with boolean operands | Xcode 14.3 fails builds using react-native Yoga
Matthew C.
—When creating the build for a React Native project in Xcode IDE version 14.3 or above, you get the following error:
Use of bitwise '|' with boolean operands
This is an npm dependency error. It occurs in the Yoga.cpp
file of the React Native dependency and layout engine, Yoga. This error only occurs when using React Native version 0.68 or lower or when running unpatched versions of React version 0.6, 0.70, or 0.71.
Upgrade to React Native version 0.72+ or to one of the patch releases with an added fix for the issue:
If upgrading is not possible or if you need a quick fix, you can change the bitwise operator |
to the boolean operator ||
yourself. You can use a library such as patch-package
to make and keep fixes to the React Native npm dependency.
Another option is to downgrade your Xcode to version 14.2.1 or lower, as older versions do not have the version checks that cause the error.
The C++ Yoga code changed the bitwise operator |
to the boolean operator ||
to guarantee a return of true
or false
only.
The root cause of the error is that Xcode version 14.3 introduced some version checks, including an iOS version check. React Native uses CocoaPods to manage library dependencies for Xcode projects. The library dependency React-Codegen supports iOS 11, which does not build with Xcode 14.3 as described in this React Native PR.
Tasty treats for web developers brought to you by Sentry. Get tips and tricks from Wes Bos and Scott Tolinski.
SEE EPISODESConsidered “not bad” by 4 million developers and more than 100,000 organizations worldwide, Sentry provides code-level observability to many of the world’s best-known companies like Disney, Peloton, Cloudflare, Eventbrite, Slack, Supercell, and Rockstar Games. Each month we process billions of exceptions from the most popular products on the internet.
Here’s a quick look at how Sentry handles your personal information (PII).
×We collect PII about people browsing our website, users of the Sentry service, prospective customers, and people who otherwise interact with us.
What if my PII is included in data sent to Sentry by a Sentry customer (e.g., someone using Sentry to monitor their app)? In this case you have to contact the Sentry customer (e.g., the maker of the app). We do not control the data that is sent to us through the Sentry service for the purposes of application monitoring.
Am I included?We may disclose your PII to the following type of recipients:
You may have the following rights related to your PII:
If you have any questions or concerns about your privacy at Sentry, please email us at compliance@sentry.io.
If you are a California resident, see our Supplemental notice.