react-native-reanimated 3.0.0-rc.0 → 3.0.0-rc.10

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 (797) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +35 -37
  2. package/Common/cpp/{headers/AnimatedSensor → AnimatedSensor}/AnimatedSensorModule.h +4 -3
  3. package/Common/cpp/Fabric/FabricUtils.cpp +8 -102
  4. package/Common/cpp/{headers/Fabric → Fabric}/FabricUtils.h +4 -24
  5. package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +87 -45
  6. package/Common/cpp/{headers/Fabric → Fabric}/ReanimatedUIManagerBinding.h +1 -0
  7. package/Common/cpp/Fabric/ShadowTreeCloner.cpp +92 -0
  8. package/Common/cpp/Fabric/ShadowTreeCloner.h +41 -0
  9. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +76 -0
  10. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +41 -0
  11. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +215 -176
  12. package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModule.h +51 -28
  13. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +59 -29
  14. package/Common/cpp/{headers/NativeModules → NativeModules}/NativeReanimatedModuleSpec.h +28 -13
  15. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +138 -0
  16. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +134 -0
  17. package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +55 -0
  18. package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.h +28 -0
  19. package/Common/cpp/ReanimatedRuntime/RuntimeInitialization.md +194 -0
  20. package/Common/cpp/{headers/Registries → Registries}/EventHandlerRegistry.h +0 -0
  21. package/Common/cpp/{headers/Registries → Registries}/NewestShadowNodesRegistry.h +0 -0
  22. package/Common/cpp/{headers/SharedItems → SharedItems}/RuntimeManager.h +1 -34
  23. package/Common/cpp/SharedItems/Shareables.cpp +144 -0
  24. package/Common/cpp/SharedItems/Shareables.h +470 -0
  25. package/Common/cpp/{headers/SharedItems → SharedItems}/SharedParent.h +0 -0
  26. package/Common/cpp/{headers/SpecTools → SpecTools}/ErrorHandler.h +0 -0
  27. package/Common/cpp/{headers/Tools → Tools}/FeaturesConfig.h +0 -0
  28. package/Common/cpp/{headers/Tools → Tools}/PlatformDepMethodsHolder.h +11 -0
  29. package/Common/cpp/{headers/Tools → Tools}/ReanimatedHiddenHeaders.h +1 -1
  30. package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
  31. package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
  32. package/Common/cpp/Tools/RuntimeDecorator.cpp +95 -59
  33. package/Common/cpp/{headers/Tools → Tools}/RuntimeDecorator.h +13 -3
  34. package/Common/cpp/Tools/Scheduler.cpp +10 -0
  35. package/Common/cpp/{headers/Tools → Tools}/Scheduler.h +0 -0
  36. package/Common/cpp/Tools/SingleInstanceChecker.h +58 -0
  37. package/Common/cpp/{headers/Tools → Tools}/WorkletEventHandler.h +0 -0
  38. package/RNReanimated.podspec +23 -64
  39. package/android/CMakeLists.txt +233 -223
  40. package/android/build.gradle +800 -287
  41. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  42. package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +51 -33
  43. package/android/src/main/cpp/AndroidErrorHandler.cpp +3 -4
  44. package/android/src/main/cpp/{headers/AndroidErrorHandler.h → AndroidErrorHandler.h} +1 -4
  45. package/android/src/main/cpp/AndroidLogger.cpp +4 -1
  46. package/android/src/main/cpp/{headers/AndroidLogger.h → AndroidLogger.h} +0 -0
  47. package/android/src/main/cpp/{headers/AndroidScheduler.h → AndroidScheduler.h} +0 -0
  48. package/android/src/main/cpp/{headers/JNIHelper.h → JNIHelper.h} +0 -0
  49. package/android/src/main/cpp/LayoutAnimations.cpp +39 -57
  50. package/android/src/main/cpp/LayoutAnimations.h +56 -0
  51. package/android/src/main/cpp/NativeProxy.cpp +107 -49
  52. package/android/src/main/cpp/{headers/NativeProxy.h → NativeProxy.h} +33 -2
  53. package/android/src/main/cpp/OnLoad.cpp +1 -0
  54. package/android/src/main/cpp/{headers/TurboModule.h → TurboModule.h} +0 -0
  55. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +4 -2
  56. package/android/src/main/java/com/swmansion/reanimated/ReanimatedMessageQueueThreadBase.java +72 -0
  57. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
  58. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +166 -0
  59. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +240 -219
  60. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +7 -5
  61. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +5 -3
  62. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/ViewHierarchyObserver.java +1 -1
  63. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +5 -1
  64. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +1 -1
  65. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +24 -1
  66. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorType.java +7 -5
  67. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +52 -14
  68. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
  69. package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +1 -1
  70. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
  71. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
  72. package/android/{rnVersionPatch/62 → src/reactNativeVersionPatch/UIImplementation/64/com/swmansion/reanimated}/layoutReanimation/ReanimatedUIImplementation.java +0 -0
  73. package/android/src/{main/java → reactNativeVersionPatch/UIImplementation/latest}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIImplementation.java +0 -0
  74. package/android/src/reactNativeVersionPatch/messageQueueThread/67/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +12 -0
  75. package/android/src/reactNativeVersionPatch/messageQueueThread/latest/com/swmansion/reanimated/ReanimatedMessageQueueThread.java +12 -0
  76. package/android/{rnVersionPatch/62 → src/reactNativeVersionPatch/nativeHierarchyManager/62/com/swmansion/reanimated}/layoutReanimation/ReanimatedNativeHierarchyManager.java +8 -44
  77. package/android/src/{main/java → reactNativeVersionPatch/nativeHierarchyManager/latest}/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +23 -91
  78. package/ios/LayoutReanimation/REAAnimationsManager.h +20 -8
  79. package/ios/LayoutReanimation/REAAnimationsManager.m +251 -160
  80. package/ios/LayoutReanimation/REAUIManager.mm +36 -83
  81. package/ios/REAModule.mm +36 -6
  82. package/ios/REANodesManager.mm +31 -8
  83. package/ios/keyboardObserver/REAKeyboardEventObserver.h +17 -0
  84. package/ios/keyboardObserver/REAKeyboardEventObserver.m +198 -0
  85. package/ios/native/NativeProxy.mm +79 -143
  86. package/ios/native/REAInitializer.h +2 -2
  87. package/ios/native/REAInitializer.mm +6 -2
  88. package/ios/native/REAJSIUtils.h +66 -0
  89. package/ios/native/REAMessageThread.h +22 -0
  90. package/ios/native/REAMessageThread.mm +38 -0
  91. package/ios/native/UIResponder+Reanimated.mm +1 -1
  92. package/ios/sensor/ReanimatedSensor.m +27 -18
  93. package/lib/commonjs/Animated.js +70 -0
  94. package/lib/commonjs/Animated.js.map +1 -0
  95. package/lib/commonjs/ConfigHelper.js +173 -0
  96. package/lib/commonjs/ConfigHelper.js.map +1 -0
  97. package/lib/commonjs/createAnimatedComponent.js +473 -0
  98. package/lib/commonjs/createAnimatedComponent.js.map +1 -0
  99. package/lib/commonjs/index.js +44 -0
  100. package/lib/commonjs/index.js.map +1 -0
  101. package/lib/commonjs/index.web.js +32 -0
  102. package/lib/commonjs/index.web.js.map +1 -0
  103. package/lib/commonjs/reanimated2/Bezier.js +166 -0
  104. package/lib/commonjs/reanimated2/Bezier.js.map +1 -0
  105. package/lib/commonjs/reanimated2/Colors.js +694 -0
  106. package/lib/commonjs/reanimated2/Colors.js.map +1 -0
  107. package/lib/{reanimated2 → commonjs/reanimated2}/Easing.js +151 -83
  108. package/lib/commonjs/reanimated2/Easing.js.map +1 -0
  109. package/lib/commonjs/reanimated2/NativeMethods.js +136 -0
  110. package/lib/commonjs/reanimated2/NativeMethods.js.map +1 -0
  111. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +108 -0
  112. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -0
  113. package/lib/commonjs/reanimated2/NativeReanimated/index.js +26 -0
  114. package/lib/commonjs/reanimated2/NativeReanimated/index.js.map +1 -0
  115. package/lib/commonjs/reanimated2/PlatformChecker.js +33 -0
  116. package/lib/commonjs/reanimated2/PlatformChecker.js.map +1 -0
  117. package/lib/commonjs/reanimated2/PropAdapters.js +68 -0
  118. package/lib/commonjs/reanimated2/PropAdapters.js.map +1 -0
  119. package/lib/commonjs/reanimated2/UpdateProps.js +82 -0
  120. package/lib/commonjs/reanimated2/UpdateProps.js.map +1 -0
  121. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js +68 -0
  122. package/lib/commonjs/reanimated2/ViewDescriptorsSet.js.map +1 -0
  123. package/lib/commonjs/reanimated2/WorkletEventHandler.js +77 -0
  124. package/lib/commonjs/reanimated2/WorkletEventHandler.js.map +1 -0
  125. package/lib/commonjs/reanimated2/animation/commonTypes.js +6 -0
  126. package/lib/commonjs/reanimated2/animation/commonTypes.js.map +1 -0
  127. package/lib/commonjs/reanimated2/animation/decay.js +132 -0
  128. package/lib/commonjs/reanimated2/animation/decay.js.map +1 -0
  129. package/lib/commonjs/reanimated2/animation/delay.js +77 -0
  130. package/lib/commonjs/reanimated2/animation/delay.js.map +1 -0
  131. package/lib/commonjs/reanimated2/animation/index.js +82 -0
  132. package/lib/commonjs/reanimated2/animation/index.js.map +1 -0
  133. package/lib/commonjs/reanimated2/animation/repeat.js +83 -0
  134. package/lib/commonjs/reanimated2/animation/repeat.js.map +1 -0
  135. package/lib/commonjs/reanimated2/animation/sequence.js +91 -0
  136. package/lib/commonjs/reanimated2/animation/sequence.js.map +1 -0
  137. package/lib/commonjs/reanimated2/animation/spring.js +121 -0
  138. package/lib/commonjs/reanimated2/animation/spring.js.map +1 -0
  139. package/lib/commonjs/reanimated2/animation/styleAnimation.js +206 -0
  140. package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -0
  141. package/lib/commonjs/reanimated2/animation/timing.js +82 -0
  142. package/lib/commonjs/reanimated2/animation/timing.js.map +1 -0
  143. package/lib/commonjs/reanimated2/animation/util.js +233 -0
  144. package/lib/commonjs/reanimated2/animation/util.js.map +1 -0
  145. package/lib/commonjs/reanimated2/commonTypes.js +24 -0
  146. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -0
  147. package/lib/commonjs/reanimated2/component/FlatList.js +69 -0
  148. package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -0
  149. package/lib/commonjs/reanimated2/component/Image.js +17 -0
  150. package/lib/commonjs/reanimated2/component/Image.js.map +1 -0
  151. package/lib/commonjs/reanimated2/component/ScrollView.js +17 -0
  152. package/lib/commonjs/reanimated2/component/ScrollView.js.map +1 -0
  153. package/lib/commonjs/reanimated2/component/Text.js +17 -0
  154. package/lib/commonjs/reanimated2/component/Text.js.map +1 -0
  155. package/lib/commonjs/reanimated2/component/View.js +17 -0
  156. package/lib/commonjs/reanimated2/component/View.js.map +1 -0
  157. package/lib/commonjs/reanimated2/core.js +194 -0
  158. package/lib/commonjs/reanimated2/core.js.map +1 -0
  159. package/lib/commonjs/reanimated2/errors.js +66 -0
  160. package/lib/commonjs/reanimated2/errors.js.map +1 -0
  161. package/lib/commonjs/reanimated2/fabricUtils.js +27 -0
  162. package/lib/commonjs/reanimated2/fabricUtils.js.map +1 -0
  163. package/lib/commonjs/reanimated2/fabricUtils.web.js +21 -0
  164. package/lib/commonjs/reanimated2/fabricUtils.web.js.map +1 -0
  165. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js +55 -0
  166. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -0
  167. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +96 -0
  168. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -0
  169. package/lib/commonjs/reanimated2/globals.d.js +6 -0
  170. package/lib/commonjs/reanimated2/globals.d.js.map +1 -0
  171. package/lib/commonjs/reanimated2/hook/Hooks.js +35 -0
  172. package/lib/commonjs/reanimated2/hook/Hooks.js.map +1 -0
  173. package/lib/commonjs/reanimated2/hook/commonTypes.js +6 -0
  174. package/lib/commonjs/reanimated2/hook/commonTypes.js.map +1 -0
  175. package/lib/commonjs/reanimated2/hook/index.js +126 -0
  176. package/lib/commonjs/reanimated2/hook/index.js.map +1 -0
  177. package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js +66 -0
  178. package/lib/commonjs/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -0
  179. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +54 -0
  180. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -0
  181. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +44 -0
  182. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -0
  183. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +53 -0
  184. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -0
  185. package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js +62 -0
  186. package/lib/commonjs/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -0
  187. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +85 -0
  188. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -0
  189. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +435 -0
  190. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -0
  191. package/lib/commonjs/reanimated2/hook/useDerivedValue.js +49 -0
  192. package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -0
  193. package/lib/commonjs/reanimated2/hook/useFrameCallback.js +36 -0
  194. package/lib/commonjs/reanimated2/hook/useFrameCallback.js.map +1 -0
  195. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +33 -0
  196. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -0
  197. package/lib/commonjs/reanimated2/hook/useSharedValue.js +31 -0
  198. package/lib/commonjs/reanimated2/hook/useSharedValue.js.map +1 -0
  199. package/lib/commonjs/reanimated2/hook/utils.js +247 -0
  200. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -0
  201. package/lib/commonjs/reanimated2/index.js +162 -0
  202. package/lib/commonjs/reanimated2/index.js.map +1 -0
  203. package/lib/commonjs/reanimated2/initializers.js +157 -0
  204. package/lib/commonjs/reanimated2/initializers.js.map +1 -0
  205. package/lib/commonjs/reanimated2/interpolateColor.js +231 -0
  206. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -0
  207. package/lib/commonjs/reanimated2/interpolation.js +143 -0
  208. package/lib/commonjs/reanimated2/interpolation.js.map +1 -0
  209. package/lib/commonjs/reanimated2/jestUtils.js +222 -0
  210. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -0
  211. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +71 -0
  212. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -0
  213. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +74 -0
  214. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -0
  215. package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js +146 -0
  216. package/lib/commonjs/reanimated2/js-reanimated/MapperRegistry.js.map +1 -0
  217. package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js +57 -0
  218. package/lib/commonjs/reanimated2/js-reanimated/MutableValue.js.map +1 -0
  219. package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js +6 -0
  220. package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -0
  221. package/lib/commonjs/reanimated2/js-reanimated/global.js +54 -0
  222. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -0
  223. package/lib/commonjs/reanimated2/js-reanimated/index.js +62 -0
  224. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -0
  225. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +100 -0
  226. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -0
  227. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +203 -0
  228. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -0
  229. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +244 -0
  230. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -0
  231. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +6 -0
  232. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -0
  233. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +30 -0
  234. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -0
  235. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +87 -0
  236. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
  237. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +563 -0
  238. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -0
  239. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js +409 -0
  240. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -0
  241. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js +559 -0
  242. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -0
  243. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +215 -0
  244. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -0
  245. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +101 -0
  246. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -0
  247. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +183 -0
  248. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -0
  249. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +403 -0
  250. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -0
  251. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +291 -0
  252. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -0
  253. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +167 -0
  254. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -0
  255. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +693 -0
  256. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -0
  257. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js +136 -0
  258. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -0
  259. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +120 -0
  260. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -0
  261. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +180 -0
  262. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -0
  263. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +66 -0
  264. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -0
  265. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +64 -0
  266. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -0
  267. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +52 -0
  268. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -0
  269. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +68 -0
  270. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -0
  271. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js +84 -0
  272. package/lib/commonjs/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -0
  273. package/lib/commonjs/reanimated2/layoutReanimation/index.js +47 -0
  274. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -0
  275. package/lib/commonjs/reanimated2/mappers.js +186 -0
  276. package/lib/commonjs/reanimated2/mappers.js.map +1 -0
  277. package/lib/commonjs/reanimated2/mock.js +114 -0
  278. package/lib/commonjs/reanimated2/mock.js.map +1 -0
  279. package/lib/commonjs/reanimated2/mutables.js +173 -0
  280. package/lib/commonjs/reanimated2/mutables.js.map +1 -0
  281. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js +16 -0
  282. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.js.map +1 -0
  283. package/lib/{reanimated2 → commonjs/reanimated2}/platform-specific/RNRenderer.web.js +2 -0
  284. package/lib/commonjs/reanimated2/platform-specific/RNRenderer.web.js.map +1 -0
  285. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +33 -0
  286. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
  287. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
  288. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  289. package/lib/commonjs/reanimated2/shareables.js +159 -0
  290. package/lib/commonjs/reanimated2/shareables.js.map +1 -0
  291. package/lib/commonjs/reanimated2/threads.js +68 -0
  292. package/lib/commonjs/reanimated2/threads.js.map +1 -0
  293. package/lib/commonjs/reanimated2/time.js +55 -0
  294. package/lib/commonjs/reanimated2/time.js.map +1 -0
  295. package/lib/commonjs/reanimated2/utils.js +28 -0
  296. package/lib/commonjs/reanimated2/utils.js.map +1 -0
  297. package/lib/commonjs/reanimated2/valueSetter.js +81 -0
  298. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -0
  299. package/lib/commonjs/setAndForwardRef.js +63 -0
  300. package/lib/commonjs/setAndForwardRef.js.map +1 -0
  301. package/lib/module/Animated.js +8 -0
  302. package/lib/module/Animated.js.map +1 -0
  303. package/lib/module/ConfigHelper.js +161 -0
  304. package/lib/module/ConfigHelper.js.map +1 -0
  305. package/lib/module/createAnimatedComponent.js +451 -0
  306. package/lib/module/createAnimatedComponent.js.map +1 -0
  307. package/lib/module/index.js +15 -0
  308. package/lib/module/index.js.map +1 -0
  309. package/lib/module/index.web.js +6 -0
  310. package/lib/module/index.web.js.map +1 -0
  311. package/lib/module/reanimated2/Bezier.js +159 -0
  312. package/lib/module/reanimated2/Bezier.js.map +1 -0
  313. package/lib/module/reanimated2/Colors.js +648 -0
  314. package/lib/module/reanimated2/Colors.js.map +1 -0
  315. package/lib/{types/reanimated2/Easing.d.ts → module/reanimated2/Easing.js} +179 -40
  316. package/lib/module/reanimated2/Easing.js.map +1 -0
  317. package/lib/module/reanimated2/NativeMethods.js +120 -0
  318. package/lib/module/reanimated2/NativeMethods.js.map +1 -0
  319. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +97 -0
  320. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -0
  321. package/lib/{reanimated2 → module/reanimated2}/NativeReanimated/index.js +6 -4
  322. package/lib/module/reanimated2/NativeReanimated/index.js.map +1 -0
  323. package/lib/module/reanimated2/PlatformChecker.js +17 -0
  324. package/lib/module/reanimated2/PlatformChecker.js.map +1 -0
  325. package/lib/module/reanimated2/PropAdapters.js +56 -0
  326. package/lib/module/reanimated2/PropAdapters.js.map +1 -0
  327. package/lib/module/reanimated2/UpdateProps.js +64 -0
  328. package/lib/module/reanimated2/UpdateProps.js.map +1 -0
  329. package/lib/module/reanimated2/ViewDescriptorsSet.js +57 -0
  330. package/lib/module/reanimated2/ViewDescriptorsSet.js.map +1 -0
  331. package/lib/module/reanimated2/WorkletEventHandler.js +65 -0
  332. package/lib/module/reanimated2/WorkletEventHandler.js.map +1 -0
  333. package/lib/module/reanimated2/animation/commonTypes.js +2 -0
  334. package/lib/module/reanimated2/animation/commonTypes.js.map +1 -0
  335. package/lib/module/reanimated2/animation/decay.js +123 -0
  336. package/lib/module/reanimated2/animation/decay.js.map +1 -0
  337. package/lib/module/reanimated2/animation/delay.js +69 -0
  338. package/lib/module/reanimated2/animation/delay.js.map +1 -0
  339. package/lib/{reanimated2 → module/reanimated2}/animation/index.js +1 -0
  340. package/lib/module/reanimated2/animation/index.js.map +1 -0
  341. package/lib/module/reanimated2/animation/repeat.js +75 -0
  342. package/lib/module/reanimated2/animation/repeat.js.map +1 -0
  343. package/lib/module/reanimated2/animation/sequence.js +83 -0
  344. package/lib/module/reanimated2/animation/sequence.js.map +1 -0
  345. package/lib/module/reanimated2/animation/spring.js +113 -0
  346. package/lib/module/reanimated2/animation/spring.js.map +1 -0
  347. package/lib/module/reanimated2/animation/styleAnimation.js +191 -0
  348. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -0
  349. package/lib/module/reanimated2/animation/timing.js +73 -0
  350. package/lib/module/reanimated2/animation/timing.js.map +1 -0
  351. package/lib/module/reanimated2/animation/util.js +216 -0
  352. package/lib/module/reanimated2/animation/util.js.map +1 -0
  353. package/lib/module/reanimated2/commonTypes.js +17 -0
  354. package/lib/module/reanimated2/commonTypes.js.map +1 -0
  355. package/lib/module/reanimated2/component/FlatList.js +47 -0
  356. package/lib/module/reanimated2/component/FlatList.js.map +1 -0
  357. package/lib/module/reanimated2/component/Image.js +5 -0
  358. package/lib/module/reanimated2/component/Image.js.map +1 -0
  359. package/lib/module/reanimated2/component/ScrollView.js +5 -0
  360. package/lib/module/reanimated2/component/ScrollView.js.map +1 -0
  361. package/lib/module/reanimated2/component/Text.js +5 -0
  362. package/lib/module/reanimated2/component/Text.js.map +1 -0
  363. package/lib/module/reanimated2/component/View.js +5 -0
  364. package/lib/module/reanimated2/component/View.js.map +1 -0
  365. package/lib/module/reanimated2/core.js +119 -0
  366. package/lib/module/reanimated2/core.js.map +1 -0
  367. package/lib/module/reanimated2/errors.js +58 -0
  368. package/lib/module/reanimated2/errors.js.map +1 -0
  369. package/lib/module/reanimated2/fabricUtils.js +18 -0
  370. package/lib/module/reanimated2/fabricUtils.js.map +1 -0
  371. package/lib/module/reanimated2/fabricUtils.web.js +12 -0
  372. package/lib/module/reanimated2/fabricUtils.web.js.map +1 -0
  373. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js +44 -0
  374. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryJS.js.map +1 -0
  375. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +87 -0
  376. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -0
  377. package/lib/module/reanimated2/globals.d.js +2 -0
  378. package/lib/module/reanimated2/globals.d.js.map +1 -0
  379. package/lib/{reanimated2 → module/reanimated2}/hook/Hooks.js +4 -3
  380. package/lib/module/reanimated2/hook/Hooks.js.map +1 -0
  381. package/lib/module/reanimated2/hook/commonTypes.js +2 -0
  382. package/lib/module/reanimated2/hook/commonTypes.js.map +1 -0
  383. package/lib/module/reanimated2/hook/index.js +13 -0
  384. package/lib/module/reanimated2/hook/index.js.map +1 -0
  385. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js +56 -0
  386. package/lib/module/reanimated2/hook/useAnimatedGestureHandler.js.map +1 -0
  387. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +44 -0
  388. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -0
  389. package/lib/module/reanimated2/hook/useAnimatedReaction.js +35 -0
  390. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -0
  391. package/lib/module/reanimated2/hook/useAnimatedRef.js +41 -0
  392. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -0
  393. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js +54 -0
  394. package/lib/module/reanimated2/hook/useAnimatedScrollHandler.js.map +1 -0
  395. package/lib/module/reanimated2/hook/useAnimatedSensor.js +74 -0
  396. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -0
  397. package/lib/module/reanimated2/hook/useAnimatedStyle.js +414 -0
  398. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -0
  399. package/lib/module/reanimated2/hook/useDerivedValue.js +39 -0
  400. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -0
  401. package/lib/module/reanimated2/hook/useFrameCallback.js +24 -0
  402. package/lib/module/reanimated2/hook/useFrameCallback.js.map +1 -0
  403. package/lib/module/reanimated2/hook/useScrollViewOffset.js +21 -0
  404. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -0
  405. package/lib/module/reanimated2/hook/useSharedValue.js +21 -0
  406. package/lib/module/reanimated2/hook/useSharedValue.js.map +1 -0
  407. package/lib/module/reanimated2/hook/utils.js +208 -0
  408. package/lib/module/reanimated2/hook/utils.js.map +1 -0
  409. package/lib/{reanimated2 → module/reanimated2}/index.js +1 -0
  410. package/lib/module/reanimated2/index.js.map +1 -0
  411. package/lib/module/reanimated2/initializers.js +143 -0
  412. package/lib/module/reanimated2/initializers.js.map +1 -0
  413. package/lib/module/reanimated2/interpolateColor.js +212 -0
  414. package/lib/module/reanimated2/interpolateColor.js.map +1 -0
  415. package/lib/module/reanimated2/interpolation.js +135 -0
  416. package/lib/module/reanimated2/interpolation.js.map +1 -0
  417. package/lib/module/reanimated2/jestUtils.js +202 -0
  418. package/lib/module/reanimated2/jestUtils.js.map +1 -0
  419. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +60 -0
  420. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -0
  421. package/lib/module/reanimated2/js-reanimated/Mapper.js +62 -0
  422. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -0
  423. package/lib/module/reanimated2/js-reanimated/MapperRegistry.js +137 -0
  424. package/lib/module/reanimated2/js-reanimated/MapperRegistry.js.map +1 -0
  425. package/lib/module/reanimated2/js-reanimated/MutableValue.js +48 -0
  426. package/lib/module/reanimated2/js-reanimated/MutableValue.js.map +1 -0
  427. package/lib/module/reanimated2/js-reanimated/commonTypes.js +2 -0
  428. package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -0
  429. package/lib/module/reanimated2/js-reanimated/global.js +45 -0
  430. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -0
  431. package/lib/module/reanimated2/js-reanimated/index.js +48 -0
  432. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -0
  433. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +90 -0
  434. package/lib/module/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js.map +1 -0
  435. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +192 -0
  436. package/lib/module/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js.map +1 -0
  437. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +233 -0
  438. package/lib/module/reanimated2/layoutReanimation/animationBuilder/Keyframe.js.map +1 -0
  439. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +2 -0
  440. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -0
  441. package/lib/{reanimated2 → module/reanimated2}/layoutReanimation/animationBuilder/index.js +1 -0
  442. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -0
  443. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +82 -0
  444. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -0
  445. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +525 -0
  446. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -0
  447. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js +372 -0
  448. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Fade.js.map +1 -0
  449. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js +516 -0
  450. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Flip.js.map +1 -0
  451. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +195 -0
  452. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -0
  453. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +88 -0
  454. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js.map +1 -0
  455. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +164 -0
  456. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -0
  457. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +372 -0
  458. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Rotate.js.map +1 -0
  459. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +260 -0
  460. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -0
  461. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +148 -0
  462. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Stretch.js.map +1 -0
  463. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +638 -0
  464. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -0
  465. package/lib/{reanimated2 → module/reanimated2}/layoutReanimation/defaultAnimations/index.js +1 -0
  466. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/index.js.map +1 -0
  467. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +108 -0
  468. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js.map +1 -0
  469. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +166 -0
  470. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js.map +1 -0
  471. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +55 -0
  472. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js.map +1 -0
  473. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +52 -0
  474. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js.map +1 -0
  475. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +41 -0
  476. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js.map +1 -0
  477. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +57 -0
  478. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js.map +1 -0
  479. package/lib/{reanimated2 → module/reanimated2}/layoutReanimation/defaultTransitions/index.js +1 -0
  480. package/lib/module/reanimated2/layoutReanimation/defaultTransitions/index.js.map +1 -0
  481. package/lib/{reanimated2 → module/reanimated2}/layoutReanimation/index.js +2 -1
  482. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -0
  483. package/lib/module/reanimated2/mappers.js +173 -0
  484. package/lib/module/reanimated2/mappers.js.map +1 -0
  485. package/lib/module/reanimated2/mock.js +112 -0
  486. package/lib/module/reanimated2/mock.js.map +1 -0
  487. package/lib/module/reanimated2/mutables.js +149 -0
  488. package/lib/module/reanimated2/mutables.js.map +1 -0
  489. package/lib/{reanimated2 → module/reanimated2}/platform-specific/RNRenderer.js +1 -0
  490. package/lib/module/reanimated2/platform-specific/RNRenderer.js.map +1 -0
  491. package/lib/module/reanimated2/platform-specific/RNRenderer.web.js +3 -0
  492. package/lib/module/reanimated2/platform-specific/RNRenderer.web.js.map +1 -0
  493. package/lib/module/reanimated2/platform-specific/checkVersion.js +25 -0
  494. package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
  495. package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
  496. package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  497. package/lib/module/reanimated2/shareables.js +138 -0
  498. package/lib/module/reanimated2/shareables.js.map +1 -0
  499. package/lib/module/reanimated2/threads.js +56 -0
  500. package/lib/module/reanimated2/threads.js.map +1 -0
  501. package/lib/module/reanimated2/time.js +37 -0
  502. package/lib/module/reanimated2/time.js.map +1 -0
  503. package/lib/module/reanimated2/utils.js +21 -0
  504. package/lib/module/reanimated2/utils.js.map +1 -0
  505. package/lib/module/reanimated2/valueSetter.js +66 -0
  506. package/lib/module/reanimated2/valueSetter.js.map +1 -0
  507. package/lib/{types/setAndForwardRef.d.ts → module/setAndForwardRef.js} +21 -6
  508. package/lib/module/setAndForwardRef.js.map +1 -0
  509. package/mock.js +1 -0
  510. package/package.json +40 -28
  511. package/plugin.js +200 -62
  512. package/react-native-reanimated.d.ts +81 -18
  513. package/scripts/reanimated_utils.rb +81 -0
  514. package/src/Animated.ts +11 -0
  515. package/src/createAnimatedComponent.tsx +44 -44
  516. package/src/index.ts +13 -0
  517. package/src/index.web.ts +5 -0
  518. package/src/reanimated2/Colors.ts +39 -12
  519. package/src/reanimated2/NativeMethods.ts +91 -39
  520. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +61 -43
  521. package/src/reanimated2/ViewDescriptorsSet.ts +30 -69
  522. package/src/reanimated2/WorkletEventHandler.ts +4 -11
  523. package/src/reanimated2/animation/decay.ts +79 -30
  524. package/src/reanimated2/animation/delay.ts +0 -12
  525. package/src/reanimated2/animation/index.ts +7 -4
  526. package/src/reanimated2/animation/repeat.ts +0 -25
  527. package/src/reanimated2/animation/sequence.ts +0 -18
  528. package/src/reanimated2/animation/util.ts +35 -16
  529. package/src/reanimated2/commonTypes.ts +51 -4
  530. package/src/reanimated2/component/FlatList.tsx +51 -22
  531. package/src/reanimated2/component/Image.ts +6 -0
  532. package/src/reanimated2/component/ScrollView.ts +6 -0
  533. package/src/reanimated2/component/Text.ts +6 -0
  534. package/src/reanimated2/component/View.ts +6 -0
  535. package/src/reanimated2/core.ts +87 -273
  536. package/src/reanimated2/errors.ts +57 -0
  537. package/src/reanimated2/fabricUtils.web.ts +19 -0
  538. package/src/reanimated2/frameCallback/FrameCallbackRegistryJS.ts +40 -0
  539. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +115 -0
  540. package/src/reanimated2/globals.d.ts +96 -26
  541. package/src/reanimated2/hook/index.ts +15 -14
  542. package/src/reanimated2/hook/useAnimatedKeyboard.ts +44 -0
  543. package/src/reanimated2/hook/useAnimatedRef.ts +27 -9
  544. package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -1
  545. package/src/reanimated2/hook/useAnimatedSensor.ts +37 -35
  546. package/src/reanimated2/hook/useAnimatedStyle.ts +26 -74
  547. package/src/reanimated2/hook/useFrameCallback.ts +40 -0
  548. package/src/reanimated2/hook/useScrollViewOffset.ts +37 -0
  549. package/src/reanimated2/hook/useSharedValue.ts +6 -3
  550. package/src/reanimated2/hook/utils.ts +1 -1
  551. package/src/reanimated2/initializers.ts +143 -0
  552. package/src/reanimated2/interpolateColor.ts +106 -22
  553. package/src/reanimated2/jestUtils.ts +33 -32
  554. package/src/reanimated2/js-reanimated/JSReanimated.ts +32 -87
  555. package/src/reanimated2/js-reanimated/global.ts +47 -0
  556. package/src/reanimated2/js-reanimated/index.ts +4 -36
  557. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +11 -0
  558. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +2 -1
  559. package/src/reanimated2/layoutReanimation/animationsManager.ts +91 -0
  560. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
  561. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
  562. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
  563. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
  564. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
  565. package/src/reanimated2/layoutReanimation/index.ts +1 -1
  566. package/src/reanimated2/mappers.ts +179 -0
  567. package/src/reanimated2/mock.ts +111 -0
  568. package/src/reanimated2/mutables.ts +151 -0
  569. package/src/reanimated2/platform-specific/checkVersion.ts +28 -0
  570. package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
  571. package/src/reanimated2/shareables.ts +128 -0
  572. package/src/reanimated2/threads.ts +58 -0
  573. package/src/reanimated2/time.ts +30 -0
  574. package/src/reanimated2/utils.ts +12 -5
  575. package/src/reanimated2/valueSetter.ts +64 -0
  576. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +0 -43
  577. package/Common/cpp/Registries/MapperRegistry.cpp +0 -145
  578. package/Common/cpp/Registries/WorkletsCache.cpp +0 -38
  579. package/Common/cpp/SharedItems/FrozenObject.cpp +0 -35
  580. package/Common/cpp/SharedItems/MutableValue.cpp +0 -132
  581. package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +0 -47
  582. package/Common/cpp/SharedItems/RemoteObject.cpp +0 -45
  583. package/Common/cpp/SharedItems/ShareableValue.cpp +0 -525
  584. package/Common/cpp/Tools/JSIStoreValueUser.cpp +0 -55
  585. package/Common/cpp/Tools/Mapper.cpp +0 -86
  586. package/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +0 -32
  587. package/Common/cpp/headers/Registries/MapperRegistry.h +0 -29
  588. package/Common/cpp/headers/Registries/WorkletsCache.h +0 -24
  589. package/Common/cpp/headers/SharedItems/FrozenObject.h +0 -36
  590. package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +0 -28
  591. package/Common/cpp/headers/SharedItems/MutableValue.h +0 -54
  592. package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +0 -25
  593. package/Common/cpp/headers/SharedItems/RemoteObject.h +0 -35
  594. package/Common/cpp/headers/SharedItems/ShareableValue.h +0 -63
  595. package/Common/cpp/headers/SharedItems/ValueWrapper.h +0 -183
  596. package/Common/cpp/headers/Tools/JSIStoreValueUser.h +0 -37
  597. package/Common/cpp/headers/Tools/Mapper.h +0 -51
  598. package/android/local.properties +0 -1
  599. package/android/rnVersionPatch/63/layoutReanimation/ReanimatedUIImplementation.java +0 -68
  600. package/android/rnVersionPatch/64/layoutReanimation/ReanimatedUIImplementation.java +0 -68
  601. package/android/rnVersionPatch/65/.gitkeep +0 -0
  602. package/android/rnVersionPatch/66/.gitkeep +0 -0
  603. package/android/rnVersionPatch/67/.gitkeep +0 -0
  604. package/android/rnVersionPatch/68/.gitkeep +0 -0
  605. package/android/rnVersionPatch/backup/.gitkeep +0 -0
  606. package/android/src/main/cpp/headers/LayoutAnimations.h +0 -42
  607. package/android/src/main/java/com/swmansion/reanimated/AndroidErrorHandler.java +0 -8
  608. package/android/src/main/java/com/swmansion/reanimated/ReanimatedJSIModulePackage.java +0 -29
  609. package/lib/Animated.js +0 -18
  610. package/lib/ConfigHelper.js +0 -145
  611. package/lib/ReanimatedEventEmitter.js +0 -3
  612. package/lib/ReanimatedModule.js +0 -2
  613. package/lib/ReanimatedModule.macos.js +0 -2
  614. package/lib/ReanimatedModule.native.js +0 -12
  615. package/lib/ReanimatedModule.windows.js +0 -2
  616. package/lib/ReanimatedModuleCompat.js +0 -66
  617. package/lib/__mocks__/ReanimatedEventEmitter.js +0 -8
  618. package/lib/__mocks__/ReanimatedModule.native.js +0 -11
  619. package/lib/createAnimatedComponent.js +0 -375
  620. package/lib/index.js +0 -18
  621. package/lib/reanimated2/Bezier.js +0 -126
  622. package/lib/reanimated2/Colors.js +0 -522
  623. package/lib/reanimated2/NativeMethods.js +0 -59
  624. package/lib/reanimated2/NativeReanimated/NativeReanimated.js +0 -50
  625. package/lib/reanimated2/PlatformChecker.js +0 -16
  626. package/lib/reanimated2/PropAdapters.js +0 -55
  627. package/lib/reanimated2/UpdateProps.js +0 -70
  628. package/lib/reanimated2/ViewDescriptorsSet.js +0 -75
  629. package/lib/reanimated2/WorkletEventHandler.js +0 -37
  630. package/lib/reanimated2/__mocks__/MutableValue.js +0 -13
  631. package/lib/reanimated2/__mocks__/NativeReanimated.js +0 -20
  632. package/lib/reanimated2/__mocks__/NativeReanimated.native.js +0 -20
  633. package/lib/reanimated2/animation/commonTypes.js +0 -1
  634. package/lib/reanimated2/animation/decay.js +0 -71
  635. package/lib/reanimated2/animation/delay.js +0 -64
  636. package/lib/reanimated2/animation/repeat.js +0 -69
  637. package/lib/reanimated2/animation/sequence.js +0 -72
  638. package/lib/reanimated2/animation/spring.js +0 -103
  639. package/lib/reanimated2/animation/styleAnimation.js +0 -171
  640. package/lib/reanimated2/animation/timing.js +0 -64
  641. package/lib/reanimated2/animation/util.js +0 -180
  642. package/lib/reanimated2/commonTypes.js +0 -1
  643. package/lib/reanimated2/component/FlatList.js +0 -30
  644. package/lib/reanimated2/component/WrappedComponents.js +0 -9
  645. package/lib/reanimated2/component/index.js +0 -4
  646. package/lib/reanimated2/core.js +0 -276
  647. package/lib/reanimated2/fabricUtils.js +0 -18
  648. package/lib/reanimated2/globals.d.ts +0 -76
  649. package/lib/reanimated2/hook/commonTypes.js +0 -1
  650. package/lib/reanimated2/hook/index.js +0 -9
  651. package/lib/reanimated2/hook/useAnimatedGestureHandler.js +0 -49
  652. package/lib/reanimated2/hook/useAnimatedReaction.js +0 -37
  653. package/lib/reanimated2/hook/useAnimatedRef.js +0 -29
  654. package/lib/reanimated2/hook/useAnimatedScrollHandler.js +0 -41
  655. package/lib/reanimated2/hook/useAnimatedSensor.js +0 -66
  656. package/lib/reanimated2/hook/useAnimatedStyle.js +0 -393
  657. package/lib/reanimated2/hook/useDerivedValue.js +0 -36
  658. package/lib/reanimated2/hook/useSharedValue.js +0 -17
  659. package/lib/reanimated2/hook/utils.js +0 -173
  660. package/lib/reanimated2/interpolateColor.js +0 -101
  661. package/lib/reanimated2/interpolation.js +0 -112
  662. package/lib/reanimated2/jestUtils.js +0 -160
  663. package/lib/reanimated2/js-reanimated/JSReanimated.js +0 -99
  664. package/lib/reanimated2/js-reanimated/Mapper.js +0 -43
  665. package/lib/reanimated2/js-reanimated/MapperRegistry.js +0 -101
  666. package/lib/reanimated2/js-reanimated/MutableValue.js +0 -29
  667. package/lib/reanimated2/js-reanimated/commonTypes.js +0 -1
  668. package/lib/reanimated2/js-reanimated/index.js +0 -62
  669. package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -67
  670. package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +0 -69
  671. package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +0 -133
  672. package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +0 -194
  673. package/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +0 -1
  674. package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +0 -376
  675. package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -36
  676. package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +0 -275
  677. package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +0 -385
  678. package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +0 -138
  679. package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +0 -81
  680. package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +0 -115
  681. package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +0 -273
  682. package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +0 -203
  683. package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +0 -101
  684. package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +0 -451
  685. package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +0 -90
  686. package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +0 -132
  687. package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +0 -37
  688. package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +0 -41
  689. package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +0 -34
  690. package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +0 -46
  691. package/lib/reanimated2/mock.js +0 -69
  692. package/lib/reanimated2/utils.js +0 -9
  693. package/lib/setAndForwardRef.js +0 -19
  694. package/lib/types/ConfigHelper.d.ts +0 -12
  695. package/lib/types/ReanimatedEventEmitter.d.ts +0 -3
  696. package/lib/types/ReanimatedModule.d.ts +0 -2
  697. package/lib/types/ReanimatedModule.macos.d.ts +0 -2
  698. package/lib/types/ReanimatedModule.native.d.ts +0 -2
  699. package/lib/types/ReanimatedModule.windows.d.ts +0 -2
  700. package/lib/types/ReanimatedModuleCompat.d.ts +0 -14
  701. package/lib/types/createAnimatedComponent.d.ts +0 -33
  702. package/lib/types/reanimated2/Bezier.d.ts +0 -6
  703. package/lib/types/reanimated2/Colors.d.ts +0 -31
  704. package/lib/types/reanimated2/NativeMethods.d.ts +0 -15
  705. package/lib/types/reanimated2/NativeReanimated/NativeReanimated.d.ts +0 -20
  706. package/lib/types/reanimated2/NativeReanimated/index.d.ts +0 -3
  707. package/lib/types/reanimated2/PlatformChecker.d.ts +0 -5
  708. package/lib/types/reanimated2/PropAdapters.d.ts +0 -4
  709. package/lib/types/reanimated2/UpdateProps.d.ts +0 -9
  710. package/lib/types/reanimated2/ViewDescriptorsSet.d.ts +0 -20
  711. package/lib/types/reanimated2/WorkletEventHandler.d.ts +0 -13
  712. package/lib/types/reanimated2/__mocks__/MutableValue.d.ts +0 -5
  713. package/lib/types/reanimated2/__mocks__/NativeReanimated.d.ts +0 -13
  714. package/lib/types/reanimated2/__mocks__/NativeReanimated.native.d.ts +0 -13
  715. package/lib/types/reanimated2/animation/commonTypes.d.ts +0 -27
  716. package/lib/types/reanimated2/animation/decay.d.ts +0 -19
  717. package/lib/types/reanimated2/animation/delay.d.ts +0 -7
  718. package/lib/types/reanimated2/animation/index.d.ts +0 -9
  719. package/lib/types/reanimated2/animation/repeat.d.ts +0 -12
  720. package/lib/types/reanimated2/animation/sequence.d.ts +0 -7
  721. package/lib/types/reanimated2/animation/spring.d.ts +0 -22
  722. package/lib/types/reanimated2/animation/styleAnimation.d.ts +0 -7
  723. package/lib/types/reanimated2/animation/timing.d.ts +0 -21
  724. package/lib/types/reanimated2/animation/util.d.ts +0 -9
  725. package/lib/types/reanimated2/commonTypes.d.ts +0 -80
  726. package/lib/types/reanimated2/component/FlatList.d.ts +0 -9
  727. package/lib/types/reanimated2/component/WrappedComponents.d.ts +0 -8
  728. package/lib/types/reanimated2/component/index.d.ts +0 -9
  729. package/lib/types/reanimated2/core.d.ts +0 -24
  730. package/lib/types/reanimated2/fabricUtils.d.ts +0 -4
  731. package/lib/types/reanimated2/hook/Hooks.d.ts +0 -5
  732. package/lib/types/reanimated2/hook/commonTypes.d.ts +0 -15
  733. package/lib/types/reanimated2/hook/index.d.ts +0 -10
  734. package/lib/types/reanimated2/hook/useAnimatedGestureHandler.d.ts +0 -35
  735. package/lib/types/reanimated2/hook/useAnimatedReaction.d.ts +0 -12
  736. package/lib/types/reanimated2/hook/useAnimatedRef.d.ts +0 -3
  737. package/lib/types/reanimated2/hook/useAnimatedScrollHandler.d.ts +0 -21
  738. package/lib/types/reanimated2/hook/useAnimatedSensor.d.ts +0 -18
  739. package/lib/types/reanimated2/hook/useAnimatedStyle.d.ts +0 -11
  740. package/lib/types/reanimated2/hook/useDerivedValue.d.ts +0 -4
  741. package/lib/types/reanimated2/hook/useSharedValue.d.ts +0 -2
  742. package/lib/types/reanimated2/hook/utils.d.ts +0 -28
  743. package/lib/types/reanimated2/index.d.ts +0 -12
  744. package/lib/types/reanimated2/interpolateColor.d.ts +0 -31
  745. package/lib/types/reanimated2/interpolation.d.ts +0 -11
  746. package/lib/types/reanimated2/jestUtils.d.ts +0 -12
  747. package/lib/types/reanimated2/js-reanimated/JSReanimated.d.ts +0 -30
  748. package/lib/types/reanimated2/js-reanimated/Mapper.d.ts +0 -14
  749. package/lib/types/reanimated2/js-reanimated/MapperRegistry.d.ts +0 -14
  750. package/lib/types/reanimated2/js-reanimated/MutableValue.d.ts +0 -14
  751. package/lib/types/reanimated2/js-reanimated/commonTypes.d.ts +0 -44
  752. package/lib/types/reanimated2/js-reanimated/index.d.ts +0 -15
  753. package/lib/types/reanimated2/layoutReanimation/LayoutAnimationRepository.d.ts +0 -1
  754. package/lib/types/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -22
  755. package/lib/types/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -38
  756. package/lib/types/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -25
  757. package/lib/types/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +0 -77
  758. package/lib/types/reanimated2/layoutReanimation/animationBuilder/index.d.ts +0 -4
  759. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -62
  760. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Default.d.ts +0 -4
  761. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +0 -42
  762. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +0 -50
  763. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -18
  764. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -10
  765. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +0 -18
  766. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -34
  767. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +0 -34
  768. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -18
  769. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -66
  770. package/lib/types/reanimated2/layoutReanimation/defaultAnimations/index.d.ts +0 -10
  771. package/lib/types/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -19
  772. package/lib/types/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -13
  773. package/lib/types/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -6
  774. package/lib/types/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -6
  775. package/lib/types/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -7
  776. package/lib/types/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -9
  777. package/lib/types/reanimated2/layoutReanimation/defaultTransitions/index.d.ts +0 -6
  778. package/lib/types/reanimated2/layoutReanimation/index.d.ts +0 -4
  779. package/lib/types/reanimated2/mock.d.ts +0 -55
  780. package/lib/types/reanimated2/platform-specific/RNRenderer.d.ts +0 -1
  781. package/lib/types/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
  782. package/lib/types/reanimated2/utils.d.ts +0 -7
  783. package/src/Animated.js +0 -18
  784. package/src/ReanimatedEventEmitter.ts +0 -4
  785. package/src/ReanimatedModule.macos.ts +0 -3
  786. package/src/ReanimatedModule.native.ts +0 -13
  787. package/src/ReanimatedModule.ts +0 -3
  788. package/src/ReanimatedModule.windows.ts +0 -3
  789. package/src/ReanimatedModuleCompat.ts +0 -51
  790. package/src/__mocks__/ReanimatedEventEmitter.js +0 -8
  791. package/src/__mocks__/ReanimatedModule.native.js +0 -11
  792. package/src/reanimated2/__mocks__/MutableValue.ts +0 -15
  793. package/src/reanimated2/__mocks__/NativeReanimated.ts +0 -23
  794. package/src/reanimated2/component/WrappedComponents.ts +0 -11
  795. package/src/reanimated2/component/index.ts +0 -9
  796. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +0 -75
  797. package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +0 -49
@@ -1,16 +1,17 @@
1
1
  #include "AnimatedSensorModule.h"
2
- #include "MutableValue.h"
3
- #include "ValueWrapper.h"
2
+
3
+ #include <memory>
4
+ #include <utility>
5
+
6
+ #include "Shareables.h"
4
7
 
5
8
  namespace reanimated {
6
9
 
7
10
  AnimatedSensorModule::AnimatedSensorModule(
8
- const PlatformDepMethodsHolder &platformDepMethodsHolder,
9
- RuntimeManager *runtimeManager)
11
+ const PlatformDepMethodsHolder &platformDepMethodsHolder)
10
12
  : platformRegisterSensorFunction_(platformDepMethodsHolder.registerSensor),
11
13
  platformUnregisterSensorFunction_(
12
- platformDepMethodsHolder.unregisterSensor),
13
- runtimeManager_(runtimeManager) {}
14
+ platformDepMethodsHolder.unregisterSensor) {}
14
15
 
15
16
  AnimatedSensorModule::~AnimatedSensorModule() {
16
17
  // It is called during app reload because app reload doesn't call hooks
@@ -22,41 +23,38 @@ AnimatedSensorModule::~AnimatedSensorModule() {
22
23
 
23
24
  jsi::Value AnimatedSensorModule::registerSensor(
24
25
  jsi::Runtime &rt,
25
- const jsi::Value &sensorType,
26
+ const std::shared_ptr<JSRuntimeHelper> &runtimeHelper,
27
+ const jsi::Value &sensorTypeValue,
26
28
  const jsi::Value &interval,
27
- const jsi::Value &sensorDataContainer) {
28
- std::shared_ptr<ShareableValue> sensorsData = ShareableValue::adapt(
29
- rt, sensorDataContainer.getObject(rt), runtimeManager_);
30
- auto &mutableObject =
31
- ValueWrapper::asMutableValue(sensorsData->valueContainer);
29
+ const jsi::Value &sensorDataHandler) {
30
+ SensorType sensorType = static_cast<SensorType>(sensorTypeValue.asNumber());
32
31
 
33
- std::function<void(double[])> setter;
34
- if (sensorType.asNumber() == SensorType::ROTATION_VECTOR) {
35
- setter = [&, mutableObject](double newValues[]) {
36
- jsi::Runtime &runtime = *runtimeManager_->runtime.get();
37
- jsi::Object value(runtime);
38
- value.setProperty(runtime, "qw", newValues[0]);
39
- value.setProperty(runtime, "qx", newValues[1]);
40
- value.setProperty(runtime, "qy", newValues[2]);
41
- value.setProperty(runtime, "qz", newValues[3]);
42
- value.setProperty(runtime, "yaw", newValues[4]);
43
- value.setProperty(runtime, "pitch", newValues[5]);
44
- value.setProperty(runtime, "roll", newValues[6]);
45
- mutableObject->setValue(runtime, std::move(value));
46
- };
47
- } else {
48
- setter = [&, mutableObject](double newValues[]) {
49
- jsi::Runtime &runtime = *runtimeManager_->runtime.get();
50
- jsi::Object value(runtime);
51
- value.setProperty(runtime, "x", newValues[0]);
52
- value.setProperty(runtime, "y", newValues[1]);
53
- value.setProperty(runtime, "z", newValues[2]);
54
- mutableObject->setValue(runtime, std::move(value));
55
- };
56
- }
32
+ auto shareableHandler = extractShareableOrThrow(rt, sensorDataHandler);
33
+ auto uiRuntime = runtimeHelper->uiRuntime();
57
34
 
58
35
  int sensorId = platformRegisterSensorFunction_(
59
- sensorType.asNumber(), interval.asNumber(), setter);
36
+ sensorType, interval.asNumber(), [=](double newValues[]) {
37
+ jsi::Runtime &rt = *uiRuntime;
38
+ auto handler =
39
+ shareableHandler->getJSValue(rt).asObject(rt).asFunction(rt);
40
+ if (sensorType == SensorType::ROTATION_VECTOR) {
41
+ jsi::Object value(rt);
42
+ value.setProperty(rt, "qx", newValues[0]);
43
+ value.setProperty(rt, "qy", newValues[1]);
44
+ value.setProperty(rt, "qz", newValues[2]);
45
+ value.setProperty(rt, "qw", newValues[3]);
46
+ value.setProperty(rt, "yaw", newValues[4]);
47
+ value.setProperty(rt, "pitch", newValues[5]);
48
+ value.setProperty(rt, "roll", newValues[6]);
49
+ handler.call(rt, value);
50
+ } else {
51
+ jsi::Object value(rt);
52
+ value.setProperty(rt, "x", newValues[0]);
53
+ value.setProperty(rt, "y", newValues[1]);
54
+ value.setProperty(rt, "z", newValues[2]);
55
+ handler.call(rt, value);
56
+ }
57
+ });
60
58
  if (sensorId != -1) {
61
59
  sensorsIds_.insert(sensorId);
62
60
  }
@@ -1,10 +1,12 @@
1
1
  #pragma once
2
2
 
3
3
  #include <jsi/jsi.h>
4
+ #include <memory>
4
5
  #include <unordered_set>
5
6
 
6
7
  #include "PlatformDepMethodsHolder.h"
7
8
  #include "RuntimeManager.h"
9
+ #include "Shareables.h"
8
10
 
9
11
  namespace reanimated {
10
12
 
@@ -22,16 +24,15 @@ class AnimatedSensorModule {
22
24
  std::unordered_set<int> sensorsIds_;
23
25
  RegisterSensorFunction platformRegisterSensorFunction_;
24
26
  UnregisterSensorFunction platformUnregisterSensorFunction_;
25
- RuntimeManager *runtimeManager_;
26
27
 
27
28
  public:
28
29
  AnimatedSensorModule(
29
- const PlatformDepMethodsHolder &platformDepMethodsHolder,
30
- RuntimeManager *runtimeManager);
30
+ const PlatformDepMethodsHolder &platformDepMethodsHolder);
31
31
  ~AnimatedSensorModule();
32
32
 
33
33
  jsi::Value registerSensor(
34
34
  jsi::Runtime &rt,
35
+ const std::shared_ptr<JSRuntimeHelper> &runtimeHelper,
35
36
  const jsi::Value &sensorType,
36
37
  const jsi::Value &interval,
37
38
  const jsi::Value &sensorDataContainer);
@@ -1,7 +1,13 @@
1
1
  #ifdef RCT_NEW_ARCH_ENABLED
2
2
 
3
+ #if REACT_NATIVE_MINOR_VERSION < 69
4
+ #error \
5
+ "Reanimated 3 does not support React Native 0.68.x when Fabric is enabled. Please upgrade to React Native 0.69.0 or newer if you want to use Reanimated with the new architecture."
6
+ #endif
7
+
3
8
  #include "FabricUtils.h"
4
9
 
10
+ #include <react/renderer/debug/SystraceSection.h>
5
11
  #include <react/renderer/uimanager/UIManagerBinding.h>
6
12
 
7
13
  using namespace facebook::react;
@@ -17,110 +23,10 @@ RuntimeExecutor getRuntimeExecutorFromBinding(Binding *binding) {
17
23
  }
18
24
  #endif
19
25
 
20
- inline static const UIManagerPublic *getUIManagerPublic(
21
- const UIManager *uiManager) {
22
- return reinterpret_cast<const UIManagerPublic *>(uiManager);
23
- }
24
-
25
26
  std::shared_ptr<const ContextContainer> getContextContainerFromUIManager(
26
27
  const UIManager *uiManager) {
27
- return getUIManagerPublic(uiManager)->contextContainer_;
28
- }
29
-
30
- inline static UIManagerDelegate *getDelegateFromUIManager(
31
- const UIManager *uiManager) {
32
- return getUIManagerPublic(uiManager)->delegate_;
33
- }
34
-
35
- void UIManager_dispatchCommand(
36
- const std::shared_ptr<UIManager> &uiManager,
37
- const ShadowNode::Shared &shadowNode,
38
- std::string const &commandName,
39
- folly::dynamic const &args) {
40
- auto delegate_ = getDelegateFromUIManager(&*uiManager);
41
-
42
- // copied from UIManager.cpp
43
- if (delegate_) {
44
- delegate_->uiManagerDidDispatchCommand(shadowNode, commandName, args);
45
- }
46
- }
47
-
48
- LayoutMetrics UIManager_getRelativeLayoutMetrics(
49
- const std::shared_ptr<UIManager> &uiManager,
50
- ShadowNode const &shadowNode,
51
- ShadowNode const *ancestorShadowNode,
52
- LayoutableShadowNode::LayoutInspectingPolicy policy) {
53
- // based on implementation from UIManager.cpp
54
- const auto &shadowTreeRegistry = uiManager->getShadowTreeRegistry();
55
-
56
- // We might store here an owning pointer to `ancestorShadowNode` to ensure
57
- // that the node is not deallocated during method execution lifetime.
58
- auto owningAncestorShadowNode = ShadowNode::Shared{};
59
-
60
- if (!ancestorShadowNode) {
61
- shadowTreeRegistry.visit(
62
- shadowNode.getSurfaceId(), [&](ShadowTree const &shadowTree) {
63
- owningAncestorShadowNode =
64
- shadowTree.getCurrentRevision().rootShadowNode;
65
- ancestorShadowNode = owningAncestorShadowNode.get();
66
- });
67
- } else {
68
- // It is possible for JavaScript (or other callers) to have a reference
69
- // to a previous version of ShadowNodes, but we enforce that
70
- // metrics are only calculated on most recently committed versions.
71
- owningAncestorShadowNode =
72
- uiManager->getNewestCloneOfShadowNode(*ancestorShadowNode);
73
- ancestorShadowNode = owningAncestorShadowNode.get();
74
- }
75
-
76
- auto layoutableAncestorShadowNode =
77
- traitCast<LayoutableShadowNode const *>(ancestorShadowNode);
78
-
79
- if (!layoutableAncestorShadowNode) {
80
- return EmptyLayoutMetrics;
81
- }
82
-
83
- return LayoutableShadowNode::computeRelativeLayoutMetrics(
84
- shadowNode.getFamily(), *layoutableAncestorShadowNode, policy);
85
- }
86
-
87
- SharedShadowNode UIManager_cloneNode(
88
- const UIManager *uiManager,
89
- const ShadowNode::Shared &shadowNode,
90
- const SharedShadowNodeSharedList &children,
91
- const RawProps *rawProps) {
92
- auto delegate_ = getDelegateFromUIManager(uiManager);
93
- auto contextContainer_ = getContextContainerFromUIManager(uiManager);
94
-
95
- // copied from UIManager.cpp
96
- PropsParserContext propsParserContext{
97
- shadowNode->getFamily().getSurfaceId(), *contextContainer_.get()};
98
-
99
- auto &componentDescriptor = shadowNode->getComponentDescriptor();
100
- auto clonedShadowNode = componentDescriptor.cloneShadowNode(
101
- *shadowNode,
102
- {
103
- /* .props = */
104
- rawProps ? componentDescriptor.cloneProps(
105
- propsParserContext, shadowNode->getProps(), *rawProps)
106
- : ShadowNodeFragment::propsPlaceholder(),
107
- /* .children = */ children,
108
- });
109
-
110
- if (delegate_) {
111
- delegate_->uiManagerDidCloneShadowNode(
112
- *shadowNode.get(), *clonedShadowNode);
113
- }
114
-
115
- return clonedShadowNode;
116
- }
117
-
118
- void UIManager_appendChild(
119
- const ShadowNode::Shared &parentShadowNode,
120
- const ShadowNode::Shared &childShadowNode) {
121
- // copied from UIManager.cpp
122
- auto &componentDescriptor = parentShadowNode->getComponentDescriptor();
123
- componentDescriptor.appendChild(parentShadowNode, childShadowNode);
28
+ return reinterpret_cast<const UIManagerPublic *>(uiManager)
29
+ ->contextContainer_;
124
30
  }
125
31
 
126
32
  } // namespace reanimated
@@ -2,21 +2,23 @@
2
2
  #ifdef RCT_NEW_ARCH_ENABLED
3
3
 
4
4
  #ifdef ANDROID
5
- #include <Binding.h>
6
5
  #include <fbjni/fbjni.h>
6
+ #include <react/fabric/Binding.h>
7
7
  #endif
8
8
  #include <react/renderer/uimanager/UIManager.h>
9
9
 
10
10
  #include <memory>
11
11
  #include <string>
12
12
 
13
- using namespace facebook::react;
13
+ using namespace facebook;
14
+ using namespace react;
14
15
 
15
16
  namespace reanimated {
16
17
 
17
18
  struct UIManagerBindingPublic {
18
19
  void *vtable;
19
20
  std::shared_ptr<UIManager> uiManager_;
21
+ std::unique_ptr<EventHandler const> eventHandler_;
20
22
  };
21
23
 
22
24
  struct UIManagerPublic {
@@ -51,28 +53,6 @@ RuntimeExecutor getRuntimeExecutorFromBinding(Binding *binding);
51
53
  std::shared_ptr<const ContextContainer> getContextContainerFromUIManager(
52
54
  const UIManager *uiManager);
53
55
 
54
- void UIManager_dispatchCommand(
55
- const std::shared_ptr<UIManager> &uiManager,
56
- const ShadowNode::Shared &shadowNode,
57
- std::string const &commandName,
58
- folly::dynamic const &args);
59
-
60
- LayoutMetrics UIManager_getRelativeLayoutMetrics(
61
- const std::shared_ptr<UIManager> &uiManager,
62
- ShadowNode const &shadowNode,
63
- ShadowNode const *ancestorShadowNode,
64
- LayoutableShadowNode::LayoutInspectingPolicy policy);
65
-
66
- SharedShadowNode UIManager_cloneNode(
67
- const UIManager *uiManager,
68
- const ShadowNode::Shared &shadowNode,
69
- const SharedShadowNodeSharedList &children = nullptr,
70
- const RawProps *rawProps = nullptr);
71
-
72
- void UIManager_appendChild(
73
- const ShadowNode::Shared &parentShadowNode,
74
- const ShadowNode::Shared &childShadowNode);
75
-
76
56
  } // namespace reanimated
77
57
 
78
58
  #endif // RCT_NEW_ARCH_ENABLED
@@ -4,6 +4,10 @@
4
4
  #include "FabricUtils.h"
5
5
  #include "NewestShadowNodesRegistry.h"
6
6
 
7
+ #include <react/renderer/debug/SystraceSection.h>
8
+
9
+ #include <utility>
10
+
7
11
  using namespace facebook;
8
12
  using namespace react;
9
13
 
@@ -17,45 +21,87 @@ void ReanimatedUIManagerBinding::createAndInstallIfNeeded(
17
21
  &newestShadowNodesRegistry) {
18
22
  // adapted from UIManagerBinding.cpp
19
23
  auto uiManagerModuleName = "nativeFabricUIManager";
20
- auto uiManagerBinding = std::make_shared<ReanimatedUIManagerBinding>(
21
- uiManager, runtimeExecutor, newestShadowNodesRegistry);
22
- auto object = jsi::Object::createFromHostObject(runtime, uiManagerBinding);
24
+
25
+ auto eventHandler = [&]() -> std::unique_ptr<EventHandler const> {
26
+ auto uiManagerValue =
27
+ runtime.global().getProperty(runtime, uiManagerModuleName);
28
+ if (uiManagerValue.isUndefined()) {
29
+ return nullptr;
30
+ }
31
+
32
+ auto uiManagerBinding =
33
+ uiManagerValue.asObject(runtime).asHostObject<UIManagerBinding>(
34
+ runtime);
35
+ auto uiManagerBindingPublic =
36
+ reinterpret_cast<UIManagerBindingPublic *>(&*uiManagerBinding);
37
+ return std::move(uiManagerBindingPublic->eventHandler_);
38
+ }();
39
+
40
+ auto reanimatedUiManagerBinding =
41
+ std::make_shared<ReanimatedUIManagerBinding>(
42
+ uiManager,
43
+ runtimeExecutor,
44
+ std::move(eventHandler),
45
+ newestShadowNodesRegistry);
46
+ auto object =
47
+ jsi::Object::createFromHostObject(runtime, reanimatedUiManagerBinding);
23
48
  runtime.global().setProperty(runtime, uiManagerModuleName, std::move(object));
24
49
  }
25
50
 
26
51
  ReanimatedUIManagerBinding::ReanimatedUIManagerBinding(
27
52
  std::shared_ptr<UIManager> uiManager,
28
53
  RuntimeExecutor runtimeExecutor,
54
+ std::unique_ptr<EventHandler const> eventHandler,
29
55
  std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry)
30
- : UIManagerBinding(uiManager, runtimeExecutor),
56
+ : UIManagerBinding(uiManager),
31
57
  uiManager_(std::move(uiManager)),
32
- newestShadowNodesRegistry_(newestShadowNodesRegistry) {}
58
+ newestShadowNodesRegistry_(newestShadowNodesRegistry) {
59
+ if (eventHandler != nullptr) {
60
+ reinterpret_cast<UIManagerBindingPublic *>(this)->eventHandler_ =
61
+ std::move(eventHandler);
62
+ }
63
+ }
33
64
 
34
65
  ReanimatedUIManagerBinding::~ReanimatedUIManagerBinding() {}
35
66
 
36
- void ReanimatedUIManagerBinding::invalidate() const {
37
- uiManager_->setDelegate(nullptr);
38
- }
39
-
40
- static inline ShadowNode::Shared cloneNode(
67
+ static inline ShadowNode::Shared cloneNodeUsingNewest(
41
68
  UIManager *uiManager,
42
69
  NewestShadowNodesRegistry *newestShadowNodesRegistry,
43
- const ShadowNode::Shared &shadowNode,
44
- const SharedShadowNodeSharedList &children = nullptr,
45
- const RawProps *rawProps = nullptr) {
70
+ ShadowNode const &shadowNode,
71
+ ShadowNode::SharedListOfShared const &children = nullptr,
72
+ RawProps const *rawProps = nullptr) {
46
73
  {
47
74
  auto lock = newestShadowNodesRegistry->createLock();
48
- auto newest = newestShadowNodesRegistry->get(shadowNode->getTag());
75
+ auto newest = newestShadowNodesRegistry->get(shadowNode.getTag());
49
76
  if (newest != nullptr) {
50
77
  // ShadowNode managed by Reanimated, use newest ShadowNode from registry
51
- auto clone = UIManager_cloneNode(uiManager, newest, children, rawProps);
78
+ auto clone = uiManager->cloneNode(*newest, children, rawProps);
52
79
  newestShadowNodesRegistry->update(clone);
53
80
  return clone;
54
81
  }
55
82
  } // release lock since we don't need registry anymore
56
83
 
57
84
  // ShadowNode not managed by Reanimated (yet?)
58
- return UIManager_cloneNode(uiManager, shadowNode, children, rawProps);
85
+ return uiManager->cloneNode(shadowNode, children, rawProps);
86
+ }
87
+
88
+ static inline void appendChildUsingNewest(
89
+ UIManager *uiManager,
90
+ NewestShadowNodesRegistry *newestShadowNodesRegistry,
91
+ const ShadowNode::Shared &parentShadowNode,
92
+ const ShadowNode::Shared &childShadowNode) {
93
+ {
94
+ auto lock = newestShadowNodesRegistry->createLock();
95
+ auto newestChildShadowNode =
96
+ newestShadowNodesRegistry->get(childShadowNode->getTag());
97
+ if (newestChildShadowNode != nullptr) {
98
+ uiManager->appendChild(parentShadowNode, newestChildShadowNode);
99
+ return;
100
+ }
101
+ } // release lock since we don't need registry anymore
102
+
103
+ // child ShadowNode not managed by Reanimated (yet?)
104
+ uiManager->appendChild(parentShadowNode, childShadowNode);
59
105
  }
60
106
 
61
107
  jsi::Value ReanimatedUIManagerBinding::get(
@@ -69,6 +115,7 @@ jsi::Value ReanimatedUIManagerBinding::get(
69
115
 
70
116
  // based on implementation from UIManagerBinding.cpp
71
117
  auto methodName = name.utf8(runtime);
118
+ SystraceSection s("ReanimatedUIManagerBinding::get", "name", methodName);
72
119
  UIManager *uiManager = uiManager_.get();
73
120
  NewestShadowNodesRegistry *newestShadowNodesRegistry =
74
121
  newestShadowNodesRegistry_.get();
@@ -81,15 +128,15 @@ jsi::Value ReanimatedUIManagerBinding::get(
81
128
  1,
82
129
  [uiManager, newestShadowNodesRegistry](
83
130
  jsi::Runtime &runtime,
84
- jsi::Value const &thisValue,
131
+ jsi::Value const & /*thisValue*/,
85
132
  jsi::Value const *arguments,
86
- size_t count) noexcept -> jsi::Value {
133
+ size_t /*count*/) noexcept -> jsi::Value {
87
134
  return valueFromShadowNode(
88
135
  runtime,
89
- cloneNode(
136
+ cloneNodeUsingNewest(
90
137
  uiManager,
91
138
  newestShadowNodesRegistry,
92
- shadowNodeFromValue(runtime, arguments[0])));
139
+ *shadowNodeFromValue(runtime, arguments[0])));
93
140
  });
94
141
  }
95
142
 
@@ -101,15 +148,15 @@ jsi::Value ReanimatedUIManagerBinding::get(
101
148
  1,
102
149
  [uiManager, newestShadowNodesRegistry](
103
150
  jsi::Runtime &runtime,
104
- jsi::Value const &thisValue,
151
+ jsi::Value const & /*thisValue*/,
105
152
  jsi::Value const *arguments,
106
- size_t count) noexcept -> jsi::Value {
153
+ size_t /*count*/) noexcept -> jsi::Value {
107
154
  return valueFromShadowNode(
108
155
  runtime,
109
- cloneNode(
156
+ cloneNodeUsingNewest(
110
157
  uiManager,
111
158
  newestShadowNodesRegistry,
112
- shadowNodeFromValue(runtime, arguments[0]),
159
+ *shadowNodeFromValue(runtime, arguments[0]),
113
160
  ShadowNode::emptySharedShadowNodeSharedList()));
114
161
  });
115
162
  }
@@ -122,16 +169,16 @@ jsi::Value ReanimatedUIManagerBinding::get(
122
169
  2,
123
170
  [uiManager, newestShadowNodesRegistry](
124
171
  jsi::Runtime &runtime,
125
- jsi::Value const &thisValue,
172
+ jsi::Value const & /*thisValue*/,
126
173
  jsi::Value const *arguments,
127
- size_t count) noexcept -> jsi::Value {
174
+ size_t /*count*/) noexcept -> jsi::Value {
128
175
  auto const &rawProps = RawProps(runtime, arguments[1]);
129
176
  return valueFromShadowNode(
130
177
  runtime,
131
- cloneNode(
178
+ cloneNodeUsingNewest(
132
179
  uiManager,
133
180
  newestShadowNodesRegistry,
134
- shadowNodeFromValue(runtime, arguments[0]),
181
+ *shadowNodeFromValue(runtime, arguments[0]),
135
182
  nullptr,
136
183
  &rawProps));
137
184
  });
@@ -145,16 +192,16 @@ jsi::Value ReanimatedUIManagerBinding::get(
145
192
  2,
146
193
  [uiManager, newestShadowNodesRegistry](
147
194
  jsi::Runtime &runtime,
148
- jsi::Value const &thisValue,
195
+ jsi::Value const & /*thisValue*/,
149
196
  jsi::Value const *arguments,
150
- size_t count) noexcept -> jsi::Value {
197
+ size_t /*count*/) noexcept -> jsi::Value {
151
198
  auto const &rawProps = RawProps(runtime, arguments[1]);
152
199
  return valueFromShadowNode(
153
200
  runtime,
154
- cloneNode(
201
+ cloneNodeUsingNewest(
155
202
  uiManager,
156
203
  newestShadowNodesRegistry,
157
- shadowNodeFromValue(runtime, arguments[0]),
204
+ *shadowNodeFromValue(runtime, arguments[0]),
158
205
  ShadowNode::emptySharedShadowNodeSharedList(),
159
206
  &rawProps));
160
207
  });
@@ -165,21 +212,16 @@ jsi::Value ReanimatedUIManagerBinding::get(
165
212
  runtime,
166
213
  name,
167
214
  2,
168
- [newestShadowNodesRegistry](
215
+ [uiManager, newestShadowNodesRegistry](
169
216
  jsi::Runtime &runtime,
170
- jsi::Value const &thisValue,
217
+ jsi::Value const & /*thisValue*/,
171
218
  jsi::Value const *arguments,
172
- size_t count) noexcept -> jsi::Value {
173
- auto parent = shadowNodeFromValue(runtime, arguments[0]);
174
- auto child = shadowNodeFromValue(runtime, arguments[1]);
175
- {
176
- auto lock = newestShadowNodesRegistry->createLock();
177
- auto newest = newestShadowNodesRegistry->get(child->getTag());
178
- if (newest != nullptr) {
179
- child = newest;
180
- }
181
- }
182
- UIManager_appendChild(parent, child);
219
+ size_t /*count*/) noexcept -> jsi::Value {
220
+ appendChildUsingNewest(
221
+ uiManager,
222
+ newestShadowNodesRegistry,
223
+ shadowNodeFromValue(runtime, arguments[0]),
224
+ shadowNodeFromValue(runtime, arguments[1]));
183
225
  return jsi::Value::undefined();
184
226
  });
185
227
  }
@@ -28,6 +28,7 @@ class ReanimatedUIManagerBinding : public UIManagerBinding {
28
28
  ReanimatedUIManagerBinding(
29
29
  std::shared_ptr<UIManager> uiManager,
30
30
  RuntimeExecutor runtimeExecutor,
31
+ std::unique_ptr<EventHandler const> eventHandler,
31
32
  std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry);
32
33
 
33
34
  ~ReanimatedUIManagerBinding();
@@ -0,0 +1,92 @@
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
+
3
+ #include "ShadowTreeCloner.h"
4
+ #include "FabricUtils.h"
5
+
6
+ namespace reanimated {
7
+
8
+ ShadowTreeCloner::ShadowTreeCloner(
9
+ std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry,
10
+ std::shared_ptr<UIManager> uiManager,
11
+ SurfaceId surfaceId)
12
+ : newestShadowNodesRegistry_{newestShadowNodesRegistry},
13
+ propsParserContext_{
14
+ surfaceId,
15
+ *getContextContainerFromUIManager(&*uiManager)} {}
16
+
17
+ ShadowTreeCloner::~ShadowTreeCloner() {
18
+ #ifdef DEBUG
19
+ react_native_assert(
20
+ yogaChildrenUpdates_.empty() &&
21
+ "Deallocating `ShadowTreeCloner` without calling `updateYogaChildren`.");
22
+ #endif
23
+ }
24
+
25
+ ShadowNode::Unshared ShadowTreeCloner::cloneWithNewProps(
26
+ const ShadowNode::Shared &oldRootNode,
27
+ const ShadowNodeFamily &family,
28
+ RawProps &&rawProps) {
29
+ // adapted from ShadowNode::cloneTree
30
+
31
+ auto ancestors = family.getAncestors(*oldRootNode);
32
+
33
+ if (ancestors.empty()) {
34
+ return ShadowNode::Unshared{nullptr};
35
+ }
36
+
37
+ auto &parent = ancestors.back();
38
+ auto &oldShadowNode = parent.first.get().getChildren().at(parent.second);
39
+
40
+ const auto newest = newestShadowNodesRegistry_->get(oldShadowNode->getTag());
41
+
42
+ const auto &source = newest == nullptr ? oldShadowNode : newest;
43
+
44
+ const auto props = source->getComponentDescriptor().cloneProps(
45
+ propsParserContext_, source->getProps(), rawProps);
46
+
47
+ auto newChildNode = source->clone({/* .props = */ props});
48
+
49
+ for (auto it = ancestors.rbegin(); it != ancestors.rend(); ++it) {
50
+ auto &parentNode = it->first.get();
51
+ auto childIndex = it->second;
52
+
53
+ auto children = parentNode.getChildren();
54
+ const auto &oldChildNode = *children.at(childIndex);
55
+ react_native_assert(ShadowNode::sameFamily(oldChildNode, *newChildNode));
56
+
57
+ newestShadowNodesRegistry_->set(newChildNode, parentNode.getTag());
58
+
59
+ if (!parentNode.getSealed()) {
60
+ // Optimization: if a ShadowNode is unsealed, we can directly update its
61
+ // children instead of cloning the whole path to the root node.
62
+ auto &parentNodeNonConst = const_cast<ShadowNode &>(parentNode);
63
+ parentNodeNonConst.replaceChild(oldChildNode, newChildNode, childIndex);
64
+ yogaChildrenUpdates_.insert(&parentNodeNonConst);
65
+ return std::const_pointer_cast<ShadowNode>(oldRootNode);
66
+ }
67
+
68
+ children[childIndex] = newChildNode;
69
+
70
+ newChildNode = parentNode.clone({
71
+ ShadowNodeFragment::propsPlaceholder(),
72
+ std::make_shared<ShadowNode::ListOfShared>(children),
73
+ });
74
+ }
75
+
76
+ return std::const_pointer_cast<ShadowNode>(newChildNode);
77
+ }
78
+
79
+ void ShadowTreeCloner::updateYogaChildren() {
80
+ // Unfortunately, `replaceChild` does not update Yoga nodes, so we need to
81
+ // update them manually here.
82
+ for (ShadowNode *shadowNode : yogaChildrenUpdates_) {
83
+ static_cast<YogaLayoutableShadowNode *>(shadowNode)->updateYogaChildren();
84
+ }
85
+ #ifdef DEBUG
86
+ yogaChildrenUpdates_.clear();
87
+ #endif
88
+ }
89
+
90
+ } // namespace reanimated
91
+
92
+ #endif // RCT_NEW_ARCH_ENABLED
@@ -0,0 +1,41 @@
1
+ #pragma once
2
+ #ifdef RCT_NEW_ARCH_ENABLED
3
+
4
+ #include <react/renderer/core/PropsParserContext.h>
5
+ #include <react/renderer/uimanager/UIManager.h>
6
+
7
+ #include <memory>
8
+ #include <set>
9
+
10
+ #include "NewestShadowNodesRegistry.h"
11
+
12
+ using namespace facebook;
13
+ using namespace react;
14
+
15
+ namespace reanimated {
16
+
17
+ class ShadowTreeCloner {
18
+ public:
19
+ ShadowTreeCloner(
20
+ std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry,
21
+ std::shared_ptr<UIManager> uiManager,
22
+ SurfaceId surfaceId);
23
+
24
+ ~ShadowTreeCloner();
25
+
26
+ ShadowNode::Unshared cloneWithNewProps(
27
+ const ShadowNode::Shared &oldRootNode,
28
+ const ShadowNodeFamily &family,
29
+ RawProps &&rawProps);
30
+
31
+ void updateYogaChildren();
32
+
33
+ private:
34
+ std::shared_ptr<NewestShadowNodesRegistry> newestShadowNodesRegistry_;
35
+ PropsParserContext propsParserContext_;
36
+ std::set<ShadowNode *> yogaChildrenUpdates_;
37
+ };
38
+
39
+ } // namespace reanimated
40
+
41
+ #endif // RCT_NEW_ARCH_ENABLED