react-native-reanimated 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (473) hide show
  1. package/Common/cpp/Fabric/FabricUtils.h +1 -1
  2. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +38 -27
  3. package/Common/cpp/SharedItems/Shareables.h +22 -0
  4. package/Common/cpp/Tools/PlatformDepMethodsHolder.h +2 -0
  5. package/Common/cpp/Tools/RuntimeDecorator.cpp +4 -1
  6. package/Common/cpp/Tools/RuntimeDecorator.h +2 -1
  7. package/Common/cpp/Tools/SingleInstanceChecker.h +14 -2
  8. package/RNReanimated.podspec +5 -2
  9. package/android/CMakeLists.txt +4 -0
  10. package/android/build.gradle +18 -10
  11. package/android/src/main/cpp/NativeProxy.cpp +316 -337
  12. package/android/src/main/cpp/NativeProxy.h +53 -11
  13. package/android/src/main/java/com/swmansion/reanimated/NativeMethodsHelper.java +7 -12
  14. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +11 -8
  15. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +21 -14
  16. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +0 -3
  17. package/ios/Fabric/REAInitializerRCTFabricSurface.mm +1 -0
  18. package/ios/REANodesManager.h +1 -0
  19. package/ios/REANodesManager.mm +30 -4
  20. package/ios/keyboardObserver/REAKeyboardEventObserver.m +51 -130
  21. package/ios/native/NativeMethods.mm +1 -1
  22. package/ios/native/NativeProxy.mm +4 -1
  23. package/ios/native/REAIOSErrorHandler.mm +1 -1
  24. package/ios/native/REAIOSLogger.mm +1 -1
  25. package/ios/native/REAIOSScheduler.mm +1 -1
  26. package/ios/native/REAInitializer.mm +1 -1
  27. package/ios/native/REAMessageThread.mm +2 -2
  28. package/lib/commonjs/Animated.js +0 -8
  29. package/lib/commonjs/Animated.js.map +1 -1
  30. package/lib/commonjs/ConfigHelper.js +8 -19
  31. package/lib/commonjs/ConfigHelper.js.map +1 -1
  32. package/lib/commonjs/createAnimatedComponent.js +20 -158
  33. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  34. package/lib/commonjs/index.js +0 -9
  35. package/lib/commonjs/index.js.map +1 -1
  36. package/lib/commonjs/index.web.js +0 -7
  37. package/lib/commonjs/index.web.js.map +1 -1
  38. package/lib/commonjs/reanimated2/Bezier.js +14 -34
  39. package/lib/commonjs/reanimated2/Bezier.js.map +1 -1
  40. package/lib/commonjs/reanimated2/Colors.js +60 -132
  41. package/lib/commonjs/reanimated2/Colors.js.map +1 -1
  42. package/lib/commonjs/reanimated2/Easing.js +81 -34
  43. package/lib/commonjs/reanimated2/Easing.js.map +1 -1
  44. package/lib/commonjs/reanimated2/NativeMethods.js +8 -20
  45. package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -1
  46. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +5 -31
  47. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  48. package/lib/commonjs/reanimated2/NativeReanimated/index.js +0 -7
  49. package/lib/commonjs/reanimated2/NativeReanimated/index.js.map +1 -1
  50. package/lib/commonjs/reanimated2/PlatformChecker.js +0 -6
  51. package/lib/commonjs/reanimated2/PlatformChecker.js.map +1 -1
  52. package/lib/commonjs/reanimated2/PropAdapters.js +10 -12
  53. package/lib/commonjs/reanimated2/PropAdapters.js.map +1 -1
  54. package/lib/commonjs/reanimated2/UpdateProps.js +3 -12
  55. package/lib/commonjs/reanimated2/UpdateProps.js.map +1 -1
  56. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +0 -10
  57. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -1
  58. package/lib/commonjs/reanimated2/WorkletEventHandler.js +5 -22
  59. package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -1
  60. package/lib/commonjs/reanimated2/animation/decay.js +7 -18
  61. package/lib/commonjs/reanimated2/animation/decay.js.map +1 -1
  62. package/lib/commonjs/reanimated2/animation/delay.js +0 -11
  63. package/lib/commonjs/reanimated2/animation/delay.js.map +1 -1
  64. package/lib/commonjs/reanimated2/animation/index.js +0 -8
  65. package/lib/commonjs/reanimated2/animation/index.js.map +1 -1
  66. package/lib/commonjs/reanimated2/animation/repeat.js +6 -22
  67. package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -1
  68. package/lib/commonjs/reanimated2/animation/sequence.js +3 -20
  69. package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -1
  70. package/lib/commonjs/reanimated2/animation/spring.js +11 -23
  71. package/lib/commonjs/reanimated2/animation/spring.js.map +1 -1
  72. package/lib/commonjs/reanimated2/animation/styleAnimation.js +3 -35
  73. package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
  74. package/lib/commonjs/reanimated2/animation/timing.js +0 -11
  75. package/lib/commonjs/reanimated2/animation/timing.js.map +1 -1
  76. package/lib/commonjs/reanimated2/animation/util.js +11 -41
  77. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  78. package/lib/commonjs/reanimated2/commonTypes.js +16 -23
  79. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  80. package/lib/commonjs/reanimated2/component/FlatList.js +0 -16
  81. package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
  82. package/lib/commonjs/reanimated2/component/Image.js +0 -4
  83. package/lib/commonjs/reanimated2/component/Image.js.map +1 -1
  84. package/lib/commonjs/reanimated2/component/ScrollView.js +0 -4
  85. package/lib/commonjs/reanimated2/component/ScrollView.js.map +1 -1
  86. package/lib/commonjs/reanimated2/component/Text.js +0 -4
  87. package/lib/commonjs/reanimated2/component/Text.js.map +1 -1
  88. package/lib/commonjs/reanimated2/component/View.js +0 -4
  89. package/lib/commonjs/reanimated2/component/View.js.map +1 -1
  90. package/lib/commonjs/reanimated2/core.js +6 -48
  91. package/lib/commonjs/reanimated2/core.js.map +1 -1
  92. package/lib/commonjs/reanimated2/errors.js +3 -14
  93. package/lib/commonjs/reanimated2/errors.js.map +1 -1
  94. package/lib/commonjs/reanimated2/fabricUtils.js +3 -5
  95. package/lib/commonjs/reanimated2/fabricUtils.js.map +1 -1
  96. package/lib/commonjs/reanimated2/fabricUtils.web.js +1 -3
  97. package/lib/commonjs/reanimated2/fabricUtils.web.js.map +1 -1
  98. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -12
  99. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  100. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -17
  101. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  102. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  103. package/lib/commonjs/reanimated2/hook/Hooks.js +0 -5
  104. package/lib/commonjs/reanimated2/hook/Hooks.js.map +1 -1
  105. package/lib/commonjs/reanimated2/hook/commonTypes.js.map +1 -1
  106. package/lib/commonjs/reanimated2/hook/index.js +0 -12
  107. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  108. package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js +4 -17
  109. package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  110. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +2 -9
  111. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  112. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +1 -11
  113. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  114. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +0 -12
  115. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  116. package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js +2 -9
  117. package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  118. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +8 -23
  119. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  120. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +13 -71
  121. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  122. package/lib/commonjs/reanimated2/hook/useDerivedValue.js +4 -13
  123. package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
  124. package/lib/commonjs/reanimated2/hook/useFrameCallback.js +0 -5
  125. package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -1
  126. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +0 -7
  127. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  128. package/lib/commonjs/reanimated2/hook/useSharedValue.js +2 -7
  129. package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -1
  130. package/lib/commonjs/reanimated2/hook/utils.js +8 -39
  131. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  132. package/lib/commonjs/reanimated2/index.js +0 -26
  133. package/lib/commonjs/reanimated2/index.js.map +1 -1
  134. package/lib/commonjs/reanimated2/initializers.js +21 -43
  135. package/lib/commonjs/reanimated2/initializers.js.map +1 -1
  136. package/lib/commonjs/reanimated2/interpolateColor.js +6 -43
  137. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  138. package/lib/commonjs/reanimated2/interpolation.js +14 -29
  139. package/lib/commonjs/reanimated2/interpolation.js.map +1 -1
  140. package/lib/commonjs/reanimated2/jestUtils.js +11 -44
  141. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  142. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +15 -39
  143. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  144. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +9 -28
  145. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
  146. package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js +7 -37
  147. package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
  148. package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js +5 -18
  149. package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js.map +1 -1
  150. package/lib/commonjs/reanimated2/js-reanimated/global.js +2 -9
  151. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
  152. package/lib/commonjs/reanimated2/js-reanimated/index.js +3 -14
  153. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  154. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -26
  155. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  156. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -49
  157. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  158. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -43
  159. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  160. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +4 -5
  161. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  162. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +0 -4
  163. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  164. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +4 -23
  165. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  166. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -74
  167. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  168. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -53
  169. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  170. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -63
  171. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  172. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -26
  173. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  174. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -13
  175. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  176. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -23
  177. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  178. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -43
  179. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  180. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -43
  181. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  182. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -23
  183. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  184. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -83
  185. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  186. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js +0 -20
  187. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
  188. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -22
  189. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  190. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -29
  191. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  192. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -9
  193. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  194. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -11
  195. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  196. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -8
  197. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  198. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -12
  199. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  200. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js +0 -12
  201. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
  202. package/lib/commonjs/reanimated2/layoutReanimation/index.js +0 -9
  203. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  204. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -17
  205. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
  206. package/lib/commonjs/reanimated2/mappers.js +26 -32
  207. package/lib/commonjs/reanimated2/mappers.js.map +1 -1
  208. package/lib/commonjs/reanimated2/mock.js +5 -15
  209. package/lib/commonjs/reanimated2/mock.js.map +1 -1
  210. package/lib/commonjs/reanimated2/mutables.js +2 -28
  211. package/lib/commonjs/reanimated2/mutables.js.map +1 -1
  212. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js +0 -2
  213. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js.map +1 -1
  214. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
  215. package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js +31 -0
  216. package/lib/commonjs/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
  217. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +0 -2
  218. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
  219. package/lib/commonjs/reanimated2/platform-specific/jsVersion.js +14 -0
  220. package/lib/commonjs/reanimated2/platform-specific/jsVersion.js.map +1 -0
  221. package/lib/commonjs/reanimated2/pluginUtils.js +0 -1
  222. package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -1
  223. package/lib/commonjs/reanimated2/shareables.js +92 -49
  224. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  225. package/lib/commonjs/reanimated2/threads.js +42 -46
  226. package/lib/commonjs/reanimated2/threads.js.map +1 -1
  227. package/lib/commonjs/reanimated2/utils.js +0 -5
  228. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  229. package/lib/commonjs/reanimated2/valueSetter.js +6 -21
  230. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
  231. package/lib/commonjs/setAndForwardRef.js +3 -3
  232. package/lib/commonjs/setAndForwardRef.js.map +1 -1
  233. package/lib/module/Animated.js.map +1 -1
  234. package/lib/module/ConfigHelper.js +9 -15
  235. package/lib/module/ConfigHelper.js.map +1 -1
  236. package/lib/module/createAnimatedComponent.js +20 -139
  237. package/lib/module/createAnimatedComponent.js.map +1 -1
  238. package/lib/module/index.js +0 -2
  239. package/lib/module/index.js.map +1 -1
  240. package/lib/module/index.web.js.map +1 -1
  241. package/lib/module/reanimated2/Bezier.js +14 -33
  242. package/lib/module/reanimated2/Bezier.js.map +1 -1
  243. package/lib/module/reanimated2/Colors.js +59 -109
  244. package/lib/module/reanimated2/Colors.js.map +1 -1
  245. package/lib/module/reanimated2/Easing.js +37 -33
  246. package/lib/module/reanimated2/Easing.js.map +1 -1
  247. package/lib/module/reanimated2/NativeMethods.js +8 -15
  248. package/lib/module/reanimated2/NativeMethods.js.map +1 -1
  249. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +5 -27
  250. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  251. package/lib/module/reanimated2/NativeReanimated/index.js +0 -2
  252. package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -1
  253. package/lib/module/reanimated2/PlatformChecker.js.map +1 -1
  254. package/lib/module/reanimated2/PropAdapters.js +12 -10
  255. package/lib/module/reanimated2/PropAdapters.js.map +1 -1
  256. package/lib/module/reanimated2/UpdateProps.js +3 -5
  257. package/lib/module/reanimated2/UpdateProps.js.map +1 -1
  258. package/lib/module/reanimated2/ViewDescriptorsSet.js +0 -6
  259. package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -1
  260. package/lib/module/reanimated2/WorkletEventHandler.js +5 -18
  261. package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -1
  262. package/lib/module/reanimated2/animation/decay.js +7 -15
  263. package/lib/module/reanimated2/animation/decay.js.map +1 -1
  264. package/lib/module/reanimated2/animation/delay.js +0 -9
  265. package/lib/module/reanimated2/animation/delay.js.map +1 -1
  266. package/lib/module/reanimated2/animation/index.js.map +1 -1
  267. package/lib/module/reanimated2/animation/repeat.js +6 -20
  268. package/lib/module/reanimated2/animation/repeat.js.map +1 -1
  269. package/lib/module/reanimated2/animation/sequence.js +3 -18
  270. package/lib/module/reanimated2/animation/sequence.js.map +1 -1
  271. package/lib/module/reanimated2/animation/spring.js +11 -21
  272. package/lib/module/reanimated2/animation/spring.js.map +1 -1
  273. package/lib/module/reanimated2/animation/styleAnimation.js +7 -31
  274. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  275. package/lib/module/reanimated2/animation/timing.js +0 -8
  276. package/lib/module/reanimated2/animation/timing.js.map +1 -1
  277. package/lib/module/reanimated2/animation/util.js +10 -33
  278. package/lib/module/reanimated2/animation/util.js.map +1 -1
  279. package/lib/module/reanimated2/commonTypes.js +12 -19
  280. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  281. package/lib/module/reanimated2/component/FlatList.js +0 -4
  282. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  283. package/lib/module/reanimated2/component/Image.js.map +1 -1
  284. package/lib/module/reanimated2/component/ScrollView.js.map +1 -1
  285. package/lib/module/reanimated2/component/Text.js.map +1 -1
  286. package/lib/module/reanimated2/component/View.js.map +1 -1
  287. package/lib/module/reanimated2/core.js +6 -22
  288. package/lib/module/reanimated2/core.js.map +1 -1
  289. package/lib/module/reanimated2/errors.js +3 -13
  290. package/lib/module/reanimated2/errors.js.map +1 -1
  291. package/lib/module/reanimated2/fabricUtils.js +3 -3
  292. package/lib/module/reanimated2/fabricUtils.js.map +1 -1
  293. package/lib/module/reanimated2/fabricUtils.web.js +1 -1
  294. package/lib/module/reanimated2/fabricUtils.web.js.map +1 -1
  295. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +3 -8
  296. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -1
  297. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +13 -15
  298. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  299. package/lib/module/reanimated2/globals.d.js.map +1 -1
  300. package/lib/module/reanimated2/hook/Hooks.js +3 -2
  301. package/lib/module/reanimated2/hook/Hooks.js.map +1 -1
  302. package/lib/module/reanimated2/hook/commonTypes.js.map +1 -1
  303. package/lib/module/reanimated2/hook/index.js.map +1 -1
  304. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +3 -14
  305. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -1
  306. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +2 -5
  307. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  308. package/lib/module/reanimated2/hook/useAnimatedReaction.js +1 -7
  309. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  310. package/lib/module/reanimated2/hook/useAnimatedRef.js +0 -6
  311. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  312. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +2 -7
  313. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -1
  314. package/lib/module/reanimated2/hook/useAnimatedSensor.js +9 -20
  315. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  316. package/lib/module/reanimated2/hook/useAnimatedStyle.js +13 -59
  317. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  318. package/lib/module/reanimated2/hook/useDerivedValue.js +4 -8
  319. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  320. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -1
  321. package/lib/module/reanimated2/hook/useScrollViewOffset.js +0 -1
  322. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  323. package/lib/module/reanimated2/hook/useSharedValue.js +2 -3
  324. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -1
  325. package/lib/module/reanimated2/hook/utils.js +8 -21
  326. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  327. package/lib/module/reanimated2/index.js.map +1 -1
  328. package/lib/module/reanimated2/initializers.js +23 -37
  329. package/lib/module/reanimated2/initializers.js.map +1 -1
  330. package/lib/module/reanimated2/interpolateColor.js +5 -34
  331. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  332. package/lib/module/reanimated2/interpolation.js +13 -28
  333. package/lib/module/reanimated2/interpolation.js.map +1 -1
  334. package/lib/module/reanimated2/jestUtils.js +11 -35
  335. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  336. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +15 -35
  337. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  338. package/lib/module/reanimated2/js-reanimated/Mapper.js +9 -23
  339. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
  340. package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +7 -35
  341. package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +1 -1
  342. package/lib/module/reanimated2/js-reanimated/MutableValue.js +5 -16
  343. package/lib/module/reanimated2/js-reanimated/MutableValue.js.map +1 -1
  344. package/lib/module/reanimated2/js-reanimated/global.js +2 -6
  345. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
  346. package/lib/module/reanimated2/js-reanimated/index.js +3 -9
  347. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  348. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +7 -23
  349. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -1
  350. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +3 -45
  351. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -1
  352. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +7 -39
  353. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -1
  354. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +3 -3
  355. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  356. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  357. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +4 -19
  358. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  359. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +3 -52
  360. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  361. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +3 -32
  362. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -1
  363. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +3 -38
  364. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -1
  365. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +7 -16
  366. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  367. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +3 -8
  368. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -1
  369. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +3 -14
  370. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  371. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +3 -26
  372. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -1
  373. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +3 -26
  374. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  375. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +3 -14
  376. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -1
  377. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +3 -50
  378. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  379. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -1
  380. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +3 -17
  381. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -1
  382. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +5 -23
  383. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -1
  384. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +3 -5
  385. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -1
  386. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +5 -6
  387. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -1
  388. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +3 -5
  389. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -1
  390. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +3 -8
  391. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -1
  392. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -1
  393. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  394. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +3 -13
  395. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -1
  396. package/lib/module/reanimated2/mappers.js +26 -25
  397. package/lib/module/reanimated2/mappers.js.map +1 -1
  398. package/lib/module/reanimated2/mock.js +5 -15
  399. package/lib/module/reanimated2/mock.js.map +1 -1
  400. package/lib/module/reanimated2/mutables.js +2 -19
  401. package/lib/module/reanimated2/mutables.js.map +1 -1
  402. package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -1
  403. package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -1
  404. package/lib/module/reanimated2/platform-specific/checkCppVersion.js +24 -0
  405. package/lib/module/reanimated2/platform-specific/checkCppVersion.js.map +1 -0
  406. package/lib/module/reanimated2/platform-specific/checkVersion.web.js +0 -1
  407. package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -1
  408. package/lib/module/reanimated2/platform-specific/jsVersion.js +7 -0
  409. package/lib/module/reanimated2/platform-specific/jsVersion.js.map +1 -0
  410. package/lib/module/reanimated2/pluginUtils.js.map +1 -1
  411. package/lib/module/reanimated2/shareables.js +96 -44
  412. package/lib/module/reanimated2/shareables.js.map +1 -1
  413. package/lib/module/reanimated2/threads.js +39 -33
  414. package/lib/module/reanimated2/threads.js.map +1 -1
  415. package/lib/module/reanimated2/utils.js +0 -3
  416. package/lib/module/reanimated2/utils.js.map +1 -1
  417. package/lib/module/reanimated2/valueSetter.js +6 -19
  418. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  419. package/lib/module/setAndForwardRef.js +3 -2
  420. package/lib/module/setAndForwardRef.js.map +1 -1
  421. package/package.json +46 -40
  422. package/plugin/.eslintrc.js +7 -0
  423. package/plugin/README.md +241 -0
  424. package/plugin/build/plugin.js +714 -0
  425. package/plugin/build/plugin.js.map +7 -0
  426. package/plugin/index.js +1 -807
  427. package/plugin/package.json +23 -0
  428. package/plugin/src/buildWorkletString.ts +213 -0
  429. package/plugin/src/commonObjects.ts +60 -0
  430. package/plugin/src/injectVersion.ts +37 -0
  431. package/plugin/src/makeWorklet.ts +375 -0
  432. package/plugin/src/plugin.ts +49 -0
  433. package/plugin/src/processForCalleesWorklets.ts +106 -0
  434. package/plugin/src/processIfGestureHandlerEventCallbackFunctionNode.ts +156 -0
  435. package/plugin/src/processIfWorkletFunction.ts +55 -0
  436. package/plugin/src/processIfWorkletNode.ts +44 -0
  437. package/plugin/src/processInlineStylesWarning.ts +129 -0
  438. package/plugin/src/processWorkletObjectMethod.ts +31 -0
  439. package/plugin/src/types.ts +15 -0
  440. package/plugin/src/utils.ts +6 -0
  441. package/plugin/tsconfig.json +15 -0
  442. package/plugin/yarn.lock +2193 -0
  443. package/react-native-reanimated.d.ts +1 -0
  444. package/scripts/reanimated_utils.rb +2 -2
  445. package/src/createAnimatedComponent.tsx +2 -3
  446. package/src/reanimated2/Easing.ts +19 -0
  447. package/src/reanimated2/NativeMethods.ts +9 -4
  448. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +2 -2
  449. package/src/reanimated2/UpdateProps.ts +2 -2
  450. package/src/reanimated2/animation/decay.ts +7 -1
  451. package/src/reanimated2/animation/styleAnimation.ts +5 -1
  452. package/src/reanimated2/core.ts +4 -4
  453. package/src/reanimated2/errors.ts +1 -0
  454. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +12 -4
  455. package/src/reanimated2/globals.d.ts +71 -112
  456. package/src/reanimated2/hook/commonTypes.ts +1 -1
  457. package/src/reanimated2/hook/useAnimatedReaction.ts +2 -2
  458. package/src/reanimated2/hook/useAnimatedSensor.ts +2 -2
  459. package/src/reanimated2/initializers.ts +11 -8
  460. package/src/reanimated2/jestUtils.ts +0 -1
  461. package/src/reanimated2/js-reanimated/JSReanimated.ts +5 -1
  462. package/src/reanimated2/js-reanimated/index.ts +1 -1
  463. package/src/reanimated2/mappers.ts +26 -4
  464. package/src/reanimated2/mock.ts +1 -0
  465. package/src/reanimated2/platform-specific/checkCppVersion.ts +29 -0
  466. package/src/reanimated2/platform-specific/jsVersion.ts +6 -0
  467. package/src/reanimated2/shareables.ts +107 -8
  468. package/src/reanimated2/threads.ts +36 -17
  469. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +0 -42
  470. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +0 -1
  471. package/lib/module/reanimated2/platform-specific/checkVersion.js +0 -35
  472. package/lib/module/reanimated2/platform-specific/checkVersion.js.map +0 -1
  473. package/src/reanimated2/platform-specific/checkVersion.ts +0 -39
@@ -44,7 +44,7 @@ NativeProxy::NativeProxy(
44
44
  : javaPart_(jni::make_global(jThis)),
45
45
  runtime_(rt),
46
46
  jsCallInvoker_(jsCallInvoker),
47
- layoutAnimations(std::move(_layoutAnimations)),
47
+ layoutAnimations_(std::move(_layoutAnimations)),
48
48
  scheduler_(scheduler)
49
49
  #ifdef RCT_NEW_ARCH_ENABLED
50
50
  ,
@@ -68,7 +68,7 @@ NativeProxy::~NativeProxy() {
68
68
  // cleanup all animated sensors here, since NativeProxy
69
69
  // has already been destroyed when AnimatedSensorModule's
70
70
  // destructor is ran
71
- _nativeReanimatedModule->cleanupSensors();
71
+ nativeReanimatedModule_->cleanupSensors();
72
72
  }
73
73
 
74
74
  jni::local_ref<NativeProxy::jhybriddata> NativeProxy::initHybrid(
@@ -108,158 +108,12 @@ void NativeProxy::installJSIBindings(
108
108
  fabricUIManager
109
109
  #endif
110
110
  /**/) {
111
- #ifdef RCT_NEW_ARCH_ENABLED
112
- // nothing
113
- #else
114
- auto updatePropsFunction = [this](
115
- jsi::Runtime &rt,
116
- int viewTag,
117
- const jsi::Value &viewName,
118
- const jsi::Object &props) {
119
- // viewName is for iOS only, we skip it here
120
- this->updateProps(rt, viewTag, props);
121
- };
122
-
123
- auto measureFunction =
124
- [this](int viewTag) -> std::vector<std::pair<std::string, double>> {
125
- return measure(viewTag);
126
- };
127
-
128
- auto scrollToFunction =
129
- [this](int viewTag, double x, double y, bool animated) -> void {
130
- scrollTo(viewTag, x, y, animated);
131
- };
132
- #endif
133
-
134
- auto getCurrentTime = [this]() {
135
- static const auto method =
136
- javaPart_->getClass()->getMethod<jlong()>("getCurrentTime");
137
- jlong output = method(javaPart_.get());
138
- return static_cast<double>(output);
139
- };
140
-
141
- auto requestRender = [this](
142
- std::function<void(double)> onRender,
143
- jsi::Runtime &rt) { this->requestRender(onRender); };
144
-
145
- #ifdef RCT_NEW_ARCH_ENABLED
146
- auto synchronouslyUpdateUIPropsFunction =
147
- [this](jsi::Runtime &rt, Tag tag, const jsi::Value &props) {
148
- this->synchronouslyUpdateUIProps(rt, tag, props);
149
- };
150
- #else
151
- auto propObtainer = [this](
152
- jsi::Runtime &rt,
153
- const int viewTag,
154
- const jsi::String &propName) -> jsi::Value {
155
- auto method =
156
- javaPart_->getClass()
157
- ->getMethod<jni::local_ref<JString>(int, jni::local_ref<JString>)>(
158
- "obtainProp");
159
- local_ref<JString> propNameJStr =
160
- jni::make_jstring(propName.utf8(rt).c_str());
161
- auto result = method(javaPart_.get(), viewTag, propNameJStr);
162
- std::string str = result->toStdString();
163
- return jsi::Value(rt, jsi::String::createFromAscii(rt, str.c_str()));
164
- };
165
-
166
- auto configurePropsFunction = [=](jsi::Runtime &rt,
167
- const jsi::Value &uiProps,
168
- const jsi::Value &nativeProps) {
169
- this->configureProps(rt, uiProps, nativeProps);
170
- };
171
- #endif
172
-
173
- auto registerSensorFunction =
174
- [this](
175
- int sensorType,
176
- int interval,
177
- int iosReferenceFrame,
178
- std::function<void(double[], int)> setter) -> int {
179
- return this->registerSensor(sensorType, interval, std::move(setter));
180
- };
181
- auto unregisterSensorFunction = [this](int sensorId) {
182
- unregisterSensor(sensorId);
183
- };
184
-
185
- auto setGestureStateFunction = [this](int handlerTag, int newState) -> void {
186
- setGestureState(handlerTag, newState);
187
- };
188
-
189
- auto subscribeForKeyboardEventsFunction =
190
- [this](
191
- std::function<void(int, int)> keyboardEventDataUpdater,
192
- bool isStatusBarTranslucent) -> int {
193
- return subscribeForKeyboardEvents(
194
- std::move(keyboardEventDataUpdater), isStatusBarTranslucent);
195
- };
196
-
197
- auto unsubscribeFromKeyboardEventsFunction = [this](int listenerId) -> void {
198
- unsubscribeFromKeyboardEvents(listenerId);
199
- };
200
-
201
111
  auto jsQueue = std::make_shared<JMessageQueueThread>(messageQueueThread);
202
112
  std::shared_ptr<jsi::Runtime> animatedRuntime =
203
113
  ReanimatedRuntime::make(runtime_, jsQueue);
204
114
 
205
- auto &rt = *runtime_;
206
-
207
- auto workletRuntimeValue =
208
- rt.global()
209
- .getPropertyAsObject(rt, "ArrayBuffer")
210
- .asFunction(rt)
211
- .callAsConstructor(rt, {static_cast<double>(sizeof(void *))});
212
- uintptr_t *workletRuntimeData = reinterpret_cast<uintptr_t *>(
213
- workletRuntimeValue.getObject(rt).getArrayBuffer(rt).data(rt));
214
- workletRuntimeData[0] = reinterpret_cast<uintptr_t>(animatedRuntime.get());
215
-
216
- rt.global().setProperty(rt, "_WORKLET_RUNTIME", workletRuntimeValue);
217
-
218
- #ifdef RCT_NEW_ARCH_ENABLED
219
- rt.global().setProperty(rt, "_IS_FABRIC", true);
220
- #else
221
- rt.global().setProperty(rt, "_IS_FABRIC", false);
222
- #endif
223
-
224
- auto version = getReanimatedVersionString(rt);
225
- rt.global().setProperty(rt, "_REANIMATED_VERSION_CPP", version);
226
-
227
115
  std::shared_ptr<ErrorHandler> errorHandler =
228
116
  std::make_shared<AndroidErrorHandler>(scheduler_);
229
- std::weak_ptr<jsi::Runtime> wrt = animatedRuntime;
230
-
231
- auto progressLayoutAnimation =
232
- [this, wrt](
233
- int tag, const jsi::Object &newProps, bool isSharedTransition) {
234
- auto newPropsJNI = JNIHelper::ConvertToPropsMap(*wrt.lock(), newProps);
235
- this->layoutAnimations->cthis()->progressLayoutAnimation(
236
- tag, newPropsJNI, isSharedTransition);
237
- };
238
-
239
- auto endLayoutAnimation = [this](int tag, bool isCancelled, bool removeView) {
240
- this->layoutAnimations->cthis()->endLayoutAnimation(
241
- tag, isCancelled, removeView);
242
- };
243
-
244
- PlatformDepMethodsHolder platformDepMethodsHolder = {
245
- requestRender,
246
- #ifdef RCT_NEW_ARCH_ENABLED
247
- synchronouslyUpdateUIPropsFunction,
248
- #else
249
- updatePropsFunction,
250
- scrollToFunction,
251
- measureFunction,
252
- configurePropsFunction,
253
- #endif
254
- getCurrentTime,
255
- progressLayoutAnimation,
256
- endLayoutAnimation,
257
- registerSensorFunction,
258
- unregisterSensorFunction,
259
- setGestureStateFunction,
260
- subscribeForKeyboardEventsFunction,
261
- unsubscribeFromKeyboardEventsFunction,
262
- };
263
117
 
264
118
  auto module = std::make_shared<NativeReanimatedModule>(
265
119
  jsCallInvoker_,
@@ -269,52 +123,12 @@ void NativeProxy::installJSIBindings(
269
123
  #ifdef RCT_NEW_ARCH_ENABLED
270
124
  // nothing
271
125
  #else
272
- propObtainer,
126
+ bindThis(&NativeProxy::obtainProp),
273
127
  #endif
274
- platformDepMethodsHolder);
128
+ getPlatformDependentMethods());
275
129
 
276
130
  scheduler_->setRuntimeManager(module);
277
-
278
- _nativeReanimatedModule = module;
279
- std::weak_ptr<NativeReanimatedModule> weakModule = module;
280
-
281
- this->registerEventHandler([weakModule, getCurrentTime](
282
- jni::alias_ref<JString> eventKey,
283
- jni::alias_ref<react::WritableMap> event) {
284
- // handles RCTEvents from RNGestureHandler
285
- if (auto module = weakModule.lock()) {
286
- auto eventName = eventKey->toString();
287
-
288
- // TODO: convert event directly to jsi::Value without JSON serialization
289
- std::string eventAsString;
290
- try {
291
- eventAsString = event->toString();
292
- } catch (std::exception &) {
293
- // Events from other libraries may contain NaN or INF values which
294
- // cannot be represented in JSON. See
295
- // https://github.com/software-mansion/react-native-reanimated/issues/1776
296
- // for details.
297
- return;
298
- }
299
- std::string eventJSON = eventAsString.substr(
300
- 13, eventAsString.length() - 15); // removes "{ NativeMap: " and " }"
301
- if (eventJSON == "null") {
302
- return;
303
- }
304
-
305
- jsi::Runtime &rt = *module->runtime;
306
- jsi::Value payload;
307
- try {
308
- payload = jsi::Value::createFromJsonUtf8(
309
- rt, reinterpret_cast<uint8_t *>(&eventJSON[0]), eventJSON.size());
310
- } catch (std::exception &) {
311
- // Ignore events with malformed JSON payload.
312
- return;
313
- }
314
-
315
- module->handleEvent(eventName, payload, getCurrentTime());
316
- }
317
- });
131
+ nativeReanimatedModule_ = module;
318
132
 
319
133
  #ifdef RCT_NEW_ARCH_ENABLED
320
134
  Binding *binding = fabricUIManager->getBinding();
@@ -323,99 +137,19 @@ void NativeProxy::installJSIBindings(
323
137
  module->setUIManager(uiManager);
324
138
  module->setNewestShadowNodesRegistry(newestShadowNodesRegistry_);
325
139
  newestShadowNodesRegistry_ = nullptr;
140
+ // removed temporary, new event listener mechanism need fix on the RN side
141
+ // eventListener_ = std::make_shared<EventListener>(
142
+ // [module, getCurrentTime](const RawEvent &rawEvent) {
143
+ // return module->handleRawEvent(rawEvent, getCurrentTime());
144
+ // });
145
+ // reactScheduler_ = binding->getScheduler();
146
+ // reactScheduler_->addEventListener(eventListener_);
326
147
  #endif
327
- // removed temporary, new event listener mechanism need fix on the RN side
328
- // eventListener_ = std::make_shared<EventListener>(
329
- // [module, getCurrentTime](const RawEvent &rawEvent) {
330
- // return module->handleRawEvent(rawEvent, getCurrentTime());
331
- // });
332
- // reactScheduler_ = binding->getScheduler();
333
- // reactScheduler_->addEventListener(eventListener_);
334
-
335
- std::weak_ptr<ErrorHandler> weakErrorHandler = errorHandler;
336
-
337
- layoutAnimations->cthis()->setAnimationStartingBlock(
338
- [wrt, weakModule, weakErrorHandler](
339
- int tag, int type, alias_ref<JMap<jstring, jstring>> values) {
340
- auto &rt = *wrt.lock();
341
- jsi::Object yogaValues(rt);
342
- for (const auto &entry : *values) {
343
- try {
344
- std::string keyString = entry.first->toStdString();
345
- std::string valueString = entry.second->toStdString();
346
- auto key = jsi::String::createFromAscii(rt, keyString);
347
- if (keyString == "currentTransformMatrix" ||
348
- keyString == "targetTransformMatrix") {
349
- jsi::Array matrix =
350
- jsi_utils::convertStringToArray(rt, valueString, 9);
351
- yogaValues.setProperty(rt, key, matrix);
352
- } else {
353
- auto value = stod(valueString);
354
- yogaValues.setProperty(rt, key, value);
355
- }
356
- } catch (std::invalid_argument e) {
357
- if (auto errorHandler = weakErrorHandler.lock()) {
358
- errorHandler->setError("Failed to convert value to number");
359
- errorHandler->raise();
360
- }
361
- }
362
- }
363
-
364
- auto reaModule = weakModule.lock();
365
- if (reaModule == nullptr) {
366
- return;
367
- }
368
-
369
- reaModule->layoutAnimationsManager().startLayoutAnimation(
370
- rt, tag, static_cast<LayoutAnimationType>(type), yogaValues);
371
- });
372
-
373
- layoutAnimations->cthis()->setHasAnimationBlock(
374
- [weakModule](int tag, int type) {
375
- auto reaModule = weakModule.lock();
376
- if (reaModule == nullptr) {
377
- return false;
378
- }
379
-
380
- return reaModule->layoutAnimationsManager().hasLayoutAnimation(
381
- tag, static_cast<LayoutAnimationType>(type));
382
- });
383
-
384
- layoutAnimations->cthis()->setClearAnimationConfigBlock(
385
- [weakModule](int tag) {
386
- auto reaModule = weakModule.lock();
387
- if (reaModule == nullptr) {
388
- return;
389
- }
390
148
 
391
- reaModule->layoutAnimationsManager().clearLayoutAnimationConfig(tag);
392
- });
393
-
394
- layoutAnimations->cthis()->setCancelAnimationForTag(
395
- [wrt, weakModule](
396
- int tag, int type, jboolean cancelled, jboolean removeView) {
397
- if (auto reaModule = weakModule.lock()) {
398
- if (auto runtime = wrt.lock()) {
399
- jsi::Runtime &rt = *runtime;
400
- reaModule->layoutAnimationsManager().cancelLayoutAnimation(
401
- rt,
402
- tag,
403
- static_cast<LayoutAnimationType>(type),
404
- cancelled,
405
- removeView);
406
- }
407
- }
408
- });
409
-
410
- layoutAnimations->cthis()->setFindPrecedingViewTagForTransition(
411
- [weakModule](int tag) {
412
- if (auto module = weakModule.lock()) {
413
- return module->layoutAnimationsManager()
414
- .findPrecedingViewTagForTransition(tag);
415
- } else {
416
- return -1;
417
- }
418
- });
149
+ auto &rt = *runtime_;
150
+ setGlobalProperties(rt, animatedRuntime);
151
+ registerEventHandler();
152
+ setupLayoutAnimations();
419
153
 
420
154
  rt.global().setProperty(
421
155
  rt,
@@ -424,12 +158,12 @@ void NativeProxy::installJSIBindings(
424
158
  }
425
159
 
426
160
  bool NativeProxy::isAnyHandlerWaitingForEvent(std::string s) {
427
- return _nativeReanimatedModule->isAnyHandlerWaitingForEvent(s);
161
+ return nativeReanimatedModule_->isAnyHandlerWaitingForEvent(s);
428
162
  }
429
163
 
430
164
  void NativeProxy::performOperations() {
431
165
  #ifdef RCT_NEW_ARCH_ENABLED
432
- _nativeReanimatedModule->performOperations();
166
+ nativeReanimatedModule_->performOperations();
433
167
  #endif
434
168
  }
435
169
 
@@ -443,52 +177,84 @@ void NativeProxy::registerNatives() {
443
177
  makeNativeMethod("performOperations", NativeProxy::performOperations)});
444
178
  }
445
179
 
446
- void NativeProxy::requestRender(std::function<void(double)> onRender) {
447
- static auto method =
448
- javaPart_->getClass()
449
- ->getMethod<void(AnimationFrameCallback::javaobject)>(
450
- "requestRender");
180
+ void NativeProxy::requestRender(
181
+ std::function<void(double)> onRender,
182
+ jsi::Runtime &rt) {
183
+ static const auto method =
184
+ getJniMethod<void(AnimationFrameCallback::javaobject)>("requestRender");
451
185
  method(
452
186
  javaPart_.get(),
453
187
  AnimationFrameCallback::newObjectCxxArgs(std::move(onRender)).get());
454
188
  }
455
189
 
456
- void NativeProxy::registerEventHandler(
457
- std::function<
458
- void(jni::alias_ref<JString>, jni::alias_ref<react::WritableMap>)>
459
- handler) {
460
- static auto method =
461
- javaPart_->getClass()->getMethod<void(EventHandler::javaobject)>(
462
- "registerEventHandler");
190
+ void NativeProxy::registerEventHandler() {
191
+ auto eventHandler = bindThis(&NativeProxy::handleEvent);
192
+ static const auto method =
193
+ getJniMethod<void(EventHandler::javaobject)>("registerEventHandler");
463
194
  method(
464
195
  javaPart_.get(),
465
- EventHandler::newObjectCxxArgs(std::move(handler)).get());
196
+ EventHandler::newObjectCxxArgs(std::move(eventHandler)).get());
197
+ }
198
+
199
+ void NativeProxy::maybeFlushUIUpdatesQueue() {
200
+ static const auto method = getJniMethod<void()>("maybeFlushUIUpdatesQueue");
201
+ method(javaPart_.get());
466
202
  }
467
203
 
468
204
  #ifdef RCT_NEW_ARCH_ENABLED
469
205
  // nothing
470
206
  #else
207
+ jsi::Value NativeProxy::obtainProp(
208
+ jsi::Runtime &rt,
209
+ const int viewTag,
210
+ const jsi::String &propName) {
211
+ static const auto method =
212
+ getJniMethod<jni::local_ref<JString>(int, jni::local_ref<JString>)>(
213
+ "obtainProp");
214
+ local_ref<JString> propNameJStr =
215
+ jni::make_jstring(propName.utf8(rt).c_str());
216
+ auto result = method(javaPart_.get(), viewTag, propNameJStr);
217
+ std::string str = result->toStdString();
218
+ return jsi::Value(rt, jsi::String::createFromAscii(rt, str));
219
+ }
220
+
221
+ void NativeProxy::configureProps(
222
+ jsi::Runtime &rt,
223
+ const jsi::Value &uiProps,
224
+ const jsi::Value &nativeProps) {
225
+ static const auto method = getJniMethod<void(
226
+ ReadableNativeArray::javaobject, ReadableNativeArray::javaobject)>(
227
+ "configureProps");
228
+ method(
229
+ javaPart_.get(),
230
+ ReadableNativeArray::newObjectCxxArgs(jsi::dynamicFromValue(rt, uiProps))
231
+ .get(),
232
+ ReadableNativeArray::newObjectCxxArgs(
233
+ jsi::dynamicFromValue(rt, nativeProps))
234
+ .get());
235
+ }
236
+
471
237
  void NativeProxy::updateProps(
472
238
  jsi::Runtime &rt,
473
239
  int viewTag,
240
+ const jsi::Value &viewName,
474
241
  const jsi::Object &props) {
475
- auto method = javaPart_->getClass()
476
- ->getMethod<void(int, JMap<JString, JObject>::javaobject)>(
477
- "updateProps");
242
+ static const auto method =
243
+ getJniMethod<void(int, JMap<JString, JObject>::javaobject)>(
244
+ "updateProps");
478
245
  method(
479
246
  javaPart_.get(), viewTag, JNIHelper::ConvertToPropsMap(rt, props).get());
480
247
  }
481
248
 
482
249
  void NativeProxy::scrollTo(int viewTag, double x, double y, bool animated) {
483
- auto method =
484
- javaPart_->getClass()->getMethod<void(int, double, double, bool)>(
485
- "scrollTo");
250
+ static const auto method =
251
+ getJniMethod<void(int, double, double, bool)>("scrollTo");
486
252
  method(javaPart_.get(), viewTag, x, y, animated);
487
253
  }
488
254
 
489
255
  std::vector<std::pair<std::string, double>> NativeProxy::measure(int viewTag) {
490
- auto method =
491
- javaPart_->getClass()->getMethod<local_ref<JArrayFloat>(int)>("measure");
256
+ static const auto method =
257
+ getJniMethod<local_ref<JArrayFloat>(int)>("measure");
492
258
  local_ref<JArrayFloat> output = method(javaPart_.get(), viewTag);
493
259
  size_t size = output->size();
494
260
  auto elements = output->getRegion(0, size);
@@ -518,9 +284,8 @@ void NativeProxy::synchronouslyUpdateUIProps(
518
284
  Tag tag,
519
285
  const jsi::Value &props) {
520
286
  static const auto method =
521
- javaPart_->getClass()
522
- ->getMethod<void(int, jni::local_ref<ReadableMap::javaobject>)>(
523
- "synchronouslyUpdateUIProps");
287
+ getJniMethod<void(int, jni::local_ref<ReadableMap::javaobject>)>(
288
+ "synchronouslyUpdateUIProps");
524
289
  jni::local_ref<ReadableMap::javaobject> uiProps = castReadableMap(
525
290
  ReadableNativeMap::newObjectCxxArgs(jsi::dynamicFromValue(rt, props)));
526
291
  method(javaPart_.get(), tag, uiProps);
@@ -530,10 +295,10 @@ void NativeProxy::synchronouslyUpdateUIProps(
530
295
  int NativeProxy::registerSensor(
531
296
  int sensorType,
532
297
  int interval,
298
+ int iosReferenceFrame,
533
299
  std::function<void(double[], int)> setter) {
534
- static auto method =
535
- javaPart_->getClass()->getMethod<int(int, int, SensorSetter::javaobject)>(
536
- "registerSensor");
300
+ static const auto method =
301
+ getJniMethod<int(int, int, SensorSetter::javaobject)>("registerSensor");
537
302
  return method(
538
303
  javaPart_.get(),
539
304
  sensorType,
@@ -541,40 +306,21 @@ int NativeProxy::registerSensor(
541
306
  SensorSetter::newObjectCxxArgs(std::move(setter)).get());
542
307
  }
543
308
  void NativeProxy::unregisterSensor(int sensorId) {
544
- auto method = javaPart_->getClass()->getMethod<void(int)>("unregisterSensor");
309
+ static const auto method = getJniMethod<void(int)>("unregisterSensor");
545
310
  method(javaPart_.get(), sensorId);
546
311
  }
547
312
 
548
313
  void NativeProxy::setGestureState(int handlerTag, int newState) {
549
- auto method =
550
- javaPart_->getClass()->getMethod<void(int, int)>("setGestureState");
314
+ static const auto method = getJniMethod<void(int, int)>("setGestureState");
551
315
  method(javaPart_.get(), handlerTag, newState);
552
316
  }
553
317
 
554
- void NativeProxy::configureProps(
555
- jsi::Runtime &rt,
556
- const jsi::Value &uiProps,
557
- const jsi::Value &nativeProps) {
558
- auto method = javaPart_->getClass()
559
- ->getMethod<void(
560
- ReadableNativeArray::javaobject,
561
- ReadableNativeArray::javaobject)>("configureProps");
562
- method(
563
- javaPart_.get(),
564
- ReadableNativeArray::newObjectCxxArgs(jsi::dynamicFromValue(rt, uiProps))
565
- .get(),
566
- ReadableNativeArray::newObjectCxxArgs(
567
- jsi::dynamicFromValue(rt, nativeProps))
568
- .get());
569
- }
570
-
571
318
  int NativeProxy::subscribeForKeyboardEvents(
572
319
  std::function<void(int, int)> keyboardEventDataUpdater,
573
320
  bool isStatusBarTranslucent) {
574
- auto method =
575
- javaPart_->getClass()
576
- ->getMethod<int(KeyboardEventDataUpdater::javaobject, bool)>(
577
- "subscribeForKeyboardEvents");
321
+ static const auto method =
322
+ getJniMethod<int(KeyboardEventDataUpdater::javaobject, bool)>(
323
+ "subscribeForKeyboardEvents");
578
324
  return method(
579
325
  javaPart_.get(),
580
326
  KeyboardEventDataUpdater::newObjectCxxArgs(
@@ -584,9 +330,242 @@ int NativeProxy::subscribeForKeyboardEvents(
584
330
  }
585
331
 
586
332
  void NativeProxy::unsubscribeFromKeyboardEvents(int listenerId) {
587
- auto method = javaPart_->getClass()->getMethod<void(int)>(
588
- "unsubscribeFromKeyboardEvents");
333
+ static const auto method =
334
+ getJniMethod<void(int)>("unsubscribeFromKeyboardEvents");
589
335
  method(javaPart_.get(), listenerId);
590
336
  }
591
337
 
338
+ double NativeProxy::getCurrentTime() {
339
+ static const auto method = getJniMethod<jlong()>("getCurrentTime");
340
+ jlong output = method(javaPart_.get());
341
+ return static_cast<double>(output);
342
+ }
343
+
344
+ void NativeProxy::handleEvent(
345
+ jni::alias_ref<JString> eventKey,
346
+ jni::alias_ref<react::WritableMap> event) {
347
+ // handles RCTEvents from RNGestureHandler
348
+ auto eventName = eventKey->toString();
349
+
350
+ // TODO: convert event directly to jsi::Value without JSON serialization
351
+ std::string eventAsString;
352
+ try {
353
+ eventAsString = event->toString();
354
+ } catch (std::exception &) {
355
+ // Events from other libraries may contain NaN or INF values which
356
+ // cannot be represented in JSON. See
357
+ // https://github.com/software-mansion/react-native-reanimated/issues/1776
358
+ // for details.
359
+ return;
360
+ }
361
+ #if REACT_NATIVE_MINOR_VERSION >= 72
362
+ std::string eventJSON = eventAsString;
363
+ #else
364
+ // remove "{ NativeMap: " and " }"
365
+ std::string eventJSON = eventAsString.substr(13, eventAsString.length() - 15);
366
+ #endif
367
+ if (eventJSON == "null") {
368
+ return;
369
+ }
370
+
371
+ jsi::Runtime &rt = *nativeReanimatedModule_->runtime;
372
+ jsi::Value payload;
373
+ try {
374
+ payload = jsi::Value::createFromJsonUtf8(
375
+ rt, reinterpret_cast<uint8_t *>(&eventJSON[0]), eventJSON.size());
376
+ } catch (std::exception &) {
377
+ // Ignore events with malformed JSON payload.
378
+ return;
379
+ }
380
+
381
+ nativeReanimatedModule_->handleEvent(
382
+ eventName, payload, this->getCurrentTime());
383
+ }
384
+
385
+ void NativeProxy::progressLayoutAnimation(
386
+ int tag,
387
+ const jsi::Object &newProps,
388
+ bool isSharedTransition) {
389
+ auto &rt = *nativeReanimatedModule_->runtime;
390
+ auto newPropsJNI = JNIHelper::ConvertToPropsMap(rt, newProps);
391
+ layoutAnimations_->cthis()->progressLayoutAnimation(
392
+ tag, newPropsJNI, isSharedTransition);
393
+ }
394
+
395
+ PlatformDepMethodsHolder NativeProxy::getPlatformDependentMethods() {
396
+ #ifdef RCT_NEW_ARCH_ENABLED
397
+ // nothing
398
+ #else
399
+ auto updatePropsFunction = bindThis(&NativeProxy::updateProps);
400
+
401
+ auto measureFunction = bindThis(&NativeProxy::measure);
402
+
403
+ auto scrollToFunction = bindThis(&NativeProxy::scrollTo);
404
+ #endif
405
+
406
+ auto getCurrentTime = bindThis(&NativeProxy::getCurrentTime);
407
+
408
+ auto requestRender = bindThis(&NativeProxy::requestRender);
409
+
410
+ #ifdef RCT_NEW_ARCH_ENABLED
411
+ auto synchronouslyUpdateUIPropsFunction =
412
+ bindThis(&NativeProxy::synchronouslyUpdateUIProps);
413
+ #else
414
+ auto configurePropsFunction = bindThis(&NativeProxy::configureProps);
415
+ #endif
416
+
417
+ auto registerSensorFunction = bindThis(&NativeProxy::registerSensor);
418
+ auto unregisterSensorFunction = bindThis(&NativeProxy::unregisterSensor);
419
+
420
+ auto setGestureStateFunction = bindThis(&NativeProxy::setGestureState);
421
+
422
+ auto subscribeForKeyboardEventsFunction =
423
+ bindThis(&NativeProxy::subscribeForKeyboardEvents);
424
+
425
+ auto unsubscribeFromKeyboardEventsFunction =
426
+ bindThis(&NativeProxy::unsubscribeFromKeyboardEvents);
427
+
428
+ auto progressLayoutAnimation =
429
+ bindThis(&NativeProxy::progressLayoutAnimation);
430
+
431
+ auto endLayoutAnimation = [this](int tag, bool isCancelled, bool removeView) {
432
+ this->layoutAnimations_->cthis()->endLayoutAnimation(
433
+ tag, isCancelled, removeView);
434
+ };
435
+
436
+ auto maybeFlushUiUpdatesQueueFunction =
437
+ bindThis(&NativeProxy::maybeFlushUIUpdatesQueue);
438
+
439
+ return {
440
+ requestRender,
441
+ #ifdef RCT_NEW_ARCH_ENABLED
442
+ synchronouslyUpdateUIPropsFunction,
443
+ #else
444
+ updatePropsFunction,
445
+ scrollToFunction,
446
+ measureFunction,
447
+ configurePropsFunction,
448
+ #endif
449
+ getCurrentTime,
450
+ progressLayoutAnimation,
451
+ endLayoutAnimation,
452
+ registerSensorFunction,
453
+ unregisterSensorFunction,
454
+ setGestureStateFunction,
455
+ subscribeForKeyboardEventsFunction,
456
+ unsubscribeFromKeyboardEventsFunction,
457
+ maybeFlushUiUpdatesQueueFunction,
458
+ };
459
+ }
460
+
461
+ void NativeProxy::setGlobalProperties(
462
+ jsi::Runtime &jsRuntime,
463
+ const std::shared_ptr<jsi::Runtime> &reanimatedRuntime) {
464
+ auto workletRuntimeValue =
465
+ jsRuntime.global()
466
+ .getPropertyAsObject(jsRuntime, "ArrayBuffer")
467
+ .asFunction(jsRuntime)
468
+ .callAsConstructor(jsRuntime, {static_cast<double>(sizeof(void *))});
469
+ uintptr_t *workletRuntimeData = reinterpret_cast<uintptr_t *>(
470
+ workletRuntimeValue.getObject(jsRuntime).getArrayBuffer(jsRuntime).data(
471
+ jsRuntime));
472
+ workletRuntimeData[0] = reinterpret_cast<uintptr_t>(reanimatedRuntime.get());
473
+
474
+ jsRuntime.global().setProperty(
475
+ jsRuntime, "_WORKLET_RUNTIME", workletRuntimeValue);
476
+
477
+ #ifdef RCT_NEW_ARCH_ENABLED
478
+ jsRuntime.global().setProperty(jsRuntime, "_IS_FABRIC", true);
479
+ #else
480
+ jsRuntime.global().setProperty(jsRuntime, "_IS_FABRIC", false);
481
+ #endif
482
+
483
+ auto version = getReanimatedVersionString(jsRuntime);
484
+ jsRuntime.global().setProperty(jsRuntime, "_REANIMATED_VERSION_CPP", version);
485
+ }
486
+
487
+ void NativeProxy::setupLayoutAnimations() {
488
+ auto weakModule =
489
+ std::weak_ptr<NativeReanimatedModule>(nativeReanimatedModule_);
490
+
491
+ layoutAnimations_->cthis()->setAnimationStartingBlock(
492
+ [weakModule](
493
+ int tag, int type, alias_ref<JMap<jstring, jstring>> values) {
494
+ auto module = weakModule.lock();
495
+ if (module == nullptr) {
496
+ return;
497
+ }
498
+ auto &rt = *module->runtime;
499
+ auto errorHandler = module->errorHandler;
500
+
501
+ jsi::Object yogaValues(rt);
502
+ for (const auto &entry : *values) {
503
+ try {
504
+ std::string keyString = entry.first->toStdString();
505
+ std::string valueString = entry.second->toStdString();
506
+ auto key = jsi::String::createFromAscii(rt, keyString);
507
+ if (keyString == "currentTransformMatrix" ||
508
+ keyString == "targetTransformMatrix") {
509
+ jsi::Array matrix =
510
+ jsi_utils::convertStringToArray(rt, valueString, 9);
511
+ yogaValues.setProperty(rt, key, matrix);
512
+ } else {
513
+ auto value = stod(valueString);
514
+ yogaValues.setProperty(rt, key, value);
515
+ }
516
+ } catch (std::invalid_argument e) {
517
+ errorHandler->setError("Failed to convert value to number");
518
+ errorHandler->raise();
519
+ }
520
+ }
521
+
522
+ module->layoutAnimationsManager().startLayoutAnimation(
523
+ rt, tag, static_cast<LayoutAnimationType>(type), yogaValues);
524
+ });
525
+
526
+ layoutAnimations_->cthis()->setHasAnimationBlock(
527
+ [weakModule](int tag, int type) {
528
+ auto module = weakModule.lock();
529
+ if (module == nullptr) {
530
+ return false;
531
+ }
532
+
533
+ return module->layoutAnimationsManager().hasLayoutAnimation(
534
+ tag, static_cast<LayoutAnimationType>(type));
535
+ });
536
+
537
+ layoutAnimations_->cthis()->setClearAnimationConfigBlock(
538
+ [weakModule](int tag) {
539
+ auto module = weakModule.lock();
540
+ if (module == nullptr) {
541
+ return;
542
+ }
543
+
544
+ module->layoutAnimationsManager().clearLayoutAnimationConfig(tag);
545
+ });
546
+
547
+ layoutAnimations_->cthis()->setCancelAnimationForTag(
548
+ [weakModule](int tag, int type, jboolean cancelled, jboolean removeView) {
549
+ if (auto module = weakModule.lock()) {
550
+ jsi::Runtime &rt = *module->runtime;
551
+ module->layoutAnimationsManager().cancelLayoutAnimation(
552
+ rt,
553
+ tag,
554
+ static_cast<LayoutAnimationType>(type),
555
+ cancelled,
556
+ removeView);
557
+ }
558
+ });
559
+
560
+ layoutAnimations_->cthis()->setFindPrecedingViewTagForTransition(
561
+ [weakModule](int tag) {
562
+ if (auto module = weakModule.lock()) {
563
+ return module->layoutAnimationsManager()
564
+ .findPrecedingViewTagForTransition(tag);
565
+ } else {
566
+ return -1;
567
+ }
568
+ });
569
+ }
570
+
592
571
  } // namespace reanimated