software-mansion / react-native-reanimated

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

error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture] C/C++: 367 | jsi::Runtime &uiRuntime = uiWorkletRuntime_->getJSIRuntime(); #6734

Closed quany closed 2 days ago

quany commented 2 days ago

Description

dC/C++: /Volumes/Samsung/sxf/rn/vpxlm/nodemodules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:367:31: error: implicit capture of 'this' with a capture default of '=' is deprecated [-Werror,-Wdeprecated-this-capture] C/C++: 367 | jsi::Runtime &uiRuntime = uiWorkletRuntime->getJSIRuntime(); C/C++: | ^ C/C++: /Volumes/Samsung/sxf/rn/vpxlm/nodemodules/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp:366:31: note: add an explicit capture of 'this' to capture '*this' by reference C/C++: 366 | uiScheduler->scheduleOnUI(= { C/C++: | ^ C/C++: | , this C/C++: 1 error generated.

Steps to reproduce

  1. npm run android

Snack or a link to a repository

https://github.com/quany/vpxlm

Reanimated version

3.16.1

React Native version

0.76.2

Platforms

Android

JavaScript runtime

None

Workflow

None

Architecture

None

Build type

None

Device

None

Device model

No response

Acknowledgements

Yes

tjzel commented 2 days ago

This behavior was fixed in 3.15.4 if I recall correctly, you can see that on RN76 this problems shouldn't appear: https://github.com/software-mansion/react-native-reanimated/blob/6fad03e080c8ea4919f35fefab659078b0f08e51/packages/react-native-reanimated/Common/cpp/reanimated/NativeModules/NativeReanimatedModule.cpp#L40

I suggest you make sure if you are indeed running Reanimated 3.16.1 and RN 0.76.2. Perhaps you might need to rebuild your project after upgrading.