react-native-reanimated 3.0.0-rc.9 → 3.0.1

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 (331) 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 +105 -109
  10. package/Common/cpp/NativeModules/NativeReanimatedModule.h +19 -12
  11. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +15 -7
  12. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.h +6 -2
  13. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.cpp +20 -1
  14. package/Common/cpp/ReanimatedRuntime/ReanimatedHermesRuntime.h +9 -0
  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 +9 -63
  19. package/Common/cpp/SharedItems/Shareables.h +77 -72
  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 +49 -230
  27. package/Common/cpp/Tools/RuntimeDecorator.h +0 -2
  28. package/Common/cpp/Tools/WorkletEventHandler.cpp +3 -2
  29. package/Common/cpp/Tools/WorkletEventHandler.h +14 -6
  30. package/README.md +1 -1
  31. package/RNReanimated.podspec +2 -1
  32. package/android/CMakeLists.txt +188 -181
  33. package/android/build.gradle +362 -311
  34. package/android/proguard-rules.pro +2 -0
  35. package/android/src/fabric/java/com/swmansion/reanimated/NativeProxy.java +63 -295
  36. package/android/src/main/cpp/LayoutAnimations.cpp +35 -5
  37. package/android/src/main/cpp/LayoutAnimations.h +23 -6
  38. package/android/src/main/cpp/NativeProxy.cpp +143 -98
  39. package/android/src/main/cpp/NativeProxy.h +22 -28
  40. package/android/src/main/java/com/swmansion/reanimated/ReanimatedPackage.java +5 -4
  41. package/android/src/main/java/com/swmansion/reanimated/Utils.java +7 -1
  42. package/android/src/main/java/com/swmansion/reanimated/keyboardObserver/ReanimatedKeyboardEventListener.java +10 -3
  43. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/AnimationsManager.java +218 -35
  44. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/LayoutAnimations.java +43 -17
  45. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/NativeMethodsHolder.java +6 -2
  46. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedElement.java +19 -0
  47. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/SharedTransitionManager.java +610 -0
  48. package/android/src/main/java/com/swmansion/reanimated/layoutReanimation/Snapshot.java +93 -23
  49. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/AnimationFrameCallback.java +19 -0
  50. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +35 -0
  51. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/KeyboardEventDataUpdater.java +16 -0
  52. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NativeProxyCommon.java +206 -0
  53. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/SensorSetter.java +17 -0
  54. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensor.java +9 -3
  55. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorContainer.java +3 -4
  56. package/android/src/main/java/com/swmansion/reanimated/sensor/ReanimatedSensorListener.java +31 -7
  57. package/android/src/paper/java/com/swmansion/reanimated/NativeProxy.java +90 -307
  58. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/70/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +16 -0
  59. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/ReanimatedUIManagerFactory.java +63 -0
  60. package/android/src/reactNativeVersionPatch/ReanimatedUIManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedUIManager.java +271 -0
  61. package/android/src/reactNativeVersionPatch/nativeHierarchyManager/latest/com/swmansion/reanimated/layoutReanimation/ReanimatedNativeHierarchyManager.java +76 -20
  62. package/ios/LayoutReanimation/REAAnimationsManager.h +28 -4
  63. package/ios/LayoutReanimation/REAAnimationsManager.m +216 -61
  64. package/ios/LayoutReanimation/REAFrame.h +10 -0
  65. package/ios/LayoutReanimation/REAFrame.m +15 -0
  66. package/ios/LayoutReanimation/REAScreensHelper.h +19 -0
  67. package/ios/LayoutReanimation/REAScreensHelper.m +106 -0
  68. package/ios/LayoutReanimation/REASharedElement.h +15 -0
  69. package/ios/LayoutReanimation/REASharedElement.m +16 -0
  70. package/ios/LayoutReanimation/REASharedTransitionManager.h +17 -0
  71. package/ios/LayoutReanimation/REASharedTransitionManager.m +632 -0
  72. package/ios/LayoutReanimation/REASnapshot.h +1 -0
  73. package/ios/LayoutReanimation/REASnapshot.m +96 -11
  74. package/ios/LayoutReanimation/REAUIManager.mm +64 -17
  75. package/ios/REAModule.mm +2 -7
  76. package/ios/REANodesManager.mm +1 -21
  77. package/ios/keyboardObserver/REAKeyboardEventObserver.m +72 -36
  78. package/ios/native/NativeProxy.mm +75 -114
  79. package/ios/native/REAInitializer.mm +2 -7
  80. package/ios/native/REAJSIUtils.h +60 -2
  81. package/ios/sensor/ReanimatedSensor.h +6 -2
  82. package/ios/sensor/ReanimatedSensor.m +43 -7
  83. package/ios/sensor/ReanimatedSensorContainer.h +4 -1
  84. package/ios/sensor/ReanimatedSensorContainer.m +8 -2
  85. package/lib/commonjs/createAnimatedComponent.js +244 -28
  86. package/lib/commonjs/createAnimatedComponent.js.map +1 -1
  87. package/lib/commonjs/reanimated2/Colors.js +43 -22
  88. package/lib/commonjs/reanimated2/Colors.js.map +1 -1
  89. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js +16 -33
  90. package/lib/commonjs/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  91. package/lib/commonjs/reanimated2/animation/styleAnimation.js +5 -1
  92. package/lib/commonjs/reanimated2/animation/styleAnimation.js.map +1 -1
  93. package/lib/commonjs/reanimated2/animation/util.js +17 -15
  94. package/lib/commonjs/reanimated2/animation/util.js.map +1 -1
  95. package/lib/commonjs/reanimated2/commonTypes.js +33 -1
  96. package/lib/commonjs/reanimated2/commonTypes.js.map +1 -1
  97. package/lib/commonjs/reanimated2/core.js +33 -14
  98. package/lib/commonjs/reanimated2/core.js.map +1 -1
  99. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  100. package/lib/commonjs/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  101. package/lib/commonjs/reanimated2/globals.d.js.map +1 -1
  102. package/lib/commonjs/reanimated2/hook/index.js +0 -6
  103. package/lib/commonjs/reanimated2/hook/index.js.map +1 -1
  104. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  105. package/lib/commonjs/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  106. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js +13 -1
  107. package/lib/commonjs/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  108. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js +1 -1
  109. package/lib/commonjs/reanimated2/hook/useAnimatedRef.js.map +1 -1
  110. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js +91 -15
  111. package/lib/commonjs/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  112. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js +43 -40
  113. package/lib/commonjs/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  114. package/lib/commonjs/reanimated2/hook/useDerivedValue.js +13 -1
  115. package/lib/commonjs/reanimated2/hook/useDerivedValue.js.map +1 -1
  116. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js +2 -2
  117. package/lib/commonjs/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  118. package/lib/commonjs/reanimated2/hook/utils.js +18 -65
  119. package/lib/commonjs/reanimated2/hook/utils.js.map +1 -1
  120. package/lib/commonjs/reanimated2/index.js +13 -0
  121. package/lib/commonjs/reanimated2/index.js.map +1 -1
  122. package/lib/commonjs/reanimated2/initializers.js +71 -32
  123. package/lib/commonjs/reanimated2/initializers.js.map +1 -1
  124. package/lib/commonjs/reanimated2/interpolateColor.js +96 -19
  125. package/lib/commonjs/reanimated2/interpolateColor.js.map +1 -1
  126. package/lib/commonjs/reanimated2/jestUtils.js +1 -1
  127. package/lib/commonjs/reanimated2/jestUtils.js.map +1 -1
  128. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js +103 -13
  129. package/lib/commonjs/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  130. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js +22 -0
  131. package/lib/commonjs/reanimated2/js-reanimated/Mapper.js.map +1 -1
  132. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js +2 -0
  133. package/lib/commonjs/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  134. package/lib/commonjs/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  135. package/lib/commonjs/reanimated2/js-reanimated/global.js +0 -2
  136. package/lib/commonjs/reanimated2/js-reanimated/global.js.map +1 -1
  137. package/lib/commonjs/reanimated2/js-reanimated/index.js +0 -1
  138. package/lib/commonjs/reanimated2/js-reanimated/index.js.map +1 -1
  139. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +11 -0
  140. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  141. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js +8 -0
  142. package/lib/commonjs/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  143. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js +22 -9
  144. package/lib/commonjs/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  145. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -23
  146. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  147. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -14
  148. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  149. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -14
  150. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  151. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -15
  152. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  153. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -23
  154. package/lib/commonjs/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  155. package/lib/commonjs/reanimated2/layoutReanimation/index.js +13 -0
  156. package/lib/commonjs/reanimated2/layoutReanimation/index.js.map +1 -1
  157. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js +94 -0
  158. package/lib/commonjs/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  159. package/lib/commonjs/reanimated2/mappers.js +18 -6
  160. package/lib/commonjs/reanimated2/mappers.js.map +1 -1
  161. package/lib/commonjs/reanimated2/mock.js +20 -1
  162. package/lib/commonjs/reanimated2/mock.js.map +1 -1
  163. package/lib/commonjs/reanimated2/mutables.js +4 -2
  164. package/lib/commonjs/reanimated2/mutables.js.map +1 -1
  165. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js +42 -0
  166. package/lib/commonjs/reanimated2/platform-specific/checkVersion.js.map +1 -0
  167. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js +15 -0
  168. package/lib/commonjs/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  169. package/lib/commonjs/reanimated2/pluginUtils.js +11 -0
  170. package/lib/commonjs/reanimated2/pluginUtils.js.map +1 -0
  171. package/lib/commonjs/reanimated2/shareables.js +36 -15
  172. package/lib/commonjs/reanimated2/shareables.js.map +1 -1
  173. package/lib/commonjs/reanimated2/threads.js +114 -7
  174. package/lib/commonjs/reanimated2/threads.js.map +1 -1
  175. package/lib/commonjs/reanimated2/utils.js +7 -0
  176. package/lib/commonjs/reanimated2/utils.js.map +1 -1
  177. package/lib/commonjs/reanimated2/valueSetter.js +1 -3
  178. package/lib/commonjs/reanimated2/valueSetter.js.map +1 -1
  179. package/lib/module/createAnimatedComponent.js +241 -29
  180. package/lib/module/createAnimatedComponent.js.map +1 -1
  181. package/lib/module/reanimated2/Colors.js +35 -19
  182. package/lib/module/reanimated2/Colors.js.map +1 -1
  183. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js +16 -32
  184. package/lib/module/reanimated2/NativeReanimated/NativeReanimated.js.map +1 -1
  185. package/lib/module/reanimated2/animation/styleAnimation.js +5 -1
  186. package/lib/module/reanimated2/animation/styleAnimation.js.map +1 -1
  187. package/lib/module/reanimated2/animation/util.js +17 -16
  188. package/lib/module/reanimated2/animation/util.js.map +1 -1
  189. package/lib/module/reanimated2/commonTypes.js +29 -0
  190. package/lib/module/reanimated2/commonTypes.js.map +1 -1
  191. package/lib/module/reanimated2/core.js +32 -7
  192. package/lib/module/reanimated2/core.js.map +1 -1
  193. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js +2 -2
  194. package/lib/module/reanimated2/frameCallback/FrameCallbackRegistryUI.js.map +1 -1
  195. package/lib/module/reanimated2/globals.d.js.map +1 -1
  196. package/lib/module/reanimated2/hook/index.js +1 -1
  197. package/lib/module/reanimated2/hook/index.js.map +1 -1
  198. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js +5 -2
  199. package/lib/module/reanimated2/hook/useAnimatedKeyboard.js.map +1 -1
  200. package/lib/module/reanimated2/hook/useAnimatedReaction.js +12 -1
  201. package/lib/module/reanimated2/hook/useAnimatedReaction.js.map +1 -1
  202. package/lib/module/reanimated2/hook/useAnimatedRef.js +2 -2
  203. package/lib/module/reanimated2/hook/useAnimatedRef.js.map +1 -1
  204. package/lib/module/reanimated2/hook/useAnimatedSensor.js +90 -13
  205. package/lib/module/reanimated2/hook/useAnimatedSensor.js.map +1 -1
  206. package/lib/module/reanimated2/hook/useAnimatedStyle.js +46 -43
  207. package/lib/module/reanimated2/hook/useAnimatedStyle.js.map +1 -1
  208. package/lib/module/reanimated2/hook/useDerivedValue.js +12 -1
  209. package/lib/module/reanimated2/hook/useDerivedValue.js.map +1 -1
  210. package/lib/module/reanimated2/hook/useScrollViewOffset.js +2 -2
  211. package/lib/module/reanimated2/hook/useScrollViewOffset.js.map +1 -1
  212. package/lib/module/reanimated2/hook/utils.js +17 -60
  213. package/lib/module/reanimated2/hook/utils.js.map +1 -1
  214. package/lib/module/reanimated2/index.js +1 -0
  215. package/lib/module/reanimated2/index.js.map +1 -1
  216. package/lib/module/reanimated2/initializers.js +72 -33
  217. package/lib/module/reanimated2/initializers.js.map +1 -1
  218. package/lib/module/reanimated2/interpolateColor.js +96 -19
  219. package/lib/module/reanimated2/interpolateColor.js.map +1 -1
  220. package/lib/module/reanimated2/jestUtils.js +1 -1
  221. package/lib/module/reanimated2/jestUtils.js.map +1 -1
  222. package/lib/module/reanimated2/js-reanimated/JSReanimated.js +103 -13
  223. package/lib/module/reanimated2/js-reanimated/JSReanimated.js.map +1 -1
  224. package/lib/module/reanimated2/js-reanimated/Mapper.js +21 -0
  225. package/lib/module/reanimated2/js-reanimated/Mapper.js.map +1 -1
  226. package/lib/module/reanimated2/js-reanimated/WebSensor.js +2 -0
  227. package/lib/module/reanimated2/js-reanimated/WebSensor.js.map +1 -0
  228. package/lib/module/reanimated2/js-reanimated/commonTypes.js.map +1 -1
  229. package/lib/module/reanimated2/js-reanimated/global.js +0 -2
  230. package/lib/module/reanimated2/js-reanimated/global.js.map +1 -1
  231. package/lib/module/reanimated2/js-reanimated/index.js +0 -1
  232. package/lib/module/reanimated2/js-reanimated/index.js.map +1 -1
  233. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +9 -1
  234. package/lib/module/reanimated2/layoutReanimation/animationBuilder/commonTypes.js.map +1 -1
  235. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js +1 -0
  236. package/lib/module/reanimated2/layoutReanimation/animationBuilder/index.js.map +1 -1
  237. package/lib/module/reanimated2/layoutReanimation/animationsManager.js +20 -8
  238. package/lib/module/reanimated2/layoutReanimation/animationsManager.js.map +1 -1
  239. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +16 -21
  240. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Bounce.js.map +1 -1
  241. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +8 -12
  242. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js.map +1 -1
  243. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js +8 -12
  244. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Roll.js.map +1 -1
  245. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js +8 -13
  246. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Slide.js.map +1 -1
  247. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +16 -21
  248. package/lib/module/reanimated2/layoutReanimation/defaultAnimations/Zoom.js.map +1 -1
  249. package/lib/module/reanimated2/layoutReanimation/index.js +1 -0
  250. package/lib/module/reanimated2/layoutReanimation/index.js.map +1 -1
  251. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js +82 -0
  252. package/lib/module/reanimated2/layoutReanimation/sharedTransitions/index.js.map +1 -0
  253. package/lib/module/reanimated2/mappers.js +16 -6
  254. package/lib/module/reanimated2/mappers.js.map +1 -1
  255. package/lib/module/reanimated2/mock.js +20 -1
  256. package/lib/module/reanimated2/mock.js.map +1 -1
  257. package/lib/module/reanimated2/mutables.js +4 -2
  258. package/lib/module/reanimated2/mutables.js.map +1 -1
  259. package/lib/module/reanimated2/platform-specific/checkVersion.js +35 -0
  260. package/lib/module/reanimated2/platform-specific/checkVersion.js.map +1 -0
  261. package/lib/module/reanimated2/platform-specific/checkVersion.web.js +8 -0
  262. package/lib/module/reanimated2/platform-specific/checkVersion.web.js.map +1 -0
  263. package/lib/module/reanimated2/pluginUtils.js +4 -0
  264. package/lib/module/reanimated2/pluginUtils.js.map +1 -0
  265. package/lib/module/reanimated2/shareables.js +36 -12
  266. package/lib/module/reanimated2/shareables.js.map +1 -1
  267. package/lib/module/reanimated2/threads.js +105 -7
  268. package/lib/module/reanimated2/threads.js.map +1 -1
  269. package/lib/module/reanimated2/utils.js +5 -0
  270. package/lib/module/reanimated2/utils.js.map +1 -1
  271. package/lib/module/reanimated2/valueSetter.js +1 -2
  272. package/lib/module/reanimated2/valueSetter.js.map +1 -1
  273. package/mock.js +1 -211
  274. package/package.json +10 -10
  275. package/{plugin.js → plugin/index.js} +128 -249
  276. package/react-native-reanimated.d.ts +55 -417
  277. package/scripts/reanimated_utils.rb +15 -2
  278. package/src/createAnimatedComponent.tsx +247 -28
  279. package/src/reanimated2/Colors.ts +38 -11
  280. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +52 -39
  281. package/src/reanimated2/animation/styleAnimation.ts +8 -1
  282. package/src/reanimated2/animation/util.ts +29 -16
  283. package/src/reanimated2/commonTypes.ts +28 -1
  284. package/src/reanimated2/core.ts +42 -9
  285. package/src/reanimated2/frameCallback/FrameCallbackRegistryUI.ts +2 -2
  286. package/src/reanimated2/globals.d.ts +12 -15
  287. package/src/reanimated2/hook/index.ts +1 -1
  288. package/src/reanimated2/hook/useAnimatedKeyboard.ts +10 -4
  289. package/src/reanimated2/hook/useAnimatedReaction.ts +12 -5
  290. package/src/reanimated2/hook/useAnimatedRef.ts +1 -4
  291. package/src/reanimated2/hook/useAnimatedSensor.ts +90 -11
  292. package/src/reanimated2/hook/useAnimatedStyle.ts +44 -36
  293. package/src/reanimated2/hook/useDerivedValue.ts +8 -1
  294. package/src/reanimated2/hook/useScrollViewOffset.ts +2 -2
  295. package/src/reanimated2/hook/utils.ts +15 -61
  296. package/src/reanimated2/index.ts +1 -0
  297. package/src/reanimated2/initializers.ts +76 -35
  298. package/src/reanimated2/interpolateColor.ts +104 -20
  299. package/src/reanimated2/jestUtils.ts +1 -1
  300. package/src/reanimated2/js-reanimated/JSReanimated.ts +98 -15
  301. package/src/reanimated2/js-reanimated/Mapper.ts +32 -0
  302. package/src/reanimated2/js-reanimated/WebSensor.ts +34 -0
  303. package/src/reanimated2/js-reanimated/commonTypes.ts +0 -1
  304. package/src/reanimated2/js-reanimated/global.ts +0 -1
  305. package/src/reanimated2/js-reanimated/index.ts +0 -1
  306. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +13 -1
  307. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -0
  308. package/src/reanimated2/layoutReanimation/animationsManager.ts +20 -9
  309. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +16 -19
  310. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +14 -11
  311. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +21 -11
  312. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +32 -11
  313. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +36 -19
  314. package/src/reanimated2/layoutReanimation/index.ts +1 -0
  315. package/src/reanimated2/layoutReanimation/sharedTransitions/index.ts +87 -0
  316. package/src/reanimated2/mappers.ts +17 -6
  317. package/src/reanimated2/mock.ts +25 -2
  318. package/src/reanimated2/mutables.ts +2 -0
  319. package/src/reanimated2/platform-specific/checkVersion.ts +39 -0
  320. package/src/reanimated2/platform-specific/checkVersion.web.ts +6 -0
  321. package/src/reanimated2/pluginUtils.ts +8 -0
  322. package/src/reanimated2/shareables.ts +45 -16
  323. package/src/reanimated2/threads.ts +103 -4
  324. package/src/reanimated2/utils.ts +6 -0
  325. package/src/reanimated2/valueSetter.ts +1 -2
  326. package/lib/commonjs/reanimated2/time.js +0 -55
  327. package/lib/commonjs/reanimated2/time.js.map +0 -1
  328. package/lib/module/reanimated2/time.js +0 -37
  329. package/lib/module/reanimated2/time.js.map +0 -1
  330. package/src/reanimated2/time.ts +0 -30
  331. /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,86 @@ const has = (key, x) => {
97
105
  return false;
98
106
  };
99
107
 
108
+ function isInlineStyleTransform(transform) {
109
+ if (!transform) {
110
+ return false;
111
+ }
112
+
113
+ return transform.some(t => hasInlineStyles(t));
114
+ }
115
+
116
+ function hasInlineStyles(style) {
117
+ if (!style) {
118
+ return false;
119
+ }
120
+
121
+ return Object.keys(style).some(key => {
122
+ const styleValue = style[key];
123
+ return (0, _reanimated.isSharedValue)(styleValue) || key === 'transform' && isInlineStyleTransform(styleValue);
124
+ });
125
+ }
126
+
127
+ function extractSharedValuesMapFromProps(props) {
128
+ const inlineProps = {};
129
+
130
+ for (const key in props) {
131
+ const value = props[key];
132
+
133
+ if (key === 'style') {
134
+ const styles = flattenArray(props.style ?? []);
135
+ styles.forEach(style => {
136
+ if (!style) {
137
+ return;
138
+ }
139
+
140
+ for (const [key, styleValue] of Object.entries(style)) {
141
+ if ((0, _reanimated.isSharedValue)(styleValue)) {
142
+ inlineProps[key] = styleValue;
143
+ } else if (key === 'transform' && isInlineStyleTransform(styleValue)) {
144
+ inlineProps[key] = styleValue;
145
+ }
146
+ }
147
+ });
148
+ } else if ((0, _reanimated.isSharedValue)(value)) {
149
+ inlineProps[key] = value;
150
+ }
151
+ }
152
+
153
+ return inlineProps;
154
+ }
155
+
156
+ function inlinePropsHasChanged(styles1, styles2) {
157
+ if (Object.keys(styles1).length !== Object.keys(styles2).length) {
158
+ return true;
159
+ }
160
+
161
+ for (const key of Object.keys(styles1)) {
162
+ if (styles1[key] !== styles2[key]) return true;
163
+ }
164
+
165
+ return false;
166
+ }
167
+
168
+ function getInlinePropsUpdate(inlineProps) {
169
+ 'worklet';
170
+
171
+ const update = {};
172
+
173
+ for (const [key, styleValue] of Object.entries(inlineProps)) {
174
+ if (key === 'transform') {
175
+ update[key] = styleValue.map(transform => {
176
+ return getInlinePropsUpdate(transform);
177
+ });
178
+ } else if ((0, _reanimated.isSharedValue)(styleValue)) {
179
+ update[key] = styleValue.value;
180
+ } else {
181
+ update[key] = styleValue;
182
+ }
183
+ }
184
+
185
+ return update;
186
+ }
187
+
100
188
  function createAnimatedComponent(Component, options) {
101
189
  (0, _invariant.default)(typeof Component !== 'function' || Component.prototype && Component.prototype.isReactComponent, '`createAnimatedComponent` does not support stateless functional components; ' + 'use a class component instead.');
102
190
 
@@ -120,6 +208,12 @@ function createAnimatedComponent(Component, options) {
120
208
 
121
209
  _defineProperty(this, "_component", null);
122
210
 
211
+ _defineProperty(this, "_inlinePropsViewDescriptors", null);
212
+
213
+ _defineProperty(this, "_inlinePropsMapperId", null);
214
+
215
+ _defineProperty(this, "_inlineProps", {});
216
+
123
217
  _defineProperty(this, "_setComponentRef", (0, _setAndForwardRef.default)({
124
218
  getForwardedRef: () => this.props.forwardedRef,
125
219
  setLocalRef: ref => {
@@ -128,24 +222,30 @@ function createAnimatedComponent(Component, options) {
128
222
  const {
129
223
  layout,
130
224
  entering,
131
- exiting
225
+ exiting,
226
+ sharedTransitionTag
132
227
  } = this.props;
133
228
 
134
- if ((layout || entering || exiting) && tag != null) {
229
+ if ((layout || entering || exiting || sharedTransitionTag) && tag != null) {
135
230
  if (!(0, _PlatformChecker.shouldBeUseWeb)()) {
136
231
  (0, _core.enableLayoutAnimations)(true, false);
137
232
  }
138
233
 
139
234
  if (layout) {
140
- (0, _core.configureLayoutAnimations)(tag, 'layout', maybeBuild(layout));
235
+ (0, _core.configureLayoutAnimations)(tag, _layoutReanimation.LayoutAnimationType.LAYOUT, maybeBuild(layout));
141
236
  }
142
237
 
143
238
  if (entering) {
144
- (0, _core.configureLayoutAnimations)(tag, 'entering', maybeBuild(entering));
239
+ (0, _core.configureLayoutAnimations)(tag, _layoutReanimation.LayoutAnimationType.ENTERING, maybeBuild(entering));
145
240
  }
146
241
 
147
242
  if (exiting) {
148
- (0, _core.configureLayoutAnimations)(tag, 'exiting', maybeBuild(exiting));
243
+ (0, _core.configureLayoutAnimations)(tag, _layoutReanimation.LayoutAnimationType.EXITING, maybeBuild(exiting));
244
+ }
245
+
246
+ if (sharedTransitionTag) {
247
+ const sharedElementTransition = this.props.sharedTransitionStyle ?? _layoutReanimation.DefaultSharedTransition;
248
+ (0, _core.configureLayoutAnimations)(tag, _layoutReanimation.LayoutAnimationType.SHARED_ELEMENT_TRANSITION, maybeBuild(sharedElementTransition), sharedTransitionTag);
149
249
  }
150
250
  }
151
251
 
@@ -166,16 +266,30 @@ function createAnimatedComponent(Component, options) {
166
266
  this._detachNativeEvents();
167
267
 
168
268
  this._detachStyles();
269
+
270
+ this._detachInlineProps();
169
271
  }
170
272
 
171
273
  componentDidMount() {
172
274
  this._attachNativeEvents();
173
275
 
174
276
  this._attachAnimatedStyles();
277
+
278
+ this._attachInlineProps();
279
+ }
280
+
281
+ _getEventViewRef() {
282
+ var _this$_component;
283
+
284
+ // Make sure to get the scrollable node for components that implement
285
+ // `ScrollResponder.Mixin`.
286
+ return (_this$_component = this._component) !== null && _this$_component !== void 0 && _this$_component.getScrollableNode ? this._component.getScrollableNode() : this._component;
175
287
  }
176
288
 
177
289
  _attachNativeEvents() {
178
- const viewTag = (0, _reactNative.findNodeHandle)(this);
290
+ const node = this._getEventViewRef();
291
+
292
+ const viewTag = (0, _reactNative.findNodeHandle)(options !== null && options !== void 0 && options.setNativeProps ? this : node);
179
293
 
180
294
  for (const key in this.props) {
181
295
  const prop = this.props[key];
@@ -215,11 +329,11 @@ function createAnimatedComponent(Component, options) {
215
329
  }
216
330
 
217
331
  if (global._IS_FABRIC) {
218
- const shadowNodeWrapper = (0, _fabricUtils.getShadowNodeWrapperFromRef)(this);
332
+ const viewTag = this._viewTag;
219
333
  (0, _core.runOnUI)(() => {
220
334
  'worklet';
221
335
 
222
- _removeShadowNodeFromRegistry(shadowNodeWrapper);
336
+ _removeShadowNodeFromRegistry(viewTag);
223
337
  })();
224
338
  }
225
339
  }
@@ -262,31 +376,26 @@ function createAnimatedComponent(Component, options) {
262
376
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
263
377
  options.setNativeProps(this._component, props);
264
378
  } else {
265
- var _this$_component, _this$_component$setN;
379
+ var _this$_component2, _this$_component2$set;
266
380
 
267
381
  // 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);
382
+ (_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
383
  }
270
384
  }
271
385
 
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;
386
+ _getViewInfo() {
280
387
  let viewTag;
281
388
  let viewName;
282
389
  let shadowNodeWrapper = null;
390
+ let viewConfig;
283
391
 
284
392
  if (_reactNative.Platform.OS === 'web') {
285
393
  viewTag = (0, _reactNative.findNodeHandle)(this);
286
394
  viewName = null;
287
395
  shadowNodeWrapper = null;
396
+ viewConfig = null;
288
397
  } else {
289
- var _hostInstance$viewCon, _this$props$animatedP2;
398
+ var _hostInstance$viewCon;
290
399
 
291
400
  // 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
401
  const hostInstance = _RNRenderer.RNRenderer.findHostInstance_DEPRECATED(this);
@@ -302,19 +411,45 @@ function createAnimatedComponent(Component, options) {
302
411
  * The name we're looking for is in the field named uiViewClassName.
303
412
  */
304
413
 
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
- }
414
+ viewName = hostInstance === null || hostInstance === void 0 ? void 0 : (_hostInstance$viewCon = hostInstance.viewConfig) === null || _hostInstance$viewCon === void 0 ? void 0 : _hostInstance$viewCon.uiViewClassName;
415
+ viewConfig = hostInstance === null || hostInstance === void 0 ? void 0 : hostInstance.viewConfig;
312
416
 
313
417
  if (global._IS_FABRIC) {
314
- shadowNodeWrapper = (0, _shareables.makeShareableShadowNodeWrapper)((0, _fabricUtils.getShadowNodeWrapperFromRef)(this));
418
+ shadowNodeWrapper = (0, _fabricUtils.getShadowNodeWrapperFromRef)(this);
315
419
  }
316
420
  }
317
421
 
422
+ return {
423
+ viewTag,
424
+ viewName,
425
+ shadowNodeWrapper,
426
+ viewConfig
427
+ };
428
+ }
429
+
430
+ _attachAnimatedStyles() {
431
+ var _this$props$animatedP2, _this$props$animatedP3;
432
+
433
+ const styles = this.props.style ? onlyAnimatedStyles(flattenArray(this.props.style)) : [];
434
+ const prevStyles = this._styles;
435
+ this._styles = styles;
436
+ const prevAnimatedProps = this._animatedProps;
437
+ this._animatedProps = this.props.animatedProps;
438
+
439
+ const {
440
+ viewTag,
441
+ viewName,
442
+ shadowNodeWrapper,
443
+ viewConfig
444
+ } = this._getViewInfo(); // update UI props whitelist for this view
445
+
446
+
447
+ const hasReanimated2Props = ((_this$props$animatedP2 = this.props.animatedProps) === null || _this$props$animatedP2 === void 0 ? void 0 : _this$props$animatedP2.viewDescriptors) || styles.length;
448
+
449
+ if (hasReanimated2Props && viewConfig) {
450
+ (0, _ConfigHelper.adaptViewConfig)(viewConfig);
451
+ }
452
+
318
453
  this._viewTag = viewTag; // remove old styles
319
454
 
320
455
  if (prevStyles) {
@@ -371,10 +506,73 @@ function createAnimatedComponent(Component, options) {
371
506
  }
372
507
  }
373
508
 
509
+ _attachInlineProps() {
510
+ const newInlineProps = extractSharedValuesMapFromProps(this.props);
511
+ const hasChanged = inlinePropsHasChanged(newInlineProps, this._inlineProps);
512
+
513
+ if (hasChanged) {
514
+ if (!this._inlinePropsViewDescriptors) {
515
+ this._inlinePropsViewDescriptors = (0, _ViewDescriptorsSet.makeViewDescriptorsSet)();
516
+
517
+ const {
518
+ viewTag,
519
+ viewName,
520
+ shadowNodeWrapper,
521
+ viewConfig
522
+ } = this._getViewInfo();
523
+
524
+ if (Object.keys(newInlineProps).length && viewConfig) {
525
+ (0, _ConfigHelper.adaptViewConfig)(viewConfig);
526
+ }
527
+
528
+ this._inlinePropsViewDescriptors.add({
529
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
530
+ tag: viewTag,
531
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
532
+ name: viewName,
533
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
534
+ shadowNodeWrapper: shadowNodeWrapper
535
+ });
536
+ }
537
+
538
+ const sharableViewDescriptors = this._inlinePropsViewDescriptors.sharableViewDescriptors;
539
+ const maybeViewRef = _NativeReanimated.default.native ? undefined : {
540
+ items: new Set([this])
541
+ }; // see makeViewsRefSet
542
+
543
+ const updaterFunction = () => {
544
+ 'worklet';
545
+
546
+ const update = getInlinePropsUpdate(newInlineProps);
547
+ (0, _UpdateProps.default)(sharableViewDescriptors, update, maybeViewRef);
548
+ };
549
+
550
+ this._inlineProps = newInlineProps;
551
+
552
+ if (this._inlinePropsMapperId) {
553
+ (0, _core.stopMapper)(this._inlinePropsMapperId);
554
+ }
555
+
556
+ this._inlinePropsMapperId = null;
557
+
558
+ if (Object.keys(newInlineProps).length) {
559
+ this._inlinePropsMapperId = (0, _core.startMapper)(updaterFunction, Object.values(newInlineProps));
560
+ }
561
+ }
562
+ }
563
+
564
+ _detachInlineProps() {
565
+ if (this._inlinePropsMapperId) {
566
+ (0, _core.stopMapper)(this._inlinePropsMapperId);
567
+ }
568
+ }
569
+
374
570
  componentDidUpdate(prevProps) {
375
571
  this._reattachNativeEvents(prevProps);
376
572
 
377
573
  this._attachAnimatedStyles();
574
+
575
+ this._attachInlineProps();
378
576
  }
379
577
 
380
578
  _filterNonAnimatedProps(inputProps) {
@@ -398,6 +596,20 @@ function createAnimatedComponent(Component, options) {
398
596
  }
399
597
 
400
598
  return this.initialStyle;
599
+ } else if (hasInlineStyles(style)) {
600
+ if (this._isFirstRender) {
601
+ return getInlinePropsUpdate(style);
602
+ }
603
+
604
+ const newStyle = {};
605
+
606
+ for (const [key, styleValue] of Object.entries(style)) {
607
+ if (!(0, _reanimated.isSharedValue)(styleValue) && !(key === 'transform' && isInlineStyleTransform(styleValue))) {
608
+ newStyle[key] = styleValue;
609
+ }
610
+ }
611
+
612
+ return newStyle;
401
613
  } else {
402
614
  return style;
403
615
  }
@@ -422,6 +634,10 @@ function createAnimatedComponent(Component, options) {
422
634
  } else {
423
635
  props[key] = dummyListener;
424
636
  }
637
+ } else if ((0, _reanimated.isSharedValue)(value)) {
638
+ if (this._isFirstRender) {
639
+ props[key] = value.value;
640
+ }
425
641
  } else if (key !== 'onGestureHandlerStateChange' || !(0, _PlatformChecker.isChromeDebugger)()) {
426
642
  props[key] = value;
427
643
  }
@@ -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,aAAa,CAACG,IAAD,CAAb;MACD,CAFD,MAEO;QACLJ,SAAS,CAACK,IAAV,CAAeD,IAAf;MACD;IACF,CAND;EAOD,CARD;;EASAH,aAAa,CAACJ,KAAD,CAAb;;EACA,OAAOG,SAAP;AACD;;AAED,SAASM,kBAAT,CAA4BC,MAA5B,EAAkD;EAChD,OAAOA,M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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 if (!transform) {\n return false;\n }\n return transform.some((t: Record<string, any>) => hasInlineStyles(t));\n}\n\nfunction hasInlineStyles(style: StyleProps): boolean {\n if (!style) {\n return false;\n }\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 if (!style) {\n return;\n }\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,CAAL,EAA2B;IACzB,OAAO,CAACA,KAAD,CAAP;EACD;;EACD,MAAMG,SAAc,GAAG,EAAvB;;EAEA,MAAMC,aAAa,GAAIC,GAAD,IAAiC;IACrDA,GAAG,CAACC,OAAJ,CAAaC,IAA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