software-mansion / react-native-reanimated

React Native's Animated library reimplemented
https://docs.swmansion.com/react-native-reanimated/
MIT License
8.84k stars 1.29k forks source link

build failled react reanimated 3.15.1 #6466

Closed YudaAdiPratama closed 5 days ago

YudaAdiPratama commented 2 weeks ago

Description

hello some one can help me about this error

> Task :react-native-reanimated:buildCMakeDebug[arm64-v8a]
C/C++: ninja: Entering directory `/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/.cxx/Debug/5u7fehw1/arm64-v8a'
C/C++: /Users/yuda/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android23 --sysroot=/Users/yuda/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dreanimated_EXPORTS -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/reanimated/AnimatedSensor -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/reanimated/Fabric -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/reanimated/LayoutAnimations -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/reanimated/NativeModules -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/reanimated/Tools -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/src/main/cpp -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native/ReactCommon -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native/ReactCommon/callinvoker -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native/ReactCommon/runtimeexecutor -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/worklets/Registries -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/worklets/SharedItems -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/worklets/Tools -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/worklets/WorkletRuntime -isystem /Users/yuda/.gradle/caches/8.8/transforms/d8863fc02d7077f868c551d8a55205c1/transformed/react-android-0.75.2-debug/prefab/modules/folly_runtime/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/d8863fc02d7077f868c551d8a55205c1/transformed/react-android-0.75.2-debug/prefab/modules/glog/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/d8863fc02d7077f868c551d8a55205c1/transformed/react-android-0.75.2-debug/prefab/modules/jsi/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/d8863fc02d7077f868c551d8a55205c1/transformed/react-android-0.75.2-debug/prefab/modules/reactnativejni/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/b755c2d52e29dca120161c90dcb0eacd/transformed/fbjni-0.6.0/prefab/modules/fbjni/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/a3d1fee5c064a6a9d1d521365b614b4b/transformed/hermes-android-0.75.2-debug/prefab/modules/libhermes/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/d8863fc02d7077f868c551d8a55205c1/transformed/react-android-0.75.2-debug/prefab/modules/hermes_executor/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -DREACT_NATIVE_MINOR_VERSION=75 -DREANIMATED_VERSION=3.15.1 -DHERMES_ENABLE_DEBUGGER=1 -fexceptions -fno-omit-frame-pointer -frtti -fstack-protector-all -std=c++20 -Wall -Werror -DJS_RUNTIME_HERMES=1 -fno-limit-debug-info  -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -std=gnu++20 -MD -MT src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp.o -MF src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp.o.d -o src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp.o -c /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp
C/C++: /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:205:35: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
C/C++:   205 |     const auto scope = jsi::Scope(uiWorkletRuntime_->getJSIRuntime());
C/C++:       |                                   ^
C/C++: /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:198:31: note: add an explicit capture of 'this' to capture '*this' by reference
C/C++:   198 |   uiScheduler_->scheduleOnUI([=] {
C/C++:       |                               ^
C/C++:       |                                , this
C/C++: /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:267:5: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
C/C++:   267 |     eventHandlerRegistry_->registerEventHandler(std::move(handler));
C/C++:       |     ^
C/C++: /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:264:31: note: add an explicit capture of 'this' to capture '*this' by reference
C/C++:   264 |   uiScheduler_->scheduleOnUI([=] {
C/C++:       |                               ^
C/C++:       |                                , this
C/C++: /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:278:13: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
C/C++:   278 |       [=] { eventHandlerRegistry_->unregisterEventHandler(id); });
C/C++:       |             ^
C/C++: /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:278:8: note: add an explicit capture of 'this' to capture '*this' by reference
C/C++:   278 |       [=] { eventHandlerRegistry_->unregisterEventHandler(id); });
C/C++:       |        ^
C/C++:       |         , this
C/C++: /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:375:31: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
C/C++:   375 |     jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
C/C++:       |                               ^
C/C++: /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:374:31: note: add an explicit capture of 'this' to capture '*this' by reference
C/C++:   374 |   uiScheduler_->scheduleOnUI([=]() {
C/C++:       |                               ^
C/C++:       |                                , this
C/C++: /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:882:9: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
C/C++:   882 |         uiWorkletRuntime_->runGuarded(
C/C++:       |         ^
C/C++: /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:881:8: note: add an explicit capture of 'this' to capture '*this' by reference
C/C++:   881 |       [=](int keyboardState, int height) {
C/C++:       |        ^
C/C++:       |         , this
C/C++: 5 errors generated.

> Task :react-native-safe-area-context:compileDebugKotlin
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextPackage.kt:27:11 'constructor ReactModuleInfo(String, String, Boolean, Boolean, Boolean, Boolean, Boolean)' is deprecated. use ReactModuleInfo(String, String, boolean, boolean, boolean, boolean)]
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaContextPackage.kt:33:27 'getter for hasConstants: Boolean' is deprecated. This property is unused and it's planning to be removed in a future version of
        React Native. Please refrain from using it.
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-safe-area-context/android/src/main/java/com/th3rdwave/safeareacontext/SafeAreaView.kt:59:23 'getter for uiImplementation: UIImplementation!' is deprecated. Deprecated in Java

> Task :react-native-reanimated:buildCMakeDebug[arm64-v8a] FAILED

> Task :react-native-screens:compileDebugKotlin
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/RNScreensPackage.kt:58:17 'constructor ReactModuleInfo(String, String, Boolean, Boolean, Boolean, Boolean, Boolean)' is deprecated. use ReactModuleInfo(String, String, boolean, boolean, boolean, boolean)]
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt:33:53 'FrameCallback' is deprecated. Deprecated in Java
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenContainer.kt:34:38 'FrameCallback' is deprecated. Deprecated in Java
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenStackHeaderConfig.kt:101:38 'getter for systemWindowInsetTop: Int' is deprecated. Deprecated in Java
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt:146:47 'replaceSystemWindowInsets(Int, Int, Int, Int): WindowInsetsCompat' is deprecated. Deprecated in Java
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt:147:51 'getter for systemWindowInsetLeft: Int' is deprecated. Deprecated in Java
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt:149:51 'getter for systemWindowInsetRight: Int' is deprecated. Deprecated in Java
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/ScreenWindowTraits.kt:150:51 'getter for systemWindowInsetBottom: Int' is deprecated. Deprecated in Java
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/SearchBarManager.kt:138:66 Elvis operator (?:) always returns the left operand of non-nullable type Boolean
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/main/java/com/swmansion/rnscreens/SearchBarView.kt:153:43 Parameter 'flag' is never used
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt:10:25 Parameter 'wrapper' is never used
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt:13:9 Parameter 'width' is never used
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt:14:9 Parameter 'height' is never used
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/paper/java/com/swmansion/rnscreens/FabricEnabledViewGroup.kt:15:9 Parameter 'headerHeight' is never used
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/paper/java/com/swmansion/rnscreens/NativeProxy.kt:7:36 Parameter 'fabricUIManager' is never used
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/paper/java/com/swmansion/rnscreens/NativeProxy.kt:11:13 Parameter 'tag' is never used
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/paper/java/com/swmansion/rnscreens/NativeProxy.kt:12:13 Parameter 'view' is never used
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-screens/android/src/paper/java/com/swmansion/rnscreens/NativeProxy.kt:15:33 Parameter 'tag' is never used

> Task :react-native-gesture-handler:compileDebugKotlin
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/RNGestureHandlerPackage.kt:69:42 'constructor ReactModuleInfo(String, String, Boolean, Boolean, Boolean, Boolean, Boolean)' is deprecated. use ReactModuleInfo(String, String, boolean, boolean, boolean, boolean)]
w: file:///Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/FlingGestureHandler.kt:25:26 Parameter 'event' is never used
122 actionable tasks: 98 executed, 24 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor 

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: /Users/yuda/Documents/project/POSNATIVE/node_modules/@react-native-async-storage/async-storage/android/src/javaPackage/java/com/reactnativecommunity/asyncstorage/AsyncStoragePackage.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-reanimated:buildCMakeDebug[arm64-v8a]'.
> com.android.ide.common.process.ProcessException: ninja: Entering directory `/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/.cxx/Debug/5u7fehw1/arm64-v8a'
  [0/2] Re-checking globbed directories...
  [1/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/Registries/WorkletRuntimeRegistry.cpp.o
  [2/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/Tools/ReanimatedJSIUtils.cpp.o
  [3/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/Tools/UIScheduler.cpp.o
  [4/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/Tools/JSLogger.cpp.o
  [5/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/Tools/JSISerializer.cpp.o
  [6/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/Tools/AsyncQueue.cpp.o
  [7/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/Tools/JSScheduler.cpp.o
  [8/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/__/cpp/PlatformLogger.cpp.o
  [9/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/Registries/EventHandlerRegistry.cpp.o
  [10/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/SharedItems/Shareables.cpp.o
  [11/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/Fabric/PropsRegistry.cpp.o
  [12/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp.o
  [13/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/Fabric/ShadowTreeCloner.cpp.o
  [14/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy.cpp.o
  [15/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.cpp.o
  [16/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/Tools/WorkletEventHandler.cpp.o
  [17/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/ReanimatedRuntime.cpp.o
  [18/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/RNRuntimeDecorator.cpp.o
  [19/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/Tools/ReanimatedVersion.cpp.o
  [20/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/ReanimatedHermesRuntime.cpp.o
  [21/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/Tools/FeaturesConfig.cpp.o
  [22/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModuleSpec.cpp.o
  [23/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/WorkletRuntime.cpp.o
  [24/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp.o
  [25/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp.o
  FAILED: src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp.o 
  /Users/yuda/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/bin/clang++ --target=aarch64-none-linux-android23 --sysroot=/Users/yuda/Library/Android/sdk/ndk/27.0.12077973/toolchains/llvm/prebuilt/darwin-x86_64/sysroot -Dreanimated_EXPORTS -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/reanimated/AnimatedSensor -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/reanimated/Fabric -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/reanimated/LayoutAnimations -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/reanimated/NativeModules -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/reanimated/Tools -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/src/main/cpp -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native/ReactCommon -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native/ReactAndroid/src/main/jni/react/turbomodule -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native/ReactCommon/callinvoker -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native/ReactCommon/runtimeexecutor -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/worklets/Registries -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/worklets/SharedItems -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/worklets/Tools -I/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/../Common/cpp/worklets/WorkletRuntime -isystem /Users/yuda/.gradle/caches/8.8/transforms/d8863fc02d7077f868c551d8a55205c1/transformed/react-android-0.75.2-debug/prefab/modules/folly_runtime/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/d8863fc02d7077f868c551d8a55205c1/transformed/react-android-0.75.2-debug/prefab/modules/glog/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/d8863fc02d7077f868c551d8a55205c1/transformed/react-android-0.75.2-debug/prefab/modules/jsi/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/d8863fc02d7077f868c551d8a55205c1/transformed/react-android-0.75.2-debug/prefab/modules/reactnativejni/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/b755c2d52e29dca120161c90dcb0eacd/transformed/fbjni-0.6.0/prefab/modules/fbjni/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/a3d1fee5c064a6a9d1d521365b614b4b/transformed/hermes-android-0.75.2-debug/prefab/modules/libhermes/include -isystem /Users/yuda/.gradle/caches/8.8/transforms/d8863fc02d7077f868c551d8a55205c1/transformed/react-android-0.75.2-debug/prefab/modules/hermes_executor/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security   -DREACT_NATIVE_MINOR_VERSION=75 -DREANIMATED_VERSION=3.15.1 -DHERMES_ENABLE_DEBUGGER=1 -fexceptions -fno-omit-frame-pointer -frtti -fstack-protector-all -std=c++20 -Wall -Werror -DJS_RUNTIME_HERMES=1 -fno-limit-debug-info  -fPIC -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_MOBILE=1 -DFOLLY_HAVE_RECVMMSG=1 -DFOLLY_HAVE_PTHREAD=1 -DFOLLY_HAVE_XSI_STRERROR_R=1 -std=gnu++20 -MD -MT src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp.o -MF src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp.o.d -o src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp.o -c /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp
  /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:205:35: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
    205 |     const auto scope = jsi::Scope(uiWorkletRuntime_->getJSIRuntime());
        |                                   ^
  /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:198:31: note: add an explicit capture of 'this' to capture '*this' by reference
    198 |   uiScheduler_->scheduleOnUI([=] {
        |                               ^
        |                                , this
  /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:267:5: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
    267 |     eventHandlerRegistry_->registerEventHandler(std::move(handler));
        |     ^
  /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:264:31: note: add an explicit capture of 'this' to capture '*this' by reference
    264 |   uiScheduler_->scheduleOnUI([=] {
        |                               ^
        |                                , this
  /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:278:13: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
    278 |       [=] { eventHandlerRegistry_->unregisterEventHandler(id); });
        |             ^
  /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:278:8: note: add an explicit capture of 'this' to capture '*this' by reference
    278 |       [=] { eventHandlerRegistry_->unregisterEventHandler(id); });
        |        ^
        |         , this
  /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:375:31: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
    375 |     jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime();
        |                               ^
  /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:374:31: note: add an explicit capture of 'this' to capture '*this' by reference
    374 |   uiScheduler_->scheduleOnUI([=]() {
        |                               ^
        |                                , this
  /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:882:9: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture]
    882 |         uiWorkletRuntime_->runGuarded(
        |         ^
  /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:881:8: note: add an explicit capture of 'this' to capture '*this' by reference
    881 |       [=](int keyboardState, int height) {
        |        ^
        |         , this
  5 errors generated.
  [26/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.cpp.o
  [27/37] Building CXX object src/main/worklets/CMakeFiles/worklets.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/worklets/WorkletRuntime/WorkletRuntimeDecorator.cpp.o
  [28/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/__/cpp/TurboModule.cpp.o
  [29/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/__/cpp/AndroidUIScheduler.cpp.o
  [30/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/Common/cpp/reanimated/Tools/UIRuntimeDecorator.cpp.o
  [31/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/__/cpp/JNIHelper.cpp.o
  [32/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/__/cpp/LayoutAnimations.cpp.o
  [33/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/__/cpp/OnLoad.cpp.o
  [34/37] Building CXX object src/main/reanimated/CMakeFiles/reanimated.dir/__/cpp/NativeProxy.cpp.o
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      /Users/yuda/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        -C \
        /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android/.cxx/Debug/5u7fehw1/arm64-v8a \
        reanimated \
        worklets
    from /Users/yuda/Documents/project/POSNATIVE/node_modules/react-native-reanimated/android

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 2m 14s
info Run CLI with --verbose flag for more details.

Steps to reproduce

None yet

Snack or a link to a repository

None yet

Reanimated version

3.15.1

React Native version

0.75.2

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

github-actions[bot] commented 2 weeks ago

Hey! 👋

The issue doesn't seem to contain a minimal reproduction.

Could you provide a snack or a link to a GitHub repository under your username that reproduces the problem?

Wamy-Dev commented 2 weeks ago

same issue here

joelyustiz commented 2 weeks ago

same issue here

andalib-oper commented 1 week ago

same issue

websasindu commented 1 week ago

same issue.

websasindu commented 1 week ago

i edited react-native-reanimated\Common\cpp\reanimated\NativeModules\NativeReanimatedModule.cpp and fixed few decrepcated error messages and now it's working fine for me.

Windows 11. React Native 0.75.2

Here is complete file;

include "NativeReanimatedModule.h"

ifdef RCT_NEW_ARCH_ENABLED

include <react/renderer/uimanager/UIManagerBinding.h>

include <react/renderer/uimanager/primitives.h>

if REACT_NATIVE_MINOR_VERSION >= 73 && defined(RCT_NEW_ARCH_ENABLED)

include <react/utils/CoreFeatures.h>

endif

endif

include

include

include

include

include

ifdef RCT_NEW_ARCH_ENABLED

include <react/renderer/scheduler/Scheduler.h>

include "ReanimatedCommitShadowNode.h"

include "ShadowTreeCloner.h"

endif

include "AsyncQueue.h"

include "CollectionUtils.h"

include "EventHandlerRegistry.h"

include "FeaturesConfig.h"

include "Shareables.h"

include "UIRuntimeDecorator.h"

include "WorkletEventHandler.h"

ifdef ANDROID

include <fbjni/fbjni.h>

endif

using namespace facebook;

if REACT_NATIVE_MINOR_VERSION == 73 && defined(RCT_NEW_ARCH_ENABLED)

// Android can't find the definition of this static field bool CoreFeatures::useNativeState;

endif

namespace reanimated {

NativeReanimatedModule::NativeReanimatedModule( jsi::Runtime &rnRuntime, const std::shared_ptr &jsScheduler, const std::shared_ptr &jsQueue, const std::sharedptr &uiScheduler, const PlatformDepMethodsHolder &platformDepMethodsHolder, const std::string &valueUnpackerCode, const bool isBridgeless) : NativeReanimatedModuleSpec( isBridgeless ? nullptr : jsScheduler->getJSCallInvoker()), isBridgeless(isBridgeless), jsQueue(jsQueue), jsScheduler(jsScheduler), uiScheduler(uiScheduler), uiWorkletRuntime(std::makeshared( rnRuntime, jsQueue, jsScheduler, "Reanimated UI runtime", true / supportsLocking /, valueUnpackerCode)), valueUnpackerCode(valueUnpackerCode), eventHandlerRegistry(std::makeunique()), requestRender(platformDepMethodsHolder.requestRender), onRenderCallback([this](const double timestampMs) { renderRequested = false; onRender(timestampMs); }), animatedSensorModule(platformDepMethodsHolder), jsLogger(std::makeshared(jsScheduler)), layoutAnimationsManager_( std::makeshared(jsLogger)),

ifdef RCT_NEW_ARCH_ENABLED

  synchronouslyUpdateUIPropsFunction_(
      platformDepMethodsHolder.synchronouslyUpdateUIPropsFunction),
  propsRegistry_(std::make_shared<PropsRegistry>()),

else

  obtainPropFunction_(platformDepMethodsHolder.obtainPropFunction),
  configurePropsPlatformFunction_(
      platformDepMethodsHolder.configurePropsFunction),
  updatePropsFunction_(platformDepMethodsHolder.updatePropsFunction),

endif

  subscribeForKeyboardEventsFunction_(
      platformDepMethodsHolder.subscribeForKeyboardEvents),
  unsubscribeFromKeyboardEventsFunction_(
      platformDepMethodsHolder.unsubscribeFromKeyboardEvents) {

commonInit(platformDepMethodsHolder); }

void NativeReanimatedModule::commonInit( const PlatformDepMethodsHolder &platformDepMethodsHolder) { auto requestAnimationFrame = [this](jsi::Runtime &rt, const jsi::Value &callback) { this->requestAnimationFrame(rt, callback); };

ifdef RCT_NEW_ARCH_ENABLED

auto updateProps = [this](jsi::Runtime &rt, const jsi::Value &operations) { this->updateProps(rt, operations); };

auto removeFromPropsRegistry = [this](jsi::Runtime &rt, const jsi::Value &viewTags) { this->removeFromPropsRegistry(rt, viewTags); };

auto measure = [this](jsi::Runtime &rt, const jsi::Value &shadowNodeValue) { return this->measure(rt, shadowNodeValue); };

auto dispatchCommand = [this]( jsi::Runtime &rt, const jsi::Value &shadowNodeValue, const jsi::Value &commandNameValue, const jsi::Value &argsValue) { this->dispatchCommand(rt, shadowNodeValue, commandNameValue, argsValue); }; ProgressLayoutAnimationFunction progressLayoutAnimation = [this](jsi::Runtime &rt, int tag, const jsi::Object &newStyle, bool) { auto surfaceId = layoutAnimationsProxy->progressLayoutAnimation(tag, newStyle); if (!surfaceId) { return; } uiManager->getShadowTreeRegistry().visit( *surfaceId, [](const ShadowTree &shadowTree) { shadowTree.notifyDelegatesOfUpdates(); }); };

EndLayoutAnimationFunction endLayoutAnimation = [this](int tag, bool shouldRemove) { auto surfaceId = layoutAnimationsProxy_->endLayoutAnimation(tag, shouldRemove); if (!surfaceId) { return; }

    uiManager_->getShadowTreeRegistry().visit(
        *surfaceId, [](const ShadowTree &shadowTree) {
          shadowTree.notifyDelegatesOfUpdates();
        });
  };

auto obtainProp = [this]( jsi::Runtime &rt, const jsi::Value &shadowNodeWrapper, const jsi::Value &propName) { return this->obtainProp(rt, shadowNodeWrapper, propName); };

endif

jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime(); UIRuntimeDecorator::decorate( uiRuntime,

ifdef RCT_NEW_ARCH_ENABLED

  removeFromPropsRegistry,
  obtainProp,
  updateProps,
  measure,
  dispatchCommand,

else

  platformDepMethodsHolder.scrollToFunction,
  platformDepMethodsHolder.obtainPropFunction,
  platformDepMethodsHolder.updatePropsFunction,
  platformDepMethodsHolder.measureFunction,
  platformDepMethodsHolder.dispatchCommandFunction,

endif

  requestAnimationFrame,
  platformDepMethodsHolder.getAnimationTimestamp,
  platformDepMethodsHolder.setGestureStateFunction,

ifdef RCT_NEW_ARCH_ENABLED

  progressLayoutAnimation,
  endLayoutAnimation,

else

  platformDepMethodsHolder.progressLayoutAnimation,
  platformDepMethodsHolder.endLayoutAnimation,

endif

  platformDepMethodsHolder.maybeFlushUIUpdatesQueueFunction);

}

NativeReanimatedModule::~NativeReanimatedModule() { // event handler registry and frame callbacks store some JSI values from UI // runtime, so they have to go away before we tear down the runtime eventHandlerRegistry.reset(); frameCallbacks.clear(); uiWorkletRuntime_.reset(); }

void NativeReanimatedModule::scheduleOnUI( jsi::Runtime &rt, const jsi::Value &worklet) { auto shareableWorklet = extractShareableOrThrow( rt, worklet, "[Reanimated] Only worklets can be scheduled to run on UI."); uiScheduler_->scheduleOnUI([=,this] {

if JS_RUNTIME_HERMES

// JSI's scope defined here allows for JSI-objects to be cleared up after
// each runtime loop. Within these loops we typically create some temporary
// JSI objects and hence it allows for such objects to be garbage collected
// much sooner.
// Apparently the scope API is only supported on Hermes at the moment.
const auto scope = jsi::Scope(uiWorkletRuntime_->getJSIRuntime());

endif

uiWorkletRuntime_->runGuarded(shareableWorklet);

}); }

jsi::Value NativeReanimatedModule::executeOnUIRuntimeSync( jsi::Runtime &rt, const jsi::Value &worklet) { return uiWorkletRuntime_->executeSync(rt, worklet); }

jsi::Value NativeReanimatedModule::createWorkletRuntime( jsi::Runtime &rt, const jsi::Value &name, const jsi::Value &initializer) { auto workletRuntime = std::makeshared( rt, jsQueue, jsScheduler, name.asString(rt).utf8(rt), false / supportsLocking /, valueUnpackerCode); auto initializerShareable = extractShareableOrThrow( rt, initializer, "[Reanimated] Initializer must be a worklet."); workletRuntime->runGuarded(initializerShareable); return jsi::Object::createFromHostObject(rt, workletRuntime); }

jsi::Value NativeReanimatedModule::scheduleOnRuntime( jsi::Runtime &rt, const jsi::Value &workletRuntimeValue, const jsi::Value &shareableWorkletValue) { reanimated::scheduleOnRuntime(rt, workletRuntimeValue, shareableWorkletValue); return jsi::Value::undefined(); }

jsi::Value NativeReanimatedModule::makeShareableClone( jsi::Runtime &rt, const jsi::Value &value, const jsi::Value &shouldRetainRemote, const jsi::Value &nativeStateSource) { return reanimated::makeShareableClone( rt, value, shouldRetainRemote, nativeStateSource); }

jsi::Value NativeReanimatedModule::registerEventHandler( jsi::Runtime &rt, const jsi::Value &worklet, const jsi::Value &eventName, const jsi::Value &emitterReactTag) { static uint64_t NEXT_EVENT_HANDLER_ID = 1;

uint64_t newRegistrationId = NEXT_EVENT_HANDLER_ID++; auto eventNameStr = eventName.asString(rt).utf8(rt); auto handlerShareable = extractShareableOrThrow( rt, worklet, "[Reanimated] Event handler must be a worklet."); int emitterReactTagInt = emitterReactTag.asNumber();

uiScheduler_->scheduleOnUI([=,this] { auto handler = std::makeshared( newRegistrationId, eventNameStr, emitterReactTagInt, handlerShareable); eventHandlerRegistry->registerEventHandler(std::move(handler)); });

return jsi::Value(static_cast(newRegistrationId)); }

void NativeReanimatedModule::unregisterEventHandler( jsi::Runtime &, const jsi::Value &registrationId) { uint64t id = registrationId.asNumber(); uiScheduler->scheduleOnUI( [=,this] { eventHandlerRegistry_->unregisterEventHandler(id); }); }

ifdef RCT_NEW_ARCH_ENABLED

static inline std::string intColorToHex(const int val) { std::stringstream invertedHexColorStream; // By default transparency is first, color second invertedHexColorStream << std::setfill('0') << std::setw(8) << std::hex << val;

auto invertedHexColor = invertedHexColorStream.str(); auto hexColor = "#" + invertedHexColor.substr(2, 6) + invertedHexColor.substr(0, 2);

return hexColor; }

std::string NativeReanimatedModule::obtainPropFromShadowNode( jsi::Runtime &rt, const std::string &propName, const ShadowNode::Shared &shadowNode) { auto newestCloneOfShadowNode = uiManager_->getNewestCloneOfShadowNode(*shadowNode);

if (propName == "width" || propName == "height" || propName == "top" || propName == "left") { // These props are calculated from frame auto layoutableShadowNode = dynamiccast<LayoutableShadowNode const *>( newestCloneOfShadowNode.get()); const auto &frame = layoutableShadowNode->layoutMetrics.frame;

if (propName == "width") {
  return std::to_string(frame.size.width);
} else if (propName == "height") {
  return std::to_string(frame.size.height);
} else if (propName == "top") {
  return std::to_string(frame.origin.y);
} else if (propName == "left") {
  return std::to_string(frame.origin.x);
}

} else { // These props are calculated from viewProps auto props = newestCloneOfShadowNode->getProps(); auto viewProps = std::static_pointer_cast(props); if (propName == "opacity") { return std::to_string(viewProps->opacity); } else if (propName == "zIndex") { if (viewProps->zIndex.has_value()) { return std::to_string(viewProps->zIndex); } } else if (propName == "backgroundColor") { return intColorToHex(viewProps->backgroundColor); } }

throw std::runtime_error(std::string( "Getting property " + propName + " with function getViewProp is not supported")); }

jsi::Value NativeReanimatedModule::getViewProp( jsi::Runtime &rnRuntime, const jsi::Value &shadowNodeWrapper, const jsi::Value &propName, const jsi::Value &callback) { const auto propNameStr = propName.asString(rnRuntime).utf8(rnRuntime); const auto funPtr = std::makeshared( callback.getObject(rnRuntime).asFunction(rnRuntime)); const auto shadowNode = shadowNodeFromValue(rnRuntime, shadowNodeWrapper); uiScheduler->scheduleOnUI([=]() { jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime(); const auto resultStr = obtainPropFromShadowNode(uiRuntime, propNameStr, shadowNode);

jsScheduler_->scheduleOnJS([=](jsi::Runtime &rnRuntime) {
  const auto resultValue =
      jsi::String::createFromUtf8(rnRuntime, resultStr);
  funPtr->call(rnRuntime, resultValue);
});

}); return jsi::Value::undefined(); }

else

jsi::Value NativeReanimatedModule::getViewProp( jsi::Runtime &rnRuntime, const jsi::Value &viewTag, const jsi::Value &propName, const jsi::Value &callback) { const auto propNameStr = propName.asString(rnRuntime).utf8(rnRuntime); const auto funPtr = std::make_shared( callback.getObject(rnRuntime).asFunction(rnRuntime));

const int viewTagInt = viewTag.asNumber();

uiScheduler->scheduleOnUI([=,this]() { jsi::Runtime &uiRuntime = uiWorkletRuntime->getJSIRuntime(); const jsi::Value propNameValue = jsi::String::createFromUtf8(uiRuntime, propNameStr); const auto resultValue = obtainPropFunction_(uiRuntime, viewTagInt, propNameValue); const auto resultStr = resultValue.asString(uiRuntime).utf8(uiRuntime);

jsScheduler_->scheduleOnJS([=](jsi::Runtime &rnRuntime) {
  const auto resultValue =
      jsi::String::createFromUtf8(rnRuntime, resultStr);
  funPtr->call(rnRuntime, resultValue);
});

}); return jsi::Value::undefined(); }

endif

jsi::Value NativeReanimatedModule::enableLayoutAnimations( jsi::Runtime &, const jsi::Value &config) { FeaturesConfig::setLayoutAnimationEnabled(config.getBool()); return jsi::Value::undefined(); }

jsi::Value NativeReanimatedModule::configureProps( jsi::Runtime &rt, const jsi::Value &uiProps, const jsi::Value &nativeProps) {

ifdef RCT_NEW_ARCH_ENABLED

auto uiPropsArray = uiProps.asObject(rt).asArray(rt); for (sizet i = 0; i < uiPropsArray.size(rt); ++i) { auto name = uiPropsArray.getValueAtIndex(rt, i).asString(rt).utf8(rt); animatablePropNames.insert(name); } auto nativePropsArray = nativeProps.asObject(rt).asArray(rt); for (sizet i = 0; i < nativePropsArray.size(rt); ++i) { auto name = nativePropsArray.getValueAtIndex(rt, i).asString(rt).utf8(rt); nativePropNames.insert(name); animatablePropNames_.insert(name); }

else

configurePropsPlatformFunction_(rt, uiProps, nativeProps);

endif // RCT_NEW_ARCH_ENABLED

return jsi::Value::undefined(); }

jsi::Value NativeReanimatedModule::configureLayoutAnimationBatch( jsi::Runtime &rt, const jsi::Value &layoutAnimationsBatch) { auto array = layoutAnimationsBatch.asObject(rt).asArray(rt); size_t length = array.size(rt); std::vector batch(length); for (int i = 0; i < length; i++) { auto item = array.getValueAtIndex(rt, i).asObject(rt); auto &batchItem = batch[i]; batchItem.tag = item.getProperty(rt, "viewTag").asNumber(); batchItem.type = static_cast( item.getProperty(rt, "type").asNumber()); auto config = item.getProperty(rt, "config"); if (config.isUndefined()) { batchItem.config = nullptr; } else { batchItem.config = extractShareableOrThrow( rt, config, "[Reanimated] Layout animation config must be an object."); } if (batch[i].type != SHARED_ELEMENT_TRANSITION && batch[i].type != SHARED_ELEMENT_TRANSITIONPROGRESS) { continue; } auto sharedTransitionTag = item.getProperty(rt, "sharedTransitionTag"); if (sharedTransitionTag.isUndefined()) { batch[i].config = nullptr; } else { batch[i].sharedTransitionTag = sharedTransitionTag.asString(rt).utf8(rt); } } layoutAnimationsManager->configureAnimationBatch(batch); return jsi::Value::undefined(); }

void NativeReanimatedModule::setShouldAnimateExiting( jsi::Runtime &rt, const jsi::Value &viewTag, const jsi::Value &shouldAnimate) { layoutAnimationsManager_->setShouldAnimateExiting( viewTag.asNumber(), shouldAnimate.getBool()); }

bool NativeReanimatedModule::isAnyHandlerWaitingForEvent( const std::string &eventName, const int emitterReactTag) { return eventHandlerRegistry_->isAnyHandlerWaitingForEvent( eventName, emitterReactTag); }

void NativeReanimatedModule::requestAnimationFrame( jsi::Runtime &rt, const jsi::Value &callback) { frameCallbacks_.push_back(std::make_shared(rt, callback)); maybeRequestRender(); }

void NativeReanimatedModule::maybeRequestRender() { if (!renderRequested) { renderRequested = true; jsi::Runtime &uiRuntime = uiWorkletRuntime->getJSIRuntime(); requestRender(onRenderCallback_, uiRuntime); } }

void NativeReanimatedModule::onRender(double timestampMs) { auto callbacks = std::move(frameCallbacks); frameCallbacks.clear(); jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime(); jsi::Value timestamp{timestampMs}; for (const auto &callback : callbacks) { runOnRuntimeGuarded(uiRuntime, *callback, timestamp); } }

jsi::Value NativeReanimatedModule::registerSensor( jsi::Runtime &rt, const jsi::Value &sensorType, const jsi::Value &interval, const jsi::Value &iosReferenceFrame, const jsi::Value &sensorDataHandler) { return animatedSensorModule.registerSensor( rt, uiWorkletRuntime, sensorType, interval, iosReferenceFrame, sensorDataHandler); }

void NativeReanimatedModule::unregisterSensor( jsi::Runtime &, const jsi::Value &sensorId) { animatedSensorModule_.unregisterSensor(sensorId); }

void NativeReanimatedModule::cleanupSensors() { animatedSensorModule_.unregisterAllSensors(); }

ifdef RCT_NEW_ARCH_ENABLED

bool NativeReanimatedModule::isThereAnyLayoutProp( jsi::Runtime &rt, const jsi::Object &props) { const jsi::Array propNames = props.getPropertyNames(rt); for (sizet i = 0; i < propNames.size(rt); ++i) { const std::string propName = propNames.getValueAtIndex(rt, i).asString(rt).utf8(rt); bool isLayoutProp = nativePropNames.find(propName) != nativePropNames_.end(); if (isLayoutProp) { return true; } } return false; }

jsi::Value NativeReanimatedModule::filterNonAnimatableProps( jsi::Runtime &rt, const jsi::Value &props) { jsi::Object nonAnimatableProps(rt); bool hasAnyNonAnimatableProp = false; const jsi::Object &propsObject = props.asObject(rt); const jsi::Array &propNames = propsObject.getPropertyNames(rt); for (sizet i = 0; i < propNames.size(rt); ++i) { const std::string &propName = propNames.getValueAtIndex(rt, i).asString(rt).utf8(rt); if (!collection::contains(animatablePropNames, propName)) { hasAnyNonAnimatableProp = true; const auto &propNameStr = propName.c_str(); const jsi::Value &propValue = propsObject.getProperty(rt, propNameStr); nonAnimatableProps.setProperty(rt, propNameStr, propValue); } } if (!hasAnyNonAnimatableProp) { return jsi::Value::undefined(); } return nonAnimatableProps; }

endif // RCT_NEW_ARCH_ENABLED

bool NativeReanimatedModule::handleEvent( const std::string &eventName, const int emitterReactTag, const jsi::Value &payload, double currentTime) { eventHandlerRegistry->processEvent( uiWorkletRuntime, currentTime, eventName, emitterReactTag, payload);

// TODO: return true if Reanimated successfully handled the event // to avoid sending it to JavaScript return false; }

ifdef RCT_NEW_ARCH_ENABLED

bool NativeReanimatedModule::handleRawEvent( const RawEvent &rawEvent, double currentTime) { const EventTarget *eventTarget = rawEvent.eventTarget.get(); if (eventTarget == nullptr) { // after app reload scrollView is unmounted and its content offset is set // to 0 and view is thrown into recycle pool setting content offset // triggers scroll event eventTarget is null though, because it's // unmounting we can just ignore this event, because it's an event on // unmounted component return false; }

int tag = eventTarget->getTag(); auto eventType = rawEvent.type; if (eventType.rfind("top", 0) == 0) { eventType = "on" + eventType.substr(3); } jsi::Runtime &rt = uiWorkletRuntime_->getJSIRuntime();

if REACT_NATIVE_MINOR_VERSION >= 73

const auto &eventPayload = rawEvent.eventPayload; jsi::Value payload = eventPayload->asJSIValue(rt);

else

const auto &payloadFactory = rawEvent.payloadFactory; jsi::Value payload = payloadFactory(rt);

endif

auto res = handleEvent(eventType, tag, std::move(payload), currentTime); // TODO: we should call performOperations conditionally if event is handled // (res == true), but for now handleEvent always returns false. Thankfully, // performOperations does not trigger a lot of code if there is nothing to // be done so this is fine for now. performOperations(); return res; }

void NativeReanimatedModule::updateProps( jsi::Runtime &rt, const jsi::Value &operations) { auto array = operations.asObject(rt).asArray(rt); size_t length = array.size(rt); for (sizet i = 0; i < length; ++i) { auto item = array.getValueAtIndex(rt, i).asObject(rt); auto shadowNodeWrapper = item.getProperty(rt, "shadowNodeWrapper"); auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper); const jsi::Value &updates = item.getProperty(rt, "updates"); operationsInBatch.emplace_back( shadowNode, std::make_unique(rt, updates));

// TODO: support multiple surfaces
surfaceId_ = shadowNode->getSurfaceId();

} }

void NativeReanimatedModule::performOperations() { if (operationsInBatch.empty() && tagsToRemove.empty()) { // nothing to do return; }

auto copiedOperationsQueue = std::move(operationsInBatch); operationsInBatch.clear();

jsi::Runtime &rt = uiWorkletRuntime_->getJSIRuntime();

{ auto lock = propsRegistry_->createLock();

if (copiedOperationsQueue.size() > 0) {
  propsRegistry_->resetReanimatedSkipCommitFlag();
}

// remove recently unmounted ShadowNodes from PropsRegistry
if (!tagsToRemove_.empty()) {
  for (auto tag : tagsToRemove_) {
    propsRegistry_->remove(tag);
  }
  tagsToRemove_.clear();
}

// Even if only non-layout props are changed, we need to store the update
// in PropsRegistry anyway so that React doesn't overwrite it in the next
// render. Currently, only opacity and transform are treated in a special
// way but backgroundColor, shadowOpacity etc. would get overwritten (see
// `_propKeysManagedByAnimated_DO_NOT_USE_THIS_IS_BROKEN`).
for (const auto &[shadowNode, props] : copiedOperationsQueue) {
  propsRegistry_->update(shadowNode, dynamicFromValue(rt, *props));
}

}

for (const auto &[shadowNode, props] : copiedOperationsQueue) { const jsi::Value &nonAnimatableProps = filterNonAnimatableProps(rt, *props); if (nonAnimatableProps.isUndefined()) { continue; } Tag viewTag = shadowNode->getTag(); jsi::Value maybeJSPropsUpdater = rt.global().getProperty(rt, "updateJSProps"); assert( maybeJSPropsUpdater.isObject() && "[Reanimated] updateJSProps not found"); jsi::Function jsPropsUpdater = maybeJSPropsUpdater.asObject(rt).asFunction(rt); jsPropsUpdater.call(rt, viewTag, nonAnimatableProps); }

bool hasLayoutUpdates = false; for (const auto &[shadowNode, props] : copiedOperationsQueue) { if (isThereAnyLayoutProp(rt, props->asObject(rt))) { hasLayoutUpdates = true; break; } }

if (!hasLayoutUpdates) { // If there's no layout props to be updated, we can apply the updates // directly onto the components and skip the commit. for (const auto &[shadowNode, props] : copiedOperationsQueue) { Tag tag = shadowNode->getTag(); synchronouslyUpdateUIPropsFunction_(rt, tag, props->asObject(rt)); } return; }

if (propsRegistry_->shouldReanimatedSkipCommit()) { // It may happen that performOperations is called on the UI thread // while React Native tries to commit a new tree on the JS thread. // In this case, we should skip the commit here and let React Native do // it. The commit will include the current values from PropsRegistry which // will be applied in ReanimatedCommitHook. return; }

react_nativeassert(uiManager != nullptr); const auto &shadowTreeRegistry = uiManager_->getShadowTreeRegistry();

shadowTreeRegistry.visit(surfaceId_, [&](ShadowTree const &shadowTree) { shadowTree.commit( [&](RootShadowNode const &oldRootShadowNode) -> RootShadowNode::Unshared { PropsMap propsMap; for (auto &[shadowNode, props] : copiedOperationsQueue) { auto family = &shadowNode->getFamily(); react_nativeassert(family->getSurfaceId() == surfaceId); propsMap[family].emplace_back(rt, std::move(*props));

if REACT_NATIVE_MINOR_VERSION >= 73

        // Fix for catching nullptr returned from commit hook was
        // introduced in 0.72.4 but we have only check for minor version
        // of React Native so enable that optimization in React Native >=
        // 0.73
        if (propsRegistry_->shouldReanimatedSkipCommit()) {
          return nullptr;
        }

endif

      }

      auto rootNode =
          cloneShadowTreeWithNewProps(oldRootShadowNode, propsMap);

      // Mark the commit as Reanimated commit so that we can distinguish it
      // in ReanimatedCommitHook.

      auto reaShadowNode =
          std::reinterpret_pointer_cast<ReanimatedCommitShadowNode>(
              rootNode);
      reaShadowNode->setReanimatedCommitTrait();

      return rootNode;
    },
    { /* .enableStateReconciliation = */
      false,

if REACT_NATIVE_MINOR_VERSION >= 72

          /* .mountSynchronously = */ true,

endif

          /* .shouldYield = */ [this]() {
            return propsRegistry_->shouldReanimatedSkipCommit();
          }
    });

}); }

void NativeReanimatedModule::removeFromPropsRegistry( jsi::Runtime &rt, const jsi::Value &viewTags) { auto array = viewTags.asObject(rt).asArray(rt); for (sizet i = 0, size = array.size(rt); i < size; ++i) { tagsToRemove.push_back(array.getValueAtIndex(rt, i).asNumber()); } }

void NativeReanimatedModule::dispatchCommand( jsi::Runtime &rt, const jsi::Value &shadowNodeValue, const jsi::Value &commandNameValue, const jsi::Value &argsValue) { ShadowNode::Shared shadowNode = shadowNodeFromValue(rt, shadowNodeValue); std::string commandName = stringFromValue(rt, commandNameValue); folly::dynamic args = commandArgsFromValue(rt, argsValue); uiManager_->dispatchCommand(shadowNode, commandName, args); }

jsi::String NativeReanimatedModule::obtainProp( jsi::Runtime &rt, const jsi::Value &shadowNodeWrapper, const jsi::Value &propName) { jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime(); const auto propNameStr = propName.asString(rt).utf8(rt); const auto shadowNode = shadowNodeFromValue(rt, shadowNodeWrapper); const auto resultStr = obtainPropFromShadowNode(uiRuntime, propNameStr, shadowNode); return jsi::String::createFromUtf8(rt, resultStr); }

jsi::Value NativeReanimatedModule::measure( jsi::Runtime &rt, const jsi::Value &shadowNodeValue) { // based on implementation from UIManagerBinding.cpp

auto shadowNode = shadowNodeFromValue(rt, shadowNodeValue); auto layoutMetrics = uiManager_->getRelativeLayoutMetrics( shadowNode, nullptr, {/ .includeTransform = */ true});

if (layoutMetrics == EmptyLayoutMetrics) { // Originally, in this case React Native returns {0, 0, 0, 0, 0, 0}, // most likely due to the type of measure callback function which accepts // just an array of numbers (not null). In Reanimated, measure returns // MeasuredDimensions | null. return jsi::Value::null(); } auto newestCloneOfShadowNode = uiManager_->getNewestCloneOfShadowNode(*shadowNode);

auto layoutableShadowNode = dynamic_cast<LayoutableShadowNode const *>(newestCloneOfShadowNode.get()); facebook::react::Point originRelativeToParent = layoutableShadowNode != nullptr ? layoutableShadowNode->getLayoutMetrics().frame.origin : facebook::react::Point();

auto frame = layoutMetrics.frame;

jsi::Object result(rt); result.setProperty( rt, "x", jsi::Value(static_cast(originRelativeToParent.x))); result.setProperty( rt, "y", jsi::Value(static_cast(originRelativeToParent.y))); result.setProperty( rt, "width", jsi::Value(static_cast(frame.size.width))); result.setProperty( rt, "height", jsi::Value(static_cast(frame.size.height))); result.setProperty( rt, "pageX", jsi::Value(static_cast(frame.origin.x))); result.setProperty( rt, "pageY", jsi::Value(static_cast(frame.origin.y))); return result; }

void NativeReanimatedModule::initializeFabric( const std::sharedptr &uiManager) { uiManager = uiManager;

initializeLayoutAnimations();

commitHook_ = std::makeshared(propsRegistry, uiManager_); }

void NativeReanimatedModule::initializeLayoutAnimations() { uiManager_->setAnimationDelegate(nullptr); auto scheduler = reinterpretcast<Scheduler *>(uiManager->getDelegate()); auto componentDescriptorRegistry = scheduler->getContextContainer() ->at<std::weak_ptr>( "ComponentDescriptorRegistry_DO_NOT_USE_PRETTY_PLEASE") .lock();

if (componentDescriptorRegistry) { layoutAnimationsProxy_ = std::makeshared( layoutAnimationsManager, componentDescriptorRegistry, scheduler->getContextContainer(), uiWorkletRuntime->getJSIRuntime(), uiScheduler); uiManager->getShadowTreeRegistry().enumerate( [this](const ShadowTree &shadowTree, bool &stop) { shadowTree.getMountingCoordinator()->setMountingOverrideDelegate( layoutAnimationsProxy); }); } }

endif // RCT_NEW_ARCH_ENABLED

jsi::Value NativeReanimatedModule::subscribeForKeyboardEvents( jsi::Runtime &rt, const jsi::Value &handlerWorklet, const jsi::Value &isStatusBarTranslucent) { auto shareableHandler = extractShareableOrThrow( rt, handlerWorklet, "[Reanimated] Keyboard event handler must be a worklet."); return subscribeForKeyboardEventsFunction( [=,this](int keyboardState, int height) { uiWorkletRuntime->runGuarded( shareableHandler, jsi::Value(keyboardState), jsi::Value(height)); }, isStatusBarTranslucent.getBool()); }

void NativeReanimatedModule::unsubscribeFromKeyboardEvents( jsi::Runtime &, const jsi::Value &listenerId) { unsubscribeFromKeyboardEventsFunction_(listenerId.asNumber()); }

} // namespace reanimated

im-notpua commented 1 week ago

Here's my file: https://pastebin.com/t6vYx6aX

I am using react-native-reanimated: 3.15.1 and replaced the node_modules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimateModule.cpp.

I think the problem is using builldTools 35.0.0 or using latest Ndk 27. Didn't want to downgrade so had to do this instead.

zeeshan9 commented 1 week ago

i am using react native cli v0.75.2, almost all reanimated is giving error. my build tools an target sdk set to 34 in android gradle file. Is there any way to solve this issue other than going to node_modules files. because they got change if i reinstalled them.

tjzel commented 6 days ago

After investigating I indeed confirm that using NDK 27 is the root of this problem.

I've gone through NDK changelogs but haven't pin-pointed where exactly deprecation warnings became compilation errors. However even with NDK 26 -Wall and -Werror are appended so it might just have been a bug fix.

I will fix those deprecation warnings, however you shouldn't depend on this and you should probably disable such errors from dependencies. This is because React Native still uses NDK 26.