We have been using react-native-reanimated 3.6.1 with ReactNative 0.71.15 but after upgrading to ReactNative 0.72.10 the iOS build crashes with the following message:
▸ Compiling WorkletRuntimeDecorator.cpp
❌ /Users/me/work/mobile-app/node_modules/react-native-reanimated/Common/cpp/SharedItems/Shareables.h:243:13: 'this' argument to member function 'data' has type 'const jsi::ArrayBuffer', but function is not marked const
arrayBuffer.data(rt),
^
❌ /Users/me/work/mobile-app/node_modules/react-native-reanimated/Common/cpp/SharedItems/Shareables.h:244:13: 'this' argument to member function 'data' has type 'const jsi::ArrayBuffer', but function is not marked const
arrayBuffer.data(rt) + arrayBuffer.size(rt)) {
^
▸ Compiling WorkletRuntime.cpp
❌ /Users/lucian/work/mobile-app/node_modules/react-native-reanimated/Common/cpp/SharedItems/Shareables.h:243:13: 'this' argument to member function 'data' has type 'const jsi::ArrayBuffer', but function is not marked const
arrayBuffer.data(rt),
^
❌ /Users/me/work/mobile-app/node_modules/react-native-reanimated/Common/cpp/SharedItems/Shareables.h:244:13: 'this' argument to member function 'data' has type 'const jsi::ArrayBuffer', but function is not marked const
arrayBuffer.data(rt) + arrayBuffer.size(rt)) {
^
▸ Compiling WorkletEventHandler.cpp
❌ /Users/me/work/mobile-app/node_modules/react-native-reanimated/Common/cpp/SharedItems/Shareables.h:243:13: 'this' argument to member function 'data' has type 'const jsi::ArrayBuffer', but function is not marked const
arrayBuffer.data(rt),
^
Any ideea on what could be wrong? Thank you!
I was able to find a workaround to get my app to build, when running into this error, by patching react-native-reanimated using patch-package.
In the file /node_modules/react-native-reanimated/Common/cpp/SharedItems/Shareables.h, change line 227 from:
const jsi::ArrayBuffer &arrayBuffer
to
jsi::ArrayBuffer arrayBuffer
There is probably a more "correct" way to fix this, but it works for me in the meantime!