react-native-reanimated 3.0.0-rc.8 → 3.0.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 (339) hide show
  1. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +30 -12
  2. package/Common/cpp/AnimatedSensor/AnimatedSensorModule.h +2 -0
  3. package/Common/cpp/Fabric/FabricUtils.cpp +3 -107
  4. package/Common/cpp/Fabric/FabricUtils.h +3 -24
  5. package/Common/cpp/Fabric/ReanimatedUIManagerBinding.cpp +54 -37
  6. package/Common/cpp/LayoutAnimations/LayoutAnimationType.h +8 -0
  7. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.cpp +81 -26
  8. package/Common/cpp/LayoutAnimations/LayoutAnimationsManager.h +20 -3
  9. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +122 -121
  10. package/Common/cpp/NativeModules/NativeReanimatedModule.h +21 -14
  11. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +15 -7
  12. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +8 -4
  13. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +50 -1
  14. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +10 -1
  15. package/Common/cpp/ReanimatedRuntime/ReanimatedRuntime.cpp +5 -1
  16. package/Common/cpp/Registries/EventHandlerRegistry.cpp +8 -34
  17. package/Common/cpp/Registries/EventHandlerRegistry.h +7 -13
  18. package/Common/cpp/SharedItems/Shareables.cpp +11 -63
  19. package/Common/cpp/SharedItems/Shareables.h +113 -93
  20. package/Common/cpp/Tools/CollectionUtils.h +14 -0
  21. package/Common/cpp/Tools/JsiUtils.cpp +26 -0
  22. package/Common/cpp/Tools/JsiUtils.h +176 -0
  23. package/Common/cpp/Tools/PlatformDepMethodsHolder.h +5 -5
  24. package/Common/cpp/Tools/ReanimatedVersion.cpp +17 -0
  25. package/Common/cpp/Tools/ReanimatedVersion.h +11 -0
  26. package/Common/cpp/Tools/RuntimeDecorator.cpp +67 -247
  27. package/Common/cpp/Tools/RuntimeDecorator.h +2 -3
  28. package/Common/cpp/Tools/WorkletEventHandler.cpp +3 -2
  29. package/Common/cpp/Tools/WorkletEventHandler.h +14 -6
  30. package/RNReanimated.podspec +2 -1
  31. package/android/CMakeLists.txt +188 -181
  32. package/android/build.gradle +362 -311
  33. package/android/proguard-rules.pro +2 -0
  34. package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +63 -295
  35. package/android/src/main/cpp/LayoutAnimations.cpp +35 -5
  36. package/android/src/main/cpp/LayoutAnimations.h +23 -6
  37. package/android/src/main/cpp/NativeProxy.cpp +143 -98
  38. package/android/src/main/cpp/NativeProxy.h +22 -28
  39. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
  40. package/android/src/main/java/com/swmansion/reanimated/Utils.java +7 -1
  41. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +10 -3
  42. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +218 -35
  43. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +43 -17
  44. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +6 -2
  45. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedElement.java +19 -0
  46. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +610 -0
  47. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +93 -23
  48. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/AnimationFrameCallback.java +19 -0
  49. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +35 -0
  50. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/KeyboardEventDataUpdater.java +16 -0
  51. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +206 -0
  52. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/SensorSetter.java +17 -0
  53. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +9 -3
  54. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +3 -4
  55. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -7
  56. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +90 -307
  57. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
  58. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
  59. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
  60. package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +76 -20
  61. package/ios/LayoutReanimation/REAAnimationsManager.h +31 -5
  62. package/ios/LayoutReanimation/REAAnimationsManager.m +265 -77
  63. package/ios/LayoutReanimation/REAFrame.h +10 -0
  64. package/ios/LayoutReanimation/REAFrame.m +15 -0
  65. package/ios/LayoutReanimation/REAScreensHelper.h +19 -0
  66. package/ios/LayoutReanimation/REAScreensHelper.m +106 -0
  67. package/ios/LayoutReanimation/REASharedElement.h +15 -0
  68. package/ios/LayoutReanimation/REASharedElement.m +16 -0
  69. package/ios/LayoutReanimation/REASharedTransitionManager.h +17 -0
  70. package/ios/LayoutReanimation/REASharedTransitionManager.m +632 -0
  71. package/ios/LayoutReanimation/REASnapshot.h +1 -0
  72. package/ios/LayoutReanimation/REASnapshot.m +96 -11
  73. package/ios/LayoutReanimation/REAUIManager.mm +67 -60
  74. package/ios/REAModule.mm +2 -7
  75. package/ios/REANodesManager.mm +1 -21
  76. package/ios/keyboardObserver/REAKeyboardEventObserver.m +72 -36
  77. package/ios/native/NativeProxy.mm +75 -114
  78. package/ios/native/REAInitializer.mm +2 -7
  79. package/ios/native/REAJSIUtils.h +60 -2
  80. package/ios/sensor/ReanimatedSensor.h +6 -2
  81. package/ios/sensor/ReanimatedSensor.m +43 -7
  82. package/ios/sensor/ReanimatedSensorContainer.h +4 -1
  83. package/ios/sensor/ReanimatedSensorContainer.m +8 -2
  84. package/lib/commonjs/createAnimatedComponent.js +232 -28
  85. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  86. package/lib/commonjs/reanimated2/Colors.js +43 -22
  87. package/lib/commonjs/reanimated2/Colors.js.map +1 -1
  88. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +18 -35
  89. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  90. package/lib/commonjs/reanimated2/animation/styleAnimation.js +5 -1
  91. package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
  92. package/lib/commonjs/reanimated2/animation/util.js +17 -15
  93. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  94. package/lib/commonjs/reanimated2/commonTypes.js +33 -1
  95. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  96. package/lib/commonjs/reanimated2/component/FlatList.js +19 -3
  97. package/lib/commonjs/reanimated2/component/FlatList.js.map +1 -1
  98. package/lib/commonjs/reanimated2/core.js +34 -83
  99. package/lib/commonjs/reanimated2/core.js.map +1 -1
  100. package/lib/commonjs/reanimated2/errors.js +66 -0
  101. package/lib/commonjs/reanimated2/errors.js.map +1 -0
  102. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  103. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  104. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  105. package/lib/commonjs/reanimated2/hook/index.js +0 -6
  106. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  107. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  108. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  109. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +13 -1
  110. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  111. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +1 -1
  112. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  113. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +89 -16
  114. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  115. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +43 -50
  116. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  117. package/lib/commonjs/reanimated2/hook/useDerivedValue.js +13 -1
  118. package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
  119. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +2 -2
  120. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  121. package/lib/commonjs/reanimated2/hook/utils.js +18 -65
  122. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  123. package/lib/commonjs/reanimated2/index.js +13 -0
  124. package/lib/commonjs/reanimated2/index.js.map +1 -1
  125. package/lib/commonjs/reanimated2/initializers.js +196 -0
  126. package/lib/commonjs/reanimated2/initializers.js.map +1 -0
  127. package/lib/commonjs/reanimated2/interpolateColor.js +96 -19
  128. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  129. package/lib/commonjs/reanimated2/jestUtils.js +1 -1
  130. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  131. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +101 -16
  132. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  133. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +22 -0
  134. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
  135. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js +2 -0
  136. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  137. package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  138. package/lib/commonjs/reanimated2/js-reanimated/global.js +4 -9
  139. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
  140. package/lib/commonjs/reanimated2/js-reanimated/index.js +0 -1
  141. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  142. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +11 -0
  143. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  144. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +8 -0
  145. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  146. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +16 -12
  147. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  148. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -23
  149. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  150. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -14
  151. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  152. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -14
  153. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  154. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -15
  155. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  156. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -23
  157. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  158. package/lib/commonjs/reanimated2/layoutReanimation/index.js +13 -0
  159. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  160. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +94 -0
  161. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  162. package/lib/commonjs/reanimated2/mappers.js +18 -6
  163. package/lib/commonjs/reanimated2/mappers.js.map +1 -1
  164. package/lib/commonjs/reanimated2/mock.js +45 -0
  165. package/lib/commonjs/reanimated2/mock.js.map +1 -1
  166. package/lib/commonjs/reanimated2/mutables.js +4 -2
  167. package/lib/commonjs/reanimated2/mutables.js.map +1 -1
  168. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +42 -0
  169. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
  170. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
  171. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  172. package/lib/commonjs/reanimated2/pluginUtils.js +11 -0
  173. package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -0
  174. package/lib/commonjs/reanimated2/shareables.js +38 -11
  175. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  176. package/lib/commonjs/reanimated2/threads.js +114 -4
  177. package/lib/commonjs/reanimated2/threads.js.map +1 -1
  178. package/lib/commonjs/reanimated2/utils.js +7 -0
  179. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  180. package/lib/commonjs/reanimated2/valueSetter.js +1 -3
  181. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
  182. package/lib/module/createAnimatedComponent.js +229 -29
  183. package/lib/module/createAnimatedComponent.js.map +1 -1
  184. package/lib/module/reanimated2/Colors.js +35 -19
  185. package/lib/module/reanimated2/Colors.js.map +1 -1
  186. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +18 -34
  187. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  188. package/lib/module/reanimated2/animation/styleAnimation.js +5 -1
  189. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  190. package/lib/module/reanimated2/animation/util.js +17 -16
  191. package/lib/module/reanimated2/animation/util.js.map +1 -1
  192. package/lib/module/reanimated2/commonTypes.js +29 -0
  193. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  194. package/lib/module/reanimated2/component/FlatList.js +18 -4
  195. package/lib/module/reanimated2/component/FlatList.js.map +1 -1
  196. package/lib/module/reanimated2/core.js +30 -76
  197. package/lib/module/reanimated2/core.js.map +1 -1
  198. package/lib/module/reanimated2/errors.js +58 -0
  199. package/lib/module/reanimated2/errors.js.map +1 -0
  200. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  201. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  202. package/lib/module/reanimated2/globals.d.js.map +1 -1
  203. package/lib/module/reanimated2/hook/index.js +1 -1
  204. package/lib/module/reanimated2/hook/index.js.map +1 -1
  205. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  206. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  207. package/lib/module/reanimated2/hook/useAnimatedReaction.js +12 -1
  208. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  209. package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
  210. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  211. package/lib/module/reanimated2/hook/useAnimatedSensor.js +88 -13
  212. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  213. package/lib/module/reanimated2/hook/useAnimatedStyle.js +45 -52
  214. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  215. package/lib/module/reanimated2/hook/useDerivedValue.js +12 -1
  216. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  217. package/lib/module/reanimated2/hook/useScrollViewOffset.js +2 -2
  218. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  219. package/lib/module/reanimated2/hook/utils.js +17 -60
  220. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  221. package/lib/module/reanimated2/index.js +1 -0
  222. package/lib/module/reanimated2/index.js.map +1 -1
  223. package/lib/module/reanimated2/initializers.js +182 -0
  224. package/lib/module/reanimated2/initializers.js.map +1 -0
  225. package/lib/module/reanimated2/interpolateColor.js +96 -19
  226. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  227. package/lib/module/reanimated2/jestUtils.js +1 -1
  228. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  229. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +101 -16
  230. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  231. package/lib/module/reanimated2/js-reanimated/Mapper.js +21 -0
  232. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
  233. package/lib/module/reanimated2/js-reanimated/WebSensor.js +2 -0
  234. package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  235. package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  236. package/lib/module/reanimated2/js-reanimated/global.js +4 -9
  237. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
  238. package/lib/module/reanimated2/js-reanimated/index.js +0 -1
  239. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  240. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +9 -1
  241. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  242. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js +1 -0
  243. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  244. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +15 -10
  245. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  246. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -21
  247. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  248. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -12
  249. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  250. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
  251. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  252. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -13
  253. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  254. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -21
  255. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  256. package/lib/module/reanimated2/layoutReanimation/index.js +1 -0
  257. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  258. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +82 -0
  259. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  260. package/lib/module/reanimated2/mappers.js +16 -6
  261. package/lib/module/reanimated2/mappers.js.map +1 -1
  262. package/lib/module/reanimated2/mock.js +45 -0
  263. package/lib/module/reanimated2/mock.js.map +1 -1
  264. package/lib/module/reanimated2/mutables.js +4 -2
  265. package/lib/module/reanimated2/mutables.js.map +1 -1
  266. package/lib/module/reanimated2/platform-specific/checkVersion.js +35 -0
  267. package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
  268. package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
  269. package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  270. package/lib/module/reanimated2/pluginUtils.js +4 -0
  271. package/lib/module/reanimated2/pluginUtils.js.map +1 -0
  272. package/lib/module/reanimated2/shareables.js +38 -9
  273. package/lib/module/reanimated2/shareables.js.map +1 -1
  274. package/lib/module/reanimated2/threads.js +105 -4
  275. package/lib/module/reanimated2/threads.js.map +1 -1
  276. package/lib/module/reanimated2/utils.js +5 -0
  277. package/lib/module/reanimated2/utils.js.map +1 -1
  278. package/lib/module/reanimated2/valueSetter.js +1 -2
  279. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  280. package/package.json +9 -8
  281. package/{plugin.js → plugin/index.js} +173 -228
  282. package/react-native-reanimated.d.ts +57 -10
  283. package/scripts/reanimated_utils.rb +15 -2
  284. package/src/createAnimatedComponent.tsx +238 -28
  285. package/src/reanimated2/Colors.ts +38 -11
  286. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +63 -41
  287. package/src/reanimated2/animation/styleAnimation.ts +8 -1
  288. package/src/reanimated2/animation/util.ts +29 -16
  289. package/src/reanimated2/commonTypes.ts +28 -1
  290. package/src/reanimated2/component/FlatList.tsx +30 -5
  291. package/src/reanimated2/core.ts +45 -75
  292. package/src/reanimated2/errors.ts +57 -0
  293. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +2 -2
  294. package/src/reanimated2/globals.d.ts +34 -18
  295. package/src/reanimated2/hook/index.ts +1 -1
  296. package/src/reanimated2/hook/useAnimatedKeyboard.ts +10 -4
  297. package/src/reanimated2/hook/useAnimatedReaction.ts +12 -5
  298. package/src/reanimated2/hook/useAnimatedRef.ts +1 -4
  299. package/src/reanimated2/hook/useAnimatedSensor.ts +88 -11
  300. package/src/reanimated2/hook/useAnimatedStyle.ts +43 -45
  301. package/src/reanimated2/hook/useDerivedValue.ts +8 -1
  302. package/src/reanimated2/hook/useScrollViewOffset.ts +2 -2
  303. package/src/reanimated2/hook/utils.ts +15 -61
  304. package/src/reanimated2/index.ts +1 -0
  305. package/src/reanimated2/initializers.ts +184 -0
  306. package/src/reanimated2/interpolateColor.ts +104 -20
  307. package/src/reanimated2/jestUtils.ts +1 -1
  308. package/src/reanimated2/js-reanimated/JSReanimated.ts +105 -18
  309. package/src/reanimated2/js-reanimated/Mapper.ts +32 -0
  310. package/src/reanimated2/js-reanimated/WebSensor.ts +34 -0
  311. package/src/reanimated2/js-reanimated/commonTypes.ts +0 -1
  312. package/src/reanimated2/js-reanimated/global.ts +4 -8
  313. package/src/reanimated2/js-reanimated/index.ts +0 -1
  314. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +13 -1
  315. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
  316. package/src/reanimated2/layoutReanimation/animationsManager.ts +17 -12
  317. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
  318. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
  319. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
  320. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
  321. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
  322. package/src/reanimated2/layoutReanimation/index.ts +1 -0
  323. package/src/reanimated2/layoutReanimation/sharedTransitions/index.ts +87 -0
  324. package/src/reanimated2/mappers.ts +17 -6
  325. package/src/reanimated2/mock.ts +128 -0
  326. package/src/reanimated2/mutables.ts +2 -0
  327. package/src/reanimated2/platform-specific/checkVersion.ts +39 -0
  328. package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
  329. package/src/reanimated2/pluginUtils.ts +8 -0
  330. package/src/reanimated2/shareables.ts +47 -11
  331. package/src/reanimated2/threads.ts +103 -1
  332. package/src/reanimated2/utils.ts +6 -0
  333. package/src/reanimated2/valueSetter.ts +1 -2
  334. package/lib/commonjs/reanimated2/time.js +0 -55
  335. package/lib/commonjs/reanimated2/time.js.map +0 -1
  336. package/lib/module/reanimated2/time.js +0 -37
  337. package/lib/module/reanimated2/time.js.map +0 -1
  338. package/src/reanimated2/time.ts +0 -30
  339. /package/android/src/{main/java → reactNativeVersionPatch/ReanimatedUIManager/70}/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +0 -0
@@ -27,9 +27,17 @@ var _PlatformChecker = require("./reanimated2/PlatformChecker");
27
27
 
28
28
  var _animation = require("./reanimated2/animation");
29
29
 
30
+ var _layoutReanimation = require("./reanimated2/layoutReanimation");
31
+
32
+ var _ViewDescriptorsSet = require("./reanimated2/ViewDescriptorsSet");
33
+
30
34
  var _fabricUtils = require("./reanimated2/fabricUtils");
31
35
 
32
- var _shareables = require("./reanimated2/shareables");
36
+ var _UpdateProps = _interopRequireDefault(require("./reanimated2/UpdateProps"));
37
+
38
+ var _NativeReanimated = _interopRequireDefault(require("./reanimated2/NativeReanimated"));
39
+
40
+ var _reanimated = require("./reanimated2");
33
41
 
34
42
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
43
 
@@ -97,6 +105,74 @@ const has = (key, x) => {
97
105
  return false;
98
106
  };
99
107
 
108
+ function isInlineStyleTransform(transform) {
109
+ return transform.some(t => hasInlineStyles(t));
110
+ }
111
+
112
+ function hasInlineStyles(style) {
113
+ return Object.keys(style).some(key => {
114
+ const styleValue = style[key];
115
+ return (0, _reanimated.isSharedValue)(styleValue) || key === 'transform' && isInlineStyleTransform(styleValue);
116
+ });
117
+ }
118
+
119
+ function extractSharedValuesMapFromProps(props) {
120
+ const inlineProps = {};
121
+
122
+ for (const key in props) {
123
+ const value = props[key];
124
+
125
+ if (key === 'style') {
126
+ const styles = flattenArray(props.style ?? []);
127
+ styles.forEach(style => {
128
+ for (const [key, styleValue] of Object.entries(style)) {
129
+ if ((0, _reanimated.isSharedValue)(styleValue)) {
130
+ inlineProps[key] = styleValue;
131
+ } else if (key === 'transform' && isInlineStyleTransform(styleValue)) {
132
+ inlineProps[key] = styleValue;
133
+ }
134
+ }
135
+ });
136
+ } else if ((0, _reanimated.isSharedValue)(value)) {
137
+ inlineProps[key] = value;
138
+ }
139
+ }
140
+
141
+ return inlineProps;
142
+ }
143
+
144
+ function inlinePropsHasChanged(styles1, styles2) {
145
+ if (Object.keys(styles1).length !== Object.keys(styles2).length) {
146
+ return true;
147
+ }
148
+
149
+ for (const key of Object.keys(styles1)) {
150
+ if (styles1[key] !== styles2[key]) return true;
151
+ }
152
+
153
+ return false;
154
+ }
155
+
156
+ function getInlinePropsUpdate(inlineProps) {
157
+ 'worklet';
158
+
159
+ const update = {};
160
+
161
+ for (const [key, styleValue] of Object.entries(inlineProps)) {
162
+ if (key === 'transform') {
163
+ update[key] = styleValue.map(transform => {
164
+ return getInlinePropsUpdate(transform);
165
+ });
166
+ } else if ((0, _reanimated.isSharedValue)(styleValue)) {
167
+ update[key] = styleValue.value;
168
+ } else {
169
+ update[key] = styleValue;
170
+ }
171
+ }
172
+
173
+ return update;
174
+ }
175
+
100
176
  function createAnimatedComponent(Component, options) {
101
177
  (0, _invariant.default)(typeof Component !== 'function' || Component.prototype && Component.prototype.isReactComponent, '`createAnimatedComponent` does not support stateless functional components; ' + 'use a class component instead.');
102
178
 
@@ -120,6 +196,12 @@ function createAnimatedComponent(Component, options) {
120
196
 
121
197
  _defineProperty(this, "_component", null);
122
198
 
199
+ _defineProperty(this, "_inlinePropsViewDescriptors", null);
200
+
201
+ _defineProperty(this, "_inlinePropsMapperId", null);
202
+
203
+ _defineProperty(this, "_inlineProps", {});
204
+
123
205
  _defineProperty(this, "_setComponentRef", (0, _setAndForwardRef.default)({
124
206
  getForwardedRef: () => this.props.forwardedRef,
125
207
  setLocalRef: ref => {
@@ -128,24 +210,30 @@ function createAnimatedComponent(Component, options) {
128
210
  const {
129
211
  layout,
130
212
  entering,
131
- exiting
213
+ exiting,
214
+ sharedTransitionTag
132
215
  } = this.props;
133
216
 
134
- if ((layout || entering || exiting) && tag != null) {
217
+ if ((layout || entering || exiting || sharedTransitionTag) && tag != null) {
135
218
  if (!(0, _PlatformChecker.shouldBeUseWeb)()) {
136
219
  (0, _core.enableLayoutAnimations)(true, false);
137
220
  }
138
221
 
139
222
  if (layout) {
140
- (0, _core.configureLayoutAnimations)(tag, 'layout', maybeBuild(layout));
223
+ (0, _core.configureLayoutAnimations)(tag, _layoutReanimation.LayoutAnimationType.LAYOUT, maybeBuild(layout));
141
224
  }
142
225
 
143
226
  if (entering) {
144
- (0, _core.configureLayoutAnimations)(tag, 'entering', maybeBuild(entering));
227
+ (0, _core.configureLayoutAnimations)(tag, _layoutReanimation.LayoutAnimationType.ENTERING, maybeBuild(entering));
145
228
  }
146
229
 
147
230
  if (exiting) {
148
- (0, _core.configureLayoutAnimations)(tag, 'exiting', maybeBuild(exiting));
231
+ (0, _core.configureLayoutAnimations)(tag, _layoutReanimation.LayoutAnimationType.EXITING, maybeBuild(exiting));
232
+ }
233
+
234
+ if (sharedTransitionTag) {
235
+ const sharedElementTransition = this.props.sharedTransitionStyle ?? _layoutReanimation.DefaultSharedTransition;
236
+ (0, _core.configureLayoutAnimations)(tag, _layoutReanimation.LayoutAnimationType.SHARED_ELEMENT_TRANSITION, maybeBuild(sharedElementTransition), sharedTransitionTag);
149
237
  }
150
238
  }
151
239
 
@@ -166,16 +254,30 @@ function createAnimatedComponent(Component, options) {
166
254
  this._detachNativeEvents();
167
255
 
168
256
  this._detachStyles();
257
+
258
+ this._detachInlineProps();
169
259
  }
170
260
 
171
261
  componentDidMount() {
172
262
  this._attachNativeEvents();
173
263
 
174
264
  this._attachAnimatedStyles();
265
+
266
+ this._attachInlineProps();
267
+ }
268
+
269
+ _getEventViewRef() {
270
+ var _this$_component;
271
+
272
+ // Make sure to get the scrollable node for components that implement
273
+ // `ScrollResponder.Mixin`.
274
+ return (_this$_component = this._component) !== null && _this$_component !== void 0 && _this$_component.getScrollableNode ? this._component.getScrollableNode() : this._component;
175
275
  }
176
276
 
177
277
  _attachNativeEvents() {
178
- const viewTag = (0, _reactNative.findNodeHandle)(this);
278
+ const node = this._getEventViewRef();
279
+
280
+ const viewTag = (0, _reactNative.findNodeHandle)(options !== null && options !== void 0 && options.setNativeProps ? this : node);
179
281
 
180
282
  for (const key in this.props) {
181
283
  const prop = this.props[key];
@@ -215,11 +317,11 @@ function createAnimatedComponent(Component, options) {
215
317
  }
216
318
 
217
319
  if (global._IS_FABRIC) {
218
- const shadowNodeWrapper = (0, _fabricUtils.getShadowNodeWrapperFromRef)(this);
320
+ const viewTag = this._viewTag;
219
321
  (0, _core.runOnUI)(() => {
220
322
  'worklet';
221
323
 
222
- _removeShadowNodeFromRegistry(shadowNodeWrapper);
324
+ _removeShadowNodeFromRegistry(viewTag);
223
325
  })();
224
326
  }
225
327
  }
@@ -262,31 +364,26 @@ function createAnimatedComponent(Component, options) {
262
364
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
263
365
  options.setNativeProps(this._component, props);
264
366
  } else {
265
- var _this$_component, _this$_component$setN;
367
+ var _this$_component2, _this$_component2$set;
266
368
 
267
369
  // eslint-disable-next-line no-unused-expressions
268
- (_this$_component = this._component) === null || _this$_component === void 0 ? void 0 : (_this$_component$setN = _this$_component.setNativeProps) === null || _this$_component$setN === void 0 ? void 0 : _this$_component$setN.call(_this$_component, props);
370
+ (_this$_component2 = this._component) === null || _this$_component2 === void 0 ? void 0 : (_this$_component2$set = _this$_component2.setNativeProps) === null || _this$_component2$set === void 0 ? void 0 : _this$_component2$set.call(_this$_component2, props);
269
371
  }
270
372
  }
271
373
 
272
- _attachAnimatedStyles() {
273
- var _this$props$animatedP3;
274
-
275
- const styles = this.props.style ? onlyAnimatedStyles(flattenArray(this.props.style)) : [];
276
- const prevStyles = this._styles;
277
- this._styles = styles;
278
- const prevAnimatedProps = this._animatedProps;
279
- this._animatedProps = this.props.animatedProps;
374
+ _getViewInfo() {
280
375
  let viewTag;
281
376
  let viewName;
282
377
  let shadowNodeWrapper = null;
378
+ let viewConfig;
283
379
 
284
380
  if (_reactNative.Platform.OS === 'web') {
285
381
  viewTag = (0, _reactNative.findNodeHandle)(this);
286
382
  viewName = null;
287
383
  shadowNodeWrapper = null;
384
+ viewConfig = null;
288
385
  } else {
289
- var _hostInstance$viewCon, _this$props$animatedP2;
386
+ var _hostInstance$viewCon;
290
387
 
291
388
  // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx
292
389
  const hostInstance = _RNRenderer.RNRenderer.findHostInstance_DEPRECATED(this);
@@ -302,19 +399,45 @@ function createAnimatedComponent(Component, options) {
302
399
  * The name we're looking for is in the field named uiViewClassName.
303
400
  */
304
401
 
305
- viewName = hostInstance === null || hostInstance === void 0 ? void 0 : (_hostInstance$viewCon = hostInstance.viewConfig) === null || _hostInstance$viewCon === void 0 ? void 0 : _hostInstance$viewCon.uiViewClassName; // update UI props whitelist for this view
306
-
307
- const hasReanimated2Props = ((_this$props$animatedP2 = this.props.animatedProps) === null || _this$props$animatedP2 === void 0 ? void 0 : _this$props$animatedP2.viewDescriptors) || styles.length;
308
-
309
- if (hasReanimated2Props && hostInstance !== null && hostInstance !== void 0 && hostInstance.viewConfig) {
310
- (0, _ConfigHelper.adaptViewConfig)(hostInstance.viewConfig);
311
- }
402
+ viewName = hostInstance === null || hostInstance === void 0 ? void 0 : (_hostInstance$viewCon = hostInstance.viewConfig) === null || _hostInstance$viewCon === void 0 ? void 0 : _hostInstance$viewCon.uiViewClassName;
403
+ viewConfig = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.viewConfig;
312
404
 
313
405
  if (global._IS_FABRIC) {
314
- shadowNodeWrapper = (0, _shareables.makeShareableShadowNodeWrapper)((0, _fabricUtils.getShadowNodeWrapperFromRef)(this));
406
+ shadowNodeWrapper = (0, _fabricUtils.getShadowNodeWrapperFromRef)(this);
315
407
  }
316
408
  }
317
409
 
410
+ return {
411
+ viewTag,
412
+ viewName,
413
+ shadowNodeWrapper,
414
+ viewConfig
415
+ };
416
+ }
417
+
418
+ _attachAnimatedStyles() {
419
+ var _this$props$animatedP2, _this$props$animatedP3;
420
+
421
+ const styles = this.props.style ? onlyAnimatedStyles(flattenArray(this.props.style)) : [];
422
+ const prevStyles = this._styles;
423
+ this._styles = styles;
424
+ const prevAnimatedProps = this._animatedProps;
425
+ this._animatedProps = this.props.animatedProps;
426
+
427
+ const {
428
+ viewTag,
429
+ viewName,
430
+ shadowNodeWrapper,
431
+ viewConfig
432
+ } = this._getViewInfo(); // update UI props whitelist for this view
433
+
434
+
435
+ const hasReanimated2Props = ((_this$props$animatedP2 = this.props.animatedProps) === null || _this$props$animatedP2 === void 0 ? void 0 : _this$props$animatedP2.viewDescriptors) || styles.length;
436
+
437
+ if (hasReanimated2Props && viewConfig) {
438
+ (0, _ConfigHelper.adaptViewConfig)(viewConfig);
439
+ }
440
+
318
441
  this._viewTag = viewTag; // remove old styles
319
442
 
320
443
  if (prevStyles) {
@@ -371,10 +494,73 @@ function createAnimatedComponent(Component, options) {
371
494
  }
372
495
  }
373
496
 
497
+ _attachInlineProps() {
498
+ const newInlineProps = extractSharedValuesMapFromProps(this.props);
499
+ const hasChanged = inlinePropsHasChanged(newInlineProps, this._inlineProps);
500
+
501
+ if (hasChanged) {
502
+ if (!this._inlinePropsViewDescriptors) {
503
+ this._inlinePropsViewDescriptors = (0, _ViewDescriptorsSet.makeViewDescriptorsSet)();
504
+
505
+ const {
506
+ viewTag,
507
+ viewName,
508
+ shadowNodeWrapper,
509
+ viewConfig
510
+ } = this._getViewInfo();
511
+
512
+ if (Object.keys(newInlineProps).length && viewConfig) {
513
+ (0, _ConfigHelper.adaptViewConfig)(viewConfig);
514
+ }
515
+
516
+ this._inlinePropsViewDescriptors.add({
517
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
518
+ tag: viewTag,
519
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
520
+ name: viewName,
521
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
522
+ shadowNodeWrapper: shadowNodeWrapper
523
+ });
524
+ }
525
+
526
+ const sharableViewDescriptors = this._inlinePropsViewDescriptors.sharableViewDescriptors;
527
+ const maybeViewRef = _NativeReanimated.default.native ? undefined : {
528
+ items: new Set([this])
529
+ }; // see makeViewsRefSet
530
+
531
+ const updaterFunction = () => {
532
+ 'worklet';
533
+
534
+ const update = getInlinePropsUpdate(newInlineProps);
535
+ (0, _UpdateProps.default)(sharableViewDescriptors, update, maybeViewRef);
536
+ };
537
+
538
+ this._inlineProps = newInlineProps;
539
+
540
+ if (this._inlinePropsMapperId) {
541
+ (0, _core.stopMapper)(this._inlinePropsMapperId);
542
+ }
543
+
544
+ this._inlinePropsMapperId = null;
545
+
546
+ if (Object.keys(newInlineProps).length) {
547
+ this._inlinePropsMapperId = (0, _core.startMapper)(updaterFunction, Object.values(newInlineProps));
548
+ }
549
+ }
550
+ }
551
+
552
+ _detachInlineProps() {
553
+ if (this._inlinePropsMapperId) {
554
+ (0, _core.stopMapper)(this._inlinePropsMapperId);
555
+ }
556
+ }
557
+
374
558
  componentDidUpdate(prevProps) {
375
559
  this._reattachNativeEvents(prevProps);
376
560
 
377
561
  this._attachAnimatedStyles();
562
+
563
+ this._attachInlineProps();
378
564
  }
379
565
 
380
566
  _filterNonAnimatedProps(inputProps) {
@@ -398,6 +584,20 @@ function createAnimatedComponent(Component, options) {
398
584
  }
399
585
 
400
586
  return this.initialStyle;
587
+ } else if (hasInlineStyles(style)) {
588
+ if (this._isFirstRender) {
589
+ return getInlinePropsUpdate(style);
590
+ }
591
+
592
+ const newStyle = {};
593
+
594
+ for (const [key, styleValue] of Object.entries(style)) {
595
+ if (!(0, _reanimated.isSharedValue)(styleValue) && !(key === 'transform' && isInlineStyleTransform(styleValue))) {
596
+ newStyle[key] = styleValue;
597
+ }
598
+ }
599
+
600
+ return newStyle;
401
601
  } else {
402
602
  return style;
403
603
  }
@@ -422,6 +622,10 @@ function createAnimatedComponent(Component, options) {
422
622
  } else {
423
623
  props[key] = dummyListener;
424
624
  }
625
+ } else if ((0, _reanimated.isSharedValue)(value)) {
626
+ if (this._isFirstRender) {
627
+ props[key] = value.value;
628
+ }
425
629
  } else if (key !== 'onGestureHandlerStateChange' || !(0, _PlatformChecker.isChromeDebugger)()) {
426
630
  props[key] = value;
427
631
  }
@@ -1 +1 @@
1
- {"version":3,"names":["dummyListener","maybeBuild","layoutAnimationOrBuilder","isAnimationBuilder","value","build","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","createAnimatedComponent","Component","options","invariant","prototype","isReactComponent","AnimatedComponent","React","constructor","props","setAndForwardRef","getForwardedRef","forwardedRef","setLocalRef","ref","tag","findNodeHandle","layout","entering","exiting","shouldBeUseWeb","enableLayoutAnimations","configureLayoutAnimations","_component","isJest","animatedStyle","componentWillUnmount","_detachNativeEvents","_detachStyles","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","viewTag","prop","current","WorkletEventHandler","registerForEvents","unregisterFromEvents","Platform","OS","_styles","remove","_viewTag","animatedProps","global","_IS_FABRIC","shadowNodeWrapper","getShadowNodeWrapperFromRef","runOnUI","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","setNativeProps","prevStyles","prevAnimatedProps","_animatedProps","viewName","hostInstance","RNRenderer","findHostInstance_DEPRECATED","Error","_nativeTag","viewConfig","uiViewClassName","hasReanimated2Props","length","adaptViewConfig","makeShareableShadowNodeWrapper","hasOneSameStyle","prevStyle","isPresent","some","add","name","initial","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","map","_isFirstRender","initialStyle","initialUpdaterRun","updater","StyleSheet","flatten","animatedProp","Object","keys","eventNames","eventName","listeners","isChromeDebugger","render","platformProps","select","web","default","collapsable","_setComponentRef","displayName","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["import React, { Component, ComponentType, MutableRefObject, Ref } from 'react';\nimport { findNodeHandle, Platform, StyleSheet } from 'react-native';\nimport WorkletEventHandler from './reanimated2/WorkletEventHandler';\nimport setAndForwardRef from './setAndForwardRef';\nimport './reanimated2/layoutReanimation/animationsManager';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n configureLayoutAnimations,\n enableLayoutAnimations,\n runOnUI,\n} from './reanimated2/core';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\nimport { makeShareableShadowNodeWrapper } from './reanimated2/shareables';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\nfunction maybeBuild(\n layoutAnimationOrBuilder:\n | ILayoutAnimationBuilder\n | LayoutAnimationFunction\n | Keyframe\n): LayoutAnimationFunction | Keyframe {\n const isAnimationBuilder = (\n value: ILayoutAnimationBuilder | LayoutAnimationFunction | Keyframe\n ): value is ILayoutAnimationBuilder =>\n 'build' in layoutAnimationOrBuilder &&\n typeof layoutAnimationOrBuilder.build === 'function';\n\n if (isAnimationBuilder(layoutAnimationOrBuilder)) {\n return layoutAnimationOrBuilder.build();\n } else {\n return layoutAnimationOrBuilder;\n }\n}\n\ntype NestedArray<T> = T | NestedArray<T>[];\nfunction flattenArray<T>(array: NestedArray<T>): T[] {\n if (!Array.isArray(array)) {\n return [array];\n }\n const resultArr: T[] = [];\n\n const _flattenArray = (arr: NestedArray<T>[]): void => {\n arr.forEach((item) => {\n if (Array.isArray(item)) {\n _flattenArray(item);\n } else {\n resultArr.push(item);\n }\n });\n };\n _flattenArray(array);\n return resultArr;\n}\n\nfunction onlyAnimatedStyles(styles: StyleProps[]) {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\nconst has = <K extends string>(\n key: K,\n x: unknown\n): x is { [key in K]: unknown } => {\n if (typeof x === 'function' || typeof x === 'object') {\n if (x === null || x === undefined) {\n return false;\n } else {\n return key in x;\n }\n }\n return false;\n};\n\ninterface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?:\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder;\n entering?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n exiting?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n};\n\ntype Options<P> = {\n setNativeProps: (ref: ComponentRef, props: P) => void;\n};\n\ninterface ComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => ComponentRef;\n}\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n\nexport default function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): ComponentType<AnimatedComponentProps<InitialComponentProps>> {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n '`createAnimatedComponent` does not support stateless functional components; ' +\n 'use a class component instead.'\n );\n\n class AnimatedComponent extends React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n initialStyle = {};\n _component: ComponentRef | null = null;\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n }\n\n _attachNativeEvents() {\n const viewTag = findNodeHandle(this);\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (Platform.OS === 'web' && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (global._IS_FABRIC) {\n const shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(shadowNodeWrapper);\n })();\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n let viewTag: number | undefined;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === undefined) {\n viewTag = prop.current.viewTag;\n }\n }\n }\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n prop.current.registerForEvents(viewTag!, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component!, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n this._component?.setNativeProps?.(props);\n }\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);\n if (!hostInstance) {\n throw new Error(\n 'Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && hostInstance?.viewConfig) {\n adaptViewConfig(hostInstance.viewConfig);\n }\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = makeShareableShadowNodeWrapper(\n getShadowNodeWrapperFromRef(this)\n );\n }\n }\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n }\n\n _setComponentRef = setAndForwardRef<Component>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n const tag = findNodeHandle(ref);\n const { layout, entering, exiting } = this.props;\n if ((layout || entering || exiting) && tag != null) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(tag, 'layout', maybeBuild(layout));\n }\n if (entering) {\n configureLayoutAnimations(tag, 'entering', maybeBuild(entering));\n }\n if (exiting) {\n configureLayoutAnimations(tag, 'exiting', maybeBuild(exiting));\n }\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n _filterNonAnimatedProps(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n style.viewsRef.add(this);\n if (this._isFirstRender) {\n this.initialStyle = {\n ...style.initial.value,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this.initialStyle;\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((key) => {\n props[key] = animatedProp.initial?.value[key];\n animatedProp.viewsRef?.add(this);\n });\n }\n } else if (\n has('current', value) &&\n value.current instanceof WorkletEventHandler\n ) {\n if (value.current.eventNames.length > 0) {\n value.current.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.current)\n ? (value.current.listeners as Record<string, unknown>)[\n eventName\n ]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (\n key !== 'onGestureHandlerStateChange' ||\n !isChromeDebugger()\n ) {\n props[key] = value;\n }\n }\n return props;\n }\n\n render() {\n const props = this._filterNonAnimatedProps(this.props);\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n if (this._isFirstRender) {\n this._isFirstRender = false;\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n return (\n <Component {...props} ref={this._setComponentRef} {...platformProps} />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n });\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAKA;;AAKA;;AAgBA;;AACA;;;;;;;;AAEA,SAASA,aAAT,GAAyB,CACvB;EACA;AACD;;AAED,SAASC,UAAT,CACEC,wBADF,EAKsC;EACpC,MAAMC,kBAAkB,GACtBC,KADyB,IAGzB,WAAWF,wBAAX,IACA,OAAOA,wBAAwB,CAACG,KAAhC,KAA0C,UAJ5C;;EAMA,IAAIF,kBAAkB,CAACD,wBAAD,CAAtB,EAAkD;IAChD,OAAOA,wBAAwB,CAACG,KAAzB,EAAP;EACD,CAFD,MAEO;IACL,OAAOH,wBAAP;EACD;AACF;;AAGD,SAASI,YAAT,CAAyBC,KAAzB,EAAqD;EACnD,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,KAAd,CAAL,EAA2B;IACzB,OAAO,CAACA,KAAD,CAAP;EACD;;EACD,MAAMG,SAAc,GAAG,EAAvB;;EAEA,MAAMC,aAAa,GAAIC,GAAD,IAAiC;IACrDA,GAAG,CAACC,OAAJ,CAAaC,IAAD,IAAU;MACpB,IAAIN,KAAK,CAACC,OAAN,CAAcK,IAAd,CAAJ,EAAyB;QACvBH,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S,CAAC0E,IAAnC,IAA2C,WAC5C,GAFD;EAIA,oBAAOpE,cAAA,CAAMiG,UAAN,CAA4B,CAAC/F,KAAD,EAAQK,GAAR,KAAgB;IACjD,oBACE,6BAAC,iBAAD,eACML,KADN,EAEOK,GAAG,KAAK,IAAR,GAAe,IAAf,GAAsB;MAAEF,YAAY,EAAEE;IAAhB,CAF7B,EADF;EAMD,CAPM,CAAP;AAQD"}
1
+ {"version":3,"names":["dummyListener","maybeBuild","layoutAnimationOrBuilder","isAnimationBuilder","value","build","flattenArray","array","Array","isArray","resultArr","_flattenArray","arr","forEach","item","push","onlyAnimatedStyles","styles","filter","style","viewDescriptors","isSameAnimatedStyle","style1","style2","viewsRef","isSameAnimatedProps","has","key","x","undefined","isInlineStyleTransform","transform","some","t","hasInlineStyles","Object","keys","styleValue","isSharedValue","extractSharedValuesMapFromProps","props","inlineProps","entries","inlinePropsHasChanged","styles1","styles2","length","getInlinePropsUpdate","update","map","createAnimatedComponent","Component","options","invariant","prototype","isReactComponent","AnimatedComponent","React","constructor","setAndForwardRef","getForwardedRef","forwardedRef","setLocalRef","ref","tag","findNodeHandle","layout","entering","exiting","sharedTransitionTag","shouldBeUseWeb","enableLayoutAnimations","configureLayoutAnimations","LayoutAnimationType","LAYOUT","ENTERING","EXITING","sharedElementTransition","sharedTransitionStyle","DefaultSharedTransition","SHARED_ELEMENT_TRANSITION","_component","isJest","animatedStyle","componentWillUnmount","_detachNativeEvents","_detachStyles","_detachInlineProps","componentDidMount","_attachNativeEvents","_attachAnimatedStyles","_attachInlineProps","_getEventViewRef","getScrollableNode","node","viewTag","setNativeProps","prop","current","WorkletEventHandler","registerForEvents","unregisterFromEvents","Platform","OS","_styles","remove","_viewTag","animatedProps","global","_IS_FABRIC","runOnUI","_removeShadowNodeFromRegistry","_reattachNativeEvents","prevProps","reattachNeeded","_updateFromNative","_getViewInfo","viewName","shadowNodeWrapper","viewConfig","hostInstance","RNRenderer","findHostInstance_DEPRECATED","Error","_nativeTag","uiViewClassName","getShadowNodeWrapperFromRef","prevStyles","prevAnimatedProps","_animatedProps","hasReanimated2Props","adaptViewConfig","hasOneSameStyle","prevStyle","isPresent","add","name","initial","newInlineProps","hasChanged","_inlineProps","_inlinePropsViewDescriptors","makeViewDescriptorsSet","sharableViewDescriptors","maybeViewRef","NativeReanimatedModule","native","items","Set","updaterFunction","updateProps","_inlinePropsMapperId","stopMapper","startMapper","values","componentDidUpdate","_filterNonAnimatedProps","inputProps","styleProp","processedStyle","_isFirstRender","initialStyle","initialUpdaterRun","updater","newStyle","StyleSheet","flatten","animatedProp","eventNames","eventName","listeners","isChromeDebugger","render","platformProps","select","web","default","collapsable","_setComponentRef","displayName","forwardRef"],"sources":["createAnimatedComponent.tsx"],"sourcesContent":["import React, { Component, ComponentType, MutableRefObject, Ref } from 'react';\nimport { findNodeHandle, Platform, StyleSheet } from 'react-native';\nimport WorkletEventHandler from './reanimated2/WorkletEventHandler';\nimport setAndForwardRef from './setAndForwardRef';\nimport './reanimated2/layoutReanimation/animationsManager';\nimport invariant from 'invariant';\nimport { adaptViewConfig } from './ConfigHelper';\nimport { RNRenderer } from './reanimated2/platform-specific/RNRenderer';\nimport {\n configureLayoutAnimations,\n enableLayoutAnimations,\n runOnUI,\n startMapper,\n stopMapper,\n} from './reanimated2/core';\nimport {\n isJest,\n isChromeDebugger,\n shouldBeUseWeb,\n} from './reanimated2/PlatformChecker';\nimport { initialUpdaterRun } from './reanimated2/animation';\nimport {\n BaseAnimationBuilder,\n DefaultSharedTransition,\n EntryExitAnimationFunction,\n ILayoutAnimationBuilder,\n LayoutAnimationFunction,\n LayoutAnimationType,\n} from './reanimated2/layoutReanimation';\nimport {\n SharedValue,\n StyleProps,\n ShadowNodeWrapper,\n} from './reanimated2/commonTypes';\nimport {\n makeViewDescriptorsSet,\n ViewDescriptorsSet,\n ViewRefSet,\n} from './reanimated2/ViewDescriptorsSet';\nimport { getShadowNodeWrapperFromRef } from './reanimated2/fabricUtils';\nimport updateProps from './reanimated2/UpdateProps';\nimport NativeReanimatedModule from './reanimated2/NativeReanimated';\nimport { isSharedValue } from './reanimated2';\n\nfunction dummyListener() {\n // empty listener we use to assign to listener properties for which animated\n // event is used.\n}\n\nfunction maybeBuild(\n layoutAnimationOrBuilder:\n | ILayoutAnimationBuilder\n | LayoutAnimationFunction\n | Keyframe\n): LayoutAnimationFunction | Keyframe {\n const isAnimationBuilder = (\n value: ILayoutAnimationBuilder | LayoutAnimationFunction | Keyframe\n ): value is ILayoutAnimationBuilder =>\n 'build' in layoutAnimationOrBuilder &&\n typeof layoutAnimationOrBuilder.build === 'function';\n\n if (isAnimationBuilder(layoutAnimationOrBuilder)) {\n return layoutAnimationOrBuilder.build();\n } else {\n return layoutAnimationOrBuilder;\n }\n}\n\ntype NestedArray<T> = T | NestedArray<T>[];\nfunction flattenArray<T>(array: NestedArray<T>): T[] {\n if (!Array.isArray(array)) {\n return [array];\n }\n const resultArr: T[] = [];\n\n const _flattenArray = (arr: NestedArray<T>[]): void => {\n arr.forEach((item) => {\n if (Array.isArray(item)) {\n _flattenArray(item);\n } else {\n resultArr.push(item);\n }\n });\n };\n _flattenArray(array);\n return resultArr;\n}\n\nfunction onlyAnimatedStyles(styles: StyleProps[]) {\n return styles.filter((style) => style?.viewDescriptors);\n}\n\nfunction isSameAnimatedStyle(\n style1?: StyleProps,\n style2?: StyleProps\n): boolean {\n // We cannot use equality check to compare useAnimatedStyle outputs directly.\n // Instead, we can compare its viewsRefs.\n return style1?.viewsRef === style2?.viewsRef;\n}\n\nconst isSameAnimatedProps = isSameAnimatedStyle;\n\nconst has = <K extends string>(\n key: K,\n x: unknown\n): x is { [key in K]: unknown } => {\n if (typeof x === 'function' || typeof x === 'object') {\n if (x === null || x === undefined) {\n return false;\n } else {\n return key in x;\n }\n }\n return false;\n};\n\nfunction isInlineStyleTransform(transform: any): boolean {\n return transform.some((t: Record<string, any>) => hasInlineStyles(t));\n}\n\nfunction hasInlineStyles(style: StyleProps): boolean {\n return Object.keys(style).some((key) => {\n const styleValue = style[key];\n return (\n isSharedValue(styleValue) ||\n (key === 'transform' && isInlineStyleTransform(styleValue))\n );\n });\n}\n\nfunction extractSharedValuesMapFromProps(\n props: AnimatedComponentProps<InitialComponentProps>\n): Record<string, any> {\n const inlineProps: Record<string, any> = {};\n\n for (const key in props) {\n const value = props[key];\n if (key === 'style') {\n const styles = flattenArray<StyleProps>(props.style ?? []);\n styles.forEach((style) => {\n for (const [key, styleValue] of Object.entries(style)) {\n if (isSharedValue(styleValue)) {\n inlineProps[key] = styleValue;\n } else if (\n key === 'transform' &&\n isInlineStyleTransform(styleValue)\n ) {\n inlineProps[key] = styleValue;\n }\n }\n });\n } else if (isSharedValue(value)) {\n inlineProps[key] = value;\n }\n }\n\n return inlineProps;\n}\n\nfunction inlinePropsHasChanged(styles1: StyleProps, styles2: StyleProps) {\n if (Object.keys(styles1).length !== Object.keys(styles2).length) {\n return true;\n }\n\n for (const key of Object.keys(styles1)) {\n if (styles1[key] !== styles2[key]) return true;\n }\n\n return false;\n}\n\nfunction getInlinePropsUpdate(inlineProps: Record<string, any>) {\n 'worklet';\n const update: Record<string, any> = {};\n for (const [key, styleValue] of Object.entries(inlineProps)) {\n if (key === 'transform') {\n update[key] = styleValue.map((transform: Record<string, any>) => {\n return getInlinePropsUpdate(transform);\n });\n } else if (isSharedValue(styleValue)) {\n update[key] = styleValue.value;\n } else {\n update[key] = styleValue;\n }\n }\n return update;\n}\n\ninterface AnimatedProps extends Record<string, unknown> {\n viewDescriptors?: ViewDescriptorsSet;\n viewsRef?: ViewRefSet<unknown>;\n initial?: SharedValue<StyleProps>;\n}\n\nexport type AnimatedComponentProps<P extends Record<string, unknown>> = P & {\n forwardedRef?: Ref<Component>;\n style?: NestedArray<StyleProps>;\n animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n animatedStyle?: StyleProps;\n layout?:\n | BaseAnimationBuilder\n | ILayoutAnimationBuilder\n | typeof BaseAnimationBuilder;\n entering?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n exiting?:\n | BaseAnimationBuilder\n | typeof BaseAnimationBuilder\n | EntryExitAnimationFunction\n | Keyframe;\n sharedTransitionTag?: string;\n sharedTransitionStyle?: ILayoutAnimationBuilder;\n};\n\ntype Options<P> = {\n setNativeProps: (ref: ComponentRef, props: P) => void;\n};\n\ninterface ComponentRef extends Component {\n setNativeProps?: (props: Record<string, unknown>) => void;\n getScrollableNode?: () => ComponentRef;\n}\n\nexport interface InitialComponentProps extends Record<string, unknown> {\n ref?: Ref<Component>;\n collapsable?: boolean;\n}\n\nexport default function createAnimatedComponent(\n Component: ComponentType<InitialComponentProps>,\n options?: Options<InitialComponentProps>\n): ComponentType<AnimatedComponentProps<InitialComponentProps>> {\n invariant(\n typeof Component !== 'function' ||\n (Component.prototype && Component.prototype.isReactComponent),\n '`createAnimatedComponent` does not support stateless functional components; ' +\n 'use a class component instead.'\n );\n\n class AnimatedComponent extends React.Component<\n AnimatedComponentProps<InitialComponentProps>\n > {\n _styles: StyleProps[] | null = null;\n _animatedProps?: Partial<AnimatedComponentProps<AnimatedProps>>;\n _viewTag = -1;\n _isFirstRender = true;\n animatedStyle: { value: StyleProps } = { value: {} };\n initialStyle = {};\n _component: ComponentRef | null = null;\n _inlinePropsViewDescriptors: ViewDescriptorsSet | null = null;\n _inlinePropsMapperId: number | null = null;\n _inlineProps: StyleProps = {};\n static displayName: string;\n\n constructor(props: AnimatedComponentProps<InitialComponentProps>) {\n super(props);\n if (isJest()) {\n this.animatedStyle = { value: {} };\n }\n }\n\n componentWillUnmount() {\n this._detachNativeEvents();\n this._detachStyles();\n this._detachInlineProps();\n }\n\n componentDidMount() {\n this._attachNativeEvents();\n this._attachAnimatedStyles();\n this._attachInlineProps();\n }\n\n _getEventViewRef() {\n // Make sure to get the scrollable node for components that implement\n // `ScrollResponder.Mixin`.\n return this._component?.getScrollableNode\n ? this._component.getScrollableNode()\n : this._component;\n }\n\n _attachNativeEvents() {\n const node = this._getEventViewRef();\n const viewTag = findNodeHandle(options?.setNativeProps ? this : node);\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.registerForEvents(viewTag as number, key);\n }\n }\n }\n\n _detachNativeEvents() {\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n }\n\n _detachStyles() {\n if (Platform.OS === 'web' && this._styles !== null) {\n for (const style of this._styles) {\n if (style?.viewsRef) {\n style.viewsRef.remove(this);\n }\n }\n } else if (this._viewTag !== -1 && this._styles !== null) {\n for (const style of this._styles) {\n style.viewDescriptors.remove(this._viewTag);\n }\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.remove(this._viewTag);\n }\n if (global._IS_FABRIC) {\n const viewTag = this._viewTag;\n runOnUI(() => {\n 'worklet';\n _removeShadowNodeFromRegistry(viewTag);\n })();\n }\n }\n }\n\n _reattachNativeEvents(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n let viewTag: number | undefined;\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler\n ) {\n if (viewTag === undefined) {\n viewTag = prop.current.viewTag;\n }\n }\n }\n for (const key in prevProps) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n prop.current.unregisterFromEvents();\n }\n }\n\n for (const key in this.props) {\n const prop = this.props[key];\n if (\n has('current', prop) &&\n prop.current instanceof WorkletEventHandler &&\n prop.current.reattachNeeded\n ) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n prop.current.registerForEvents(viewTag!, key);\n prop.current.reattachNeeded = false;\n }\n }\n }\n\n _updateFromNative(props: StyleProps) {\n if (options?.setNativeProps) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n options.setNativeProps(this._component!, props);\n } else {\n // eslint-disable-next-line no-unused-expressions\n this._component?.setNativeProps?.(props);\n }\n }\n\n _getViewInfo() {\n let viewTag: number | null;\n let viewName: string | null;\n let shadowNodeWrapper: ShadowNodeWrapper | null = null;\n let viewConfig;\n if (Platform.OS === 'web') {\n viewTag = findNodeHandle(this);\n viewName = null;\n shadowNodeWrapper = null;\n viewConfig = null;\n } else {\n // hostInstance can be null for a component that doesn't render anything (render function returns null). Example: svg Stop: https://github.com/react-native-svg/react-native-svg/blob/develop/src/elements/Stop.tsx\n const hostInstance = RNRenderer.findHostInstance_DEPRECATED(this);\n if (!hostInstance) {\n throw new Error(\n 'Cannot find host instance for this component. Maybe it renders nothing?'\n );\n }\n // we can access view tag in the same way it's accessed here https://github.com/facebook/react/blob/e3f4eb7272d4ca0ee49f27577156b57eeb07cf73/packages/react-native-renderer/src/ReactFabric.js#L146\n viewTag = hostInstance?._nativeTag;\n /**\n * RN uses viewConfig for components for storing different properties of the component(example: https://github.com/facebook/react-native/blob/master/Libraries/Components/ScrollView/ScrollViewViewConfig.js#L16).\n * The name we're looking for is in the field named uiViewClassName.\n */\n viewName = hostInstance?.viewConfig?.uiViewClassName;\n\n viewConfig = hostInstance?.viewConfig;\n\n if (global._IS_FABRIC) {\n shadowNodeWrapper = getShadowNodeWrapperFromRef(this);\n }\n }\n return { viewTag, viewName, shadowNodeWrapper, viewConfig };\n }\n\n _attachAnimatedStyles() {\n const styles = this.props.style\n ? onlyAnimatedStyles(flattenArray<StyleProps>(this.props.style))\n : [];\n const prevStyles = this._styles;\n this._styles = styles;\n\n const prevAnimatedProps = this._animatedProps;\n this._animatedProps = this.props.animatedProps;\n\n const { viewTag, viewName, shadowNodeWrapper, viewConfig } =\n this._getViewInfo();\n\n // update UI props whitelist for this view\n const hasReanimated2Props =\n this.props.animatedProps?.viewDescriptors || styles.length;\n if (hasReanimated2Props && viewConfig) {\n adaptViewConfig(viewConfig);\n }\n\n this._viewTag = viewTag as number;\n\n // remove old styles\n if (prevStyles) {\n // in most of the cases, views have only a single animated style and it remains unchanged\n const hasOneSameStyle =\n styles.length === 1 &&\n prevStyles.length === 1 &&\n isSameAnimatedStyle(styles[0], prevStyles[0]);\n\n if (!hasOneSameStyle) {\n // otherwise, remove each style that is not present in new styles\n for (const prevStyle of prevStyles) {\n const isPresent = styles.some((style) =>\n isSameAnimatedStyle(style, prevStyle)\n );\n if (!isPresent) {\n prevStyle.viewDescriptors.remove(viewTag);\n }\n }\n }\n }\n\n styles.forEach((style) => {\n style.viewDescriptors.add({\n tag: viewTag,\n name: viewName,\n shadowNodeWrapper,\n });\n if (isJest()) {\n /**\n * We need to connect Jest's TestObject instance whose contains just props object\n * with the updateProps() function where we update the properties of the component.\n * We can't update props object directly because TestObject contains a copy of props - look at render function:\n * const props = this._filterNonAnimatedProps(this.props);\n */\n this.animatedStyle.value = {\n ...this.animatedStyle.value,\n ...style.initial.value,\n };\n style.animatedStyle.current = this.animatedStyle;\n }\n });\n\n // detach old animatedProps\n if (\n prevAnimatedProps &&\n !isSameAnimatedProps(prevAnimatedProps, this.props.animatedProps)\n ) {\n prevAnimatedProps.viewDescriptors!.remove(viewTag as number);\n }\n\n // attach animatedProps property\n if (this.props.animatedProps?.viewDescriptors) {\n this.props.animatedProps.viewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n }\n\n _attachInlineProps() {\n const newInlineProps: Record<string, any> =\n extractSharedValuesMapFromProps(this.props);\n const hasChanged = inlinePropsHasChanged(\n newInlineProps,\n this._inlineProps\n );\n\n if (hasChanged) {\n if (!this._inlinePropsViewDescriptors) {\n this._inlinePropsViewDescriptors = makeViewDescriptorsSet();\n\n const { viewTag, viewName, shadowNodeWrapper, viewConfig } =\n this._getViewInfo();\n\n if (Object.keys(newInlineProps).length && viewConfig) {\n adaptViewConfig(viewConfig);\n }\n\n this._inlinePropsViewDescriptors.add({\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n tag: viewTag!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n name: viewName!,\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n shadowNodeWrapper: shadowNodeWrapper!,\n });\n }\n const sharableViewDescriptors =\n this._inlinePropsViewDescriptors.sharableViewDescriptors;\n\n const maybeViewRef = NativeReanimatedModule.native\n ? undefined\n : ({ items: new Set([this]) } as ViewRefSet<any>); // see makeViewsRefSet\n\n const updaterFunction = () => {\n 'worklet';\n const update = getInlinePropsUpdate(newInlineProps);\n updateProps(sharableViewDescriptors, update, maybeViewRef);\n };\n this._inlineProps = newInlineProps;\n if (this._inlinePropsMapperId) {\n stopMapper(this._inlinePropsMapperId);\n }\n this._inlinePropsMapperId = null;\n if (Object.keys(newInlineProps).length) {\n this._inlinePropsMapperId = startMapper(\n updaterFunction,\n Object.values(newInlineProps)\n );\n }\n }\n }\n\n _detachInlineProps() {\n if (this._inlinePropsMapperId) {\n stopMapper(this._inlinePropsMapperId);\n }\n }\n\n componentDidUpdate(\n prevProps: AnimatedComponentProps<InitialComponentProps>\n ) {\n this._reattachNativeEvents(prevProps);\n this._attachAnimatedStyles();\n this._attachInlineProps();\n }\n\n _setComponentRef = setAndForwardRef<Component>({\n getForwardedRef: () =>\n this.props.forwardedRef as MutableRefObject<\n Component<Record<string, unknown>, Record<string, unknown>, unknown>\n >,\n setLocalRef: (ref) => {\n // TODO update config\n const tag = findNodeHandle(ref);\n const { layout, entering, exiting, sharedTransitionTag } = this.props;\n if (\n (layout || entering || exiting || sharedTransitionTag) &&\n tag != null\n ) {\n if (!shouldBeUseWeb()) {\n enableLayoutAnimations(true, false);\n }\n if (layout) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.LAYOUT,\n maybeBuild(layout)\n );\n }\n if (entering) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.ENTERING,\n maybeBuild(entering)\n );\n }\n if (exiting) {\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.EXITING,\n maybeBuild(exiting)\n );\n }\n if (sharedTransitionTag) {\n const sharedElementTransition =\n this.props.sharedTransitionStyle ?? DefaultSharedTransition;\n configureLayoutAnimations(\n tag,\n LayoutAnimationType.SHARED_ELEMENT_TRANSITION,\n maybeBuild(sharedElementTransition),\n sharedTransitionTag\n );\n }\n }\n\n if (ref !== this._component) {\n this._component = ref;\n }\n },\n });\n\n _filterNonAnimatedProps(\n inputProps: AnimatedComponentProps<InitialComponentProps>\n ): Record<string, unknown> {\n const props: Record<string, unknown> = {};\n for (const key in inputProps) {\n const value = inputProps[key];\n if (key === 'style') {\n const styleProp = inputProps.style;\n const styles = flattenArray<StyleProps>(styleProp ?? []);\n const processedStyle: StyleProps = styles.map((style) => {\n if (style && style.viewDescriptors) {\n // this is how we recognize styles returned by useAnimatedStyle\n style.viewsRef.add(this);\n if (this._isFirstRender) {\n this.initialStyle = {\n ...style.initial.value,\n ...initialUpdaterRun<StyleProps>(style.initial.updater),\n };\n }\n return this.initialStyle;\n } else if (hasInlineStyles(style)) {\n if (this._isFirstRender) {\n return getInlinePropsUpdate(style);\n }\n const newStyle: StyleProps = {};\n for (const [key, styleValue] of Object.entries(style)) {\n if (\n !isSharedValue(styleValue) &&\n !(key === 'transform' && isInlineStyleTransform(styleValue))\n ) {\n newStyle[key] = styleValue;\n }\n }\n return newStyle;\n } else {\n return style;\n }\n });\n props[key] = StyleSheet.flatten(processedStyle);\n } else if (key === 'animatedProps') {\n const animatedProp = inputProps.animatedProps as Partial<\n AnimatedComponentProps<AnimatedProps>\n >;\n if (animatedProp.initial !== undefined) {\n Object.keys(animatedProp.initial.value).forEach((key) => {\n props[key] = animatedProp.initial?.value[key];\n animatedProp.viewsRef?.add(this);\n });\n }\n } else if (\n has('current', value) &&\n value.current instanceof WorkletEventHandler\n ) {\n if (value.current.eventNames.length > 0) {\n value.current.eventNames.forEach((eventName) => {\n props[eventName] = has('listeners', value.current)\n ? (value.current.listeners as Record<string, unknown>)[\n eventName\n ]\n : dummyListener;\n });\n } else {\n props[key] = dummyListener;\n }\n } else if (isSharedValue(value)) {\n if (this._isFirstRender) {\n props[key] = (value as SharedValue<any>).value;\n }\n } else if (\n key !== 'onGestureHandlerStateChange' ||\n !isChromeDebugger()\n ) {\n props[key] = value;\n }\n }\n return props;\n }\n\n render() {\n const props = this._filterNonAnimatedProps(this.props);\n if (isJest()) {\n props.animatedStyle = this.animatedStyle;\n }\n\n if (this._isFirstRender) {\n this._isFirstRender = false;\n }\n\n const platformProps = Platform.select({\n web: {},\n default: { collapsable: false },\n });\n return (\n <Component {...props} ref={this._setComponentRef} {...platformProps} />\n );\n }\n }\n\n AnimatedComponent.displayName = `AnimatedComponent(${\n Component.displayName || Component.name || 'Component'\n })`;\n\n return React.forwardRef<Component>((props, ref) => {\n return (\n <AnimatedComponent\n {...props}\n {...(ref === null ? null : { forwardedRef: ref })}\n />\n );\n });\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAOA;;AAKA;;AACA;;AAaA;;AAKA;;AACA;;AACA;;AACA;;;;;;;;AAEA,SAASA,aAAT,GAAyB,CACvB;EACA;AACD;;AAED,SAASC,UAAT,CACEC,wBADF,EAKsC;EACpC,MAAMC,kBAAkB,GACtBC,KADyB,IAGzB,WAAWF,wBAAX,IACA,OAAOA,wBAAwB,CAACG,KAAhC,KAA0C,UAJ5C;;EAMA,IAAIF,kBAAkB,CAACD,wBAAD,CAAtB,EAAkD;IAChD,OAAOA,wBAAwB,CAACG,KAAzB,EAAP;EACD,CAFD,MAEO;IACL,OAAOH,wBAAP;EACD;AACF;;AAGD,SAASI,YAAT,CAAyBC,KAAzB,EAAqD;EACnD,IAAI,CAACC,KAAK,CAACC,OAAN,CAAcF,KAAd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