react-native-reanimated 2.15.0 → 2.16.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 (288) hide show
  1. package/Common/cpp/Tools/SingleInstanceChecker.h +10 -2
  2. package/package.json +1 -1
  3. package/src/reanimated1/core/Core.test.js +30 -0
  4. package/android/.gradle/7.5.1/checksums/checksums.lock +0 -0
  5. package/android/.gradle/7.5.1/checksums/md5-checksums.bin +0 -0
  6. package/android/.gradle/7.5.1/checksums/sha1-checksums.bin +0 -0
  7. package/android/.gradle/7.5.1/dependencies-accessors/dependencies-accessors.lock +0 -0
  8. package/android/.gradle/7.5.1/dependencies-accessors/gc.properties +0 -0
  9. package/android/.gradle/7.5.1/executionHistory/executionHistory.bin +0 -0
  10. package/android/.gradle/7.5.1/executionHistory/executionHistory.lock +0 -0
  11. package/android/.gradle/7.5.1/fileChanges/last-build.bin +0 -0
  12. package/android/.gradle/7.5.1/fileHashes/fileHashes.bin +0 -0
  13. package/android/.gradle/7.5.1/fileHashes/fileHashes.lock +0 -0
  14. package/android/.gradle/7.5.1/fileHashes/resourceHashesCache.bin +0 -0
  15. package/android/.gradle/7.5.1/gc.properties +0 -0
  16. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  17. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  18. package/android/.gradle/buildOutputCleanup/outputFiles.bin +0 -0
  19. package/android/.gradle/file-system.probe +0 -0
  20. package/android/.gradle/vcs-1/gc.properties +0 -0
  21. package/android/react-native-reanimated-67-hermes.aar +0 -0
  22. package/android/react-native-reanimated-67-jsc.aar +0 -0
  23. package/android/react-native-reanimated-68-hermes.aar +0 -0
  24. package/android/react-native-reanimated-68-jsc.aar +0 -0
  25. package/android/react-native-reanimated-69-hermes.aar +0 -0
  26. package/android/react-native-reanimated-69-jsc.aar +0 -0
  27. package/android/react-native-reanimated-70-hermes.aar +0 -0
  28. package/android/react-native-reanimated-70-jsc.aar +0 -0
  29. package/android/react-native-reanimated-71-hermes.aar +0 -0
  30. package/android/react-native-reanimated-71-jsc.aar +0 -0
  31. package/lib/Animated.js +0 -9
  32. package/lib/ConfigHelper.js +0 -145
  33. package/lib/ReanimatedEventEmitter.js +0 -3
  34. package/lib/ReanimatedModule.js +0 -2
  35. package/lib/ReanimatedModule.macos.js +0 -2
  36. package/lib/ReanimatedModule.native.js +0 -12
  37. package/lib/ReanimatedModule.windows.js +0 -2
  38. package/lib/ReanimatedModuleCompat.js +0 -66
  39. package/lib/__mocks__/ReanimatedEventEmitter.js +0 -8
  40. package/lib/__mocks__/ReanimatedModule.native.js +0 -11
  41. package/lib/createAnimatedComponent.js +0 -518
  42. package/lib/index.js +0 -14
  43. package/lib/index.web.js +0 -6
  44. package/lib/reanimated1/Easing.js +0 -231
  45. package/lib/reanimated1/SpringConfig.js +0 -79
  46. package/lib/reanimated1/Transitioning.js +0 -158
  47. package/lib/reanimated1/animations/Animation.js +0 -32
  48. package/lib/reanimated1/animations/SpringUtils.js +0 -199
  49. package/lib/reanimated1/animations/backwardCompatibleAnimWrapper.js +0 -117
  50. package/lib/reanimated1/animations/decay.js +0 -54
  51. package/lib/reanimated1/animations/spring.js +0 -198
  52. package/lib/reanimated1/animations/timing.js +0 -74
  53. package/lib/reanimated1/base.js +0 -13
  54. package/lib/reanimated1/core/AnimatedAlways.js +0 -33
  55. package/lib/reanimated1/core/AnimatedBezier.js +0 -150
  56. package/lib/reanimated1/core/AnimatedBlock.js +0 -52
  57. package/lib/reanimated1/core/AnimatedCall.js +0 -55
  58. package/lib/reanimated1/core/AnimatedCallFunc.js +0 -72
  59. package/lib/reanimated1/core/AnimatedClock.js +0 -90
  60. package/lib/reanimated1/core/AnimatedClockTest.js +0 -22
  61. package/lib/reanimated1/core/AnimatedCode.js +0 -32
  62. package/lib/reanimated1/core/AnimatedConcat.js +0 -32
  63. package/lib/reanimated1/core/AnimatedCond.js +0 -57
  64. package/lib/reanimated1/core/AnimatedDebug.js +0 -62
  65. package/lib/reanimated1/core/AnimatedEvent.js +0 -126
  66. package/lib/reanimated1/core/AnimatedFunction.js +0 -55
  67. package/lib/reanimated1/core/AnimatedNode.js +0 -223
  68. package/lib/reanimated1/core/AnimatedOperator.js +0 -103
  69. package/lib/reanimated1/core/AnimatedParam.js +0 -88
  70. package/lib/reanimated1/core/AnimatedProps.js +0 -108
  71. package/lib/reanimated1/core/AnimatedSet.js +0 -38
  72. package/lib/reanimated1/core/AnimatedStartClock.js +0 -30
  73. package/lib/reanimated1/core/AnimatedStopClock.js +0 -30
  74. package/lib/reanimated1/core/AnimatedStyle.js +0 -78
  75. package/lib/reanimated1/core/AnimatedTransform.js +0 -78
  76. package/lib/reanimated1/core/AnimatedValue.js +0 -38
  77. package/lib/reanimated1/core/InternalAnimatedValue.js +0 -87
  78. package/lib/reanimated1/core/__mocks__/AnimatedProps.js +0 -86
  79. package/lib/reanimated1/core/createEventObjectProxyPolyfill.js +0 -44
  80. package/lib/reanimated1/derived/__mocks__/evaluateOnce.js +0 -14
  81. package/lib/reanimated1/derived/acc.js +0 -11
  82. package/lib/reanimated1/derived/color.js +0 -47
  83. package/lib/reanimated1/derived/diff.js +0 -16
  84. package/lib/reanimated1/derived/diffClamp.js +0 -11
  85. package/lib/reanimated1/derived/evaluateOnce.js +0 -35
  86. package/lib/reanimated1/derived/index.js +0 -8
  87. package/lib/reanimated1/derived/interpolate.js +0 -152
  88. package/lib/reanimated1/derived/interpolateColors.js +0 -62
  89. package/lib/reanimated1/derived/onChange.js +0 -14
  90. package/lib/reanimated1/derived/useCode.js +0 -41
  91. package/lib/reanimated1/index.js +0 -53
  92. package/lib/reanimated1/operators.js +0 -35
  93. package/lib/reanimated1/useValue.js +0 -10
  94. package/lib/reanimated1/val.js +0 -3
  95. package/lib/reanimated2/Bezier.js +0 -126
  96. package/lib/reanimated2/Colors.js +0 -538
  97. package/lib/reanimated2/Easing.js +0 -248
  98. package/lib/reanimated2/NativeMethods.js +0 -94
  99. package/lib/reanimated2/NativeReanimated/NativeReanimated.js +0 -60
  100. package/lib/reanimated2/NativeReanimated/index.js +0 -11
  101. package/lib/reanimated2/PlatformChecker.js +0 -16
  102. package/lib/reanimated2/PropAdapters.js +0 -55
  103. package/lib/reanimated2/UpdateProps.js +0 -55
  104. package/lib/reanimated2/ViewDescriptorsSet.js +0 -75
  105. package/lib/reanimated2/WorkletEventHandler.js +0 -37
  106. package/lib/reanimated2/__mocks__/MutableValue.js +0 -13
  107. package/lib/reanimated2/__mocks__/NativeReanimated.js +0 -20
  108. package/lib/reanimated2/animation/commonTypes.js +0 -1
  109. package/lib/reanimated2/animation/decay.js +0 -71
  110. package/lib/reanimated2/animation/delay.js +0 -64
  111. package/lib/reanimated2/animation/index.js +0 -8
  112. package/lib/reanimated2/animation/repeat.js +0 -69
  113. package/lib/reanimated2/animation/sequence.js +0 -69
  114. package/lib/reanimated2/animation/spring.js +0 -103
  115. package/lib/reanimated2/animation/styleAnimation.js +0 -174
  116. package/lib/reanimated2/animation/timing.js +0 -64
  117. package/lib/reanimated2/animation/util.js +0 -183
  118. package/lib/reanimated2/commonTypes.js +0 -8
  119. package/lib/reanimated2/component/FlatList.js +0 -30
  120. package/lib/reanimated2/component/Image.js +0 -4
  121. package/lib/reanimated2/component/ScrollView.js +0 -4
  122. package/lib/reanimated2/component/Text.js +0 -4
  123. package/lib/reanimated2/component/View.js +0 -4
  124. package/lib/reanimated2/core.js +0 -269
  125. package/lib/reanimated2/frameCallback/FrameCallbackRegistryJS.js +0 -32
  126. package/lib/reanimated2/frameCallback/FrameCallbackRegistryUI.js +0 -76
  127. package/lib/reanimated2/globals.d.ts +0 -91
  128. package/lib/reanimated2/hook/Hooks.js +0 -9
  129. package/lib/reanimated2/hook/commonTypes.js +0 -1
  130. package/lib/reanimated2/hook/index.js +0 -12
  131. package/lib/reanimated2/hook/useAnimatedGestureHandler.js +0 -49
  132. package/lib/reanimated2/hook/useAnimatedKeyboard.js +0 -31
  133. package/lib/reanimated2/hook/useAnimatedReaction.js +0 -44
  134. package/lib/reanimated2/hook/useAnimatedRef.js +0 -25
  135. package/lib/reanimated2/hook/useAnimatedScrollHandler.js +0 -41
  136. package/lib/reanimated2/hook/useAnimatedSensor.js +0 -66
  137. package/lib/reanimated2/hook/useAnimatedStyle.js +0 -402
  138. package/lib/reanimated2/hook/useDerivedValue.js +0 -43
  139. package/lib/reanimated2/hook/useFrameCallback.js +0 -23
  140. package/lib/reanimated2/hook/useScrollViewOffset.js +0 -27
  141. package/lib/reanimated2/hook/useSharedValue.js +0 -17
  142. package/lib/reanimated2/hook/utils.js +0 -165
  143. package/lib/reanimated2/index.js +0 -12
  144. package/lib/reanimated2/interpolateColor.js +0 -157
  145. package/lib/reanimated2/interpolation.js +0 -127
  146. package/lib/reanimated2/jestUtils.js +0 -175
  147. package/lib/reanimated2/js-reanimated/JSReanimated.js +0 -106
  148. package/lib/reanimated2/js-reanimated/Mapper.js +0 -43
  149. package/lib/reanimated2/js-reanimated/MapperRegistry.js +0 -101
  150. package/lib/reanimated2/js-reanimated/MutableValue.js +0 -29
  151. package/lib/reanimated2/js-reanimated/commonTypes.js +0 -1
  152. package/lib/reanimated2/js-reanimated/global.js +0 -36
  153. package/lib/reanimated2/js-reanimated/index.js +0 -35
  154. package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +0 -67
  155. package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +0 -69
  156. package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +0 -133
  157. package/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.js +0 -194
  158. package/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +0 -1
  159. package/lib/reanimated2/layoutReanimation/animationBuilder/index.js +0 -3
  160. package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +0 -374
  161. package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -36
  162. package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +0 -275
  163. package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +0 -385
  164. package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +0 -136
  165. package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +0 -81
  166. package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +0 -120
  167. package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +0 -273
  168. package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +0 -201
  169. package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +0 -101
  170. package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +0 -457
  171. package/lib/reanimated2/layoutReanimation/defaultAnimations/index.js +0 -10
  172. package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +0 -90
  173. package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +0 -132
  174. package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +0 -37
  175. package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +0 -41
  176. package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +0 -34
  177. package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +0 -46
  178. package/lib/reanimated2/layoutReanimation/defaultTransitions/index.js +0 -6
  179. package/lib/reanimated2/layoutReanimation/index.js +0 -4
  180. package/lib/reanimated2/mock.js +0 -75
  181. package/lib/reanimated2/platform-specific/RNRenderer.js +0 -3
  182. package/lib/reanimated2/platform-specific/RNRenderer.web.js +0 -3
  183. package/lib/reanimated2/platform-specific/checkVersion.js +0 -28
  184. package/lib/reanimated2/platform-specific/checkVersion.web.js +0 -6
  185. package/lib/reanimated2/utils.js +0 -16
  186. package/lib/setAndForwardRef.js +0 -19
  187. package/lib/types/lib/Animated.d.ts +0 -8
  188. package/lib/types/lib/ConfigHelper.d.ts +0 -12
  189. package/lib/types/lib/ReanimatedEventEmitter.d.ts +0 -3
  190. package/lib/types/lib/ReanimatedModule.d.ts +0 -2
  191. package/lib/types/lib/ReanimatedModule.macos.d.ts +0 -2
  192. package/lib/types/lib/ReanimatedModule.native.d.ts +0 -2
  193. package/lib/types/lib/ReanimatedModule.windows.d.ts +0 -2
  194. package/lib/types/lib/ReanimatedModuleCompat.d.ts +0 -14
  195. package/lib/types/lib/createAnimatedComponent.d.ts +0 -33
  196. package/lib/types/lib/index.d.ts +0 -4
  197. package/lib/types/lib/index.web.d.ts +0 -4
  198. package/lib/types/lib/reanimated2/Bezier.d.ts +0 -6
  199. package/lib/types/lib/reanimated2/Colors.d.ts +0 -33
  200. package/lib/types/lib/reanimated2/Easing.d.ts +0 -172
  201. package/lib/types/lib/reanimated2/NativeMethods.d.ts +0 -7
  202. package/lib/types/lib/reanimated2/NativeReanimated/NativeReanimated.d.ts +0 -22
  203. package/lib/types/lib/reanimated2/NativeReanimated/index.d.ts +0 -3
  204. package/lib/types/lib/reanimated2/PlatformChecker.d.ts +0 -5
  205. package/lib/types/lib/reanimated2/PropAdapters.d.ts +0 -4
  206. package/lib/types/lib/reanimated2/UpdateProps.d.ts +0 -9
  207. package/lib/types/lib/reanimated2/ViewDescriptorsSet.d.ts +0 -20
  208. package/lib/types/lib/reanimated2/WorkletEventHandler.d.ts +0 -13
  209. package/lib/types/lib/reanimated2/__mocks__/MutableValue.d.ts +0 -5
  210. package/lib/types/lib/reanimated2/__mocks__/NativeReanimated.d.ts +0 -13
  211. package/lib/types/lib/reanimated2/animation/commonTypes.d.ts +0 -27
  212. package/lib/types/lib/reanimated2/animation/decay.d.ts +0 -19
  213. package/lib/types/lib/reanimated2/animation/delay.d.ts +0 -7
  214. package/lib/types/lib/reanimated2/animation/index.d.ts +0 -9
  215. package/lib/types/lib/reanimated2/animation/repeat.d.ts +0 -12
  216. package/lib/types/lib/reanimated2/animation/sequence.d.ts +0 -7
  217. package/lib/types/lib/reanimated2/animation/spring.d.ts +0 -22
  218. package/lib/types/lib/reanimated2/animation/styleAnimation.d.ts +0 -7
  219. package/lib/types/lib/reanimated2/animation/timing.d.ts +0 -21
  220. package/lib/types/lib/reanimated2/animation/util.d.ts +0 -9
  221. package/lib/types/lib/reanimated2/commonTypes.d.ts +0 -99
  222. package/lib/types/lib/reanimated2/component/FlatList.d.ts +0 -9
  223. package/lib/types/lib/reanimated2/component/Image.d.ts +0 -3
  224. package/lib/types/lib/reanimated2/component/ScrollView.d.ts +0 -3
  225. package/lib/types/lib/reanimated2/component/Text.d.ts +0 -3
  226. package/lib/types/lib/reanimated2/component/View.d.ts +0 -3
  227. package/lib/types/lib/reanimated2/core.d.ts +0 -24
  228. package/lib/types/lib/reanimated2/frameCallback/FrameCallbackRegistryJS.d.ts +0 -8
  229. package/lib/types/lib/reanimated2/frameCallback/FrameCallbackRegistryUI.d.ts +0 -20
  230. package/lib/types/lib/reanimated2/hook/Hooks.d.ts +0 -5
  231. package/lib/types/lib/reanimated2/hook/commonTypes.d.ts +0 -14
  232. package/lib/types/lib/reanimated2/hook/index.d.ts +0 -14
  233. package/lib/types/lib/reanimated2/hook/useAnimatedGestureHandler.d.ts +0 -35
  234. package/lib/types/lib/reanimated2/hook/useAnimatedKeyboard.d.ts +0 -2
  235. package/lib/types/lib/reanimated2/hook/useAnimatedReaction.d.ts +0 -12
  236. package/lib/types/lib/reanimated2/hook/useAnimatedRef.d.ts +0 -3
  237. package/lib/types/lib/reanimated2/hook/useAnimatedScrollHandler.d.ts +0 -20
  238. package/lib/types/lib/reanimated2/hook/useAnimatedSensor.d.ts +0 -18
  239. package/lib/types/lib/reanimated2/hook/useAnimatedStyle.d.ts +0 -11
  240. package/lib/types/lib/reanimated2/hook/useDerivedValue.d.ts +0 -4
  241. package/lib/types/lib/reanimated2/hook/useFrameCallback.d.ts +0 -7
  242. package/lib/types/lib/reanimated2/hook/useScrollViewOffset.d.ts +0 -4
  243. package/lib/types/lib/reanimated2/hook/useSharedValue.d.ts +0 -2
  244. package/lib/types/lib/reanimated2/hook/utils.d.ts +0 -28
  245. package/lib/types/lib/reanimated2/index.d.ts +0 -12
  246. package/lib/types/lib/reanimated2/interpolateColor.d.ts +0 -32
  247. package/lib/types/lib/reanimated2/interpolation.d.ts +0 -14
  248. package/lib/types/lib/reanimated2/jestUtils.d.ts +0 -12
  249. package/lib/types/lib/reanimated2/js-reanimated/JSReanimated.d.ts +0 -32
  250. package/lib/types/lib/reanimated2/js-reanimated/Mapper.d.ts +0 -14
  251. package/lib/types/lib/reanimated2/js-reanimated/MapperRegistry.d.ts +0 -14
  252. package/lib/types/lib/reanimated2/js-reanimated/MutableValue.d.ts +0 -14
  253. package/lib/types/lib/reanimated2/js-reanimated/commonTypes.d.ts +0 -44
  254. package/lib/types/lib/reanimated2/js-reanimated/global.d.ts +0 -2
  255. package/lib/types/lib/reanimated2/js-reanimated/index.d.ts +0 -15
  256. package/lib/types/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.d.ts +0 -1
  257. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.d.ts +0 -22
  258. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.d.ts +0 -38
  259. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/Keyframe.d.ts +0 -25
  260. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/commonTypes.d.ts +0 -81
  261. package/lib/types/lib/reanimated2/layoutReanimation/animationBuilder/index.d.ts +0 -4
  262. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.d.ts +0 -62
  263. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Default.d.ts +0 -4
  264. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.d.ts +0 -42
  265. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.d.ts +0 -50
  266. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.d.ts +0 -18
  267. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.d.ts +0 -10
  268. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.d.ts +0 -18
  269. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.d.ts +0 -34
  270. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.d.ts +0 -34
  271. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.d.ts +0 -18
  272. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.d.ts +0 -66
  273. package/lib/types/lib/reanimated2/layoutReanimation/defaultAnimations/index.d.ts +0 -10
  274. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.d.ts +0 -19
  275. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.d.ts +0 -13
  276. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.d.ts +0 -6
  277. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.d.ts +0 -6
  278. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.d.ts +0 -7
  279. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.d.ts +0 -9
  280. package/lib/types/lib/reanimated2/layoutReanimation/defaultTransitions/index.d.ts +0 -6
  281. package/lib/types/lib/reanimated2/layoutReanimation/index.d.ts +0 -4
  282. package/lib/types/lib/reanimated2/mock.d.ts +0 -61
  283. package/lib/types/lib/reanimated2/platform-specific/RNRenderer.d.ts +0 -1
  284. package/lib/types/lib/reanimated2/platform-specific/RNRenderer.web.d.ts +0 -0
  285. package/lib/types/lib/reanimated2/platform-specific/checkVersion.d.ts +0 -4
  286. package/lib/types/lib/reanimated2/platform-specific/checkVersion.web.d.ts +0 -5
  287. package/lib/types/lib/reanimated2/utils.d.ts +0 -11
  288. package/lib/types/lib/setAndForwardRef.d.ts +0 -40
@@ -1,183 +0,0 @@
1
- /* global _WORKLET */
2
- import { isColor, convertToRGBA, rgbaArrayToRGBAColor, toGammaSpace, toLinearSpace, } from '../Colors';
3
- import NativeReanimatedModule from '../NativeReanimated';
4
- let IN_STYLE_UPDATER = false;
5
- export function initialUpdaterRun(updater) {
6
- IN_STYLE_UPDATER = true;
7
- const result = updater();
8
- IN_STYLE_UPDATER = false;
9
- return result;
10
- }
11
- function recognizePrefixSuffix(value) {
12
- 'worklet';
13
- var _a;
14
- if (typeof value === 'string') {
15
- const match = value.match(/([A-Za-z]*)(-?\d*\.?\d*)([eE][-+]?[0-9]+)?([A-Za-z%]*)/);
16
- if (!match) {
17
- throw Error("Couldn't parse animation value. Check if there isn't any typo.");
18
- }
19
- const prefix = match[1];
20
- const suffix = match[4];
21
- // number with scientific notation
22
- const number = match[2] + ((_a = match[3]) !== null && _a !== void 0 ? _a : '');
23
- return { prefix, suffix, strippedValue: parseFloat(number) };
24
- }
25
- else {
26
- return { strippedValue: value };
27
- }
28
- }
29
- function decorateAnimation(animation) {
30
- 'worklet';
31
- if (animation.isHigherOrder) {
32
- return;
33
- }
34
- const baseOnStart = animation.onStart;
35
- const baseOnFrame = animation.onFrame;
36
- const animationCopy = Object.assign({}, animation);
37
- delete animationCopy.callback;
38
- const prefNumberSuffOnStart = (animation, value, timestamp, previousAnimation) => {
39
- var _a, _b, _c, _d;
40
- // recognize prefix, suffix, and updates stripped value on animation start
41
- const { prefix, suffix, strippedValue } = recognizePrefixSuffix(value);
42
- animation.__prefix = prefix;
43
- animation.__suffix = suffix;
44
- animation.strippedCurrent = strippedValue;
45
- const { strippedValue: strippedToValue } = recognizePrefixSuffix(animation.toValue);
46
- animation.current = strippedValue;
47
- animation.startValue = strippedValue;
48
- animation.toValue = strippedToValue;
49
- if (previousAnimation && previousAnimation !== animation) {
50
- const { prefix: paPrefix, suffix: paSuffix, strippedValue: paStrippedValue, } = recognizePrefixSuffix(previousAnimation.current);
51
- previousAnimation.current = paStrippedValue;
52
- previousAnimation.__prefix = paPrefix;
53
- previousAnimation.__suffix = paSuffix;
54
- }
55
- baseOnStart(animation, strippedValue, timestamp, previousAnimation);
56
- animation.current =
57
- ((_a = animation.__prefix) !== null && _a !== void 0 ? _a : '') +
58
- animation.current +
59
- ((_b = animation.__suffix) !== null && _b !== void 0 ? _b : '');
60
- if (previousAnimation && previousAnimation !== animation) {
61
- previousAnimation.current =
62
- ((_c = previousAnimation.__prefix) !== null && _c !== void 0 ? _c : '') +
63
- previousAnimation.current +
64
- ((_d = previousAnimation.__suffix) !== null && _d !== void 0 ? _d : '');
65
- }
66
- };
67
- const prefNumberSuffOnFrame = (animation, timestamp) => {
68
- var _a, _b;
69
- animation.current = animation.strippedCurrent;
70
- const res = baseOnFrame(animation, timestamp);
71
- animation.strippedCurrent = animation.current;
72
- animation.current =
73
- ((_a = animation.__prefix) !== null && _a !== void 0 ? _a : '') +
74
- animation.current +
75
- ((_b = animation.__suffix) !== null && _b !== void 0 ? _b : '');
76
- return res;
77
- };
78
- const tab = ['R', 'G', 'B', 'A'];
79
- const colorOnStart = (animation, value, timestamp, previousAnimation) => {
80
- let RGBAValue;
81
- let RGBACurrent;
82
- let RGBAToValue;
83
- const res = [];
84
- if (isColor(value)) {
85
- RGBACurrent = toLinearSpace(convertToRGBA(animation.current));
86
- RGBAValue = toLinearSpace(convertToRGBA(value));
87
- if (animation.toValue) {
88
- RGBAToValue = toLinearSpace(convertToRGBA(animation.toValue));
89
- }
90
- }
91
- tab.forEach((i, index) => {
92
- animation[i] = Object.assign({}, animationCopy);
93
- animation[i].current = RGBACurrent[index];
94
- animation[i].toValue = RGBAToValue ? RGBAToValue[index] : undefined;
95
- animation[i].onStart(animation[i], RGBAValue[index], timestamp, previousAnimation ? previousAnimation[i] : undefined);
96
- res.push(animation[i].current);
97
- });
98
- animation.current = rgbaArrayToRGBAColor(toGammaSpace(res));
99
- };
100
- const colorOnFrame = (animation, timestamp) => {
101
- const RGBACurrent = toLinearSpace(convertToRGBA(animation.current));
102
- const res = [];
103
- let finished = true;
104
- tab.forEach((i, index) => {
105
- animation[i].current = RGBACurrent[index];
106
- // @ts-ignore: disable-next-line
107
- finished &= animation[i].onFrame(animation[i], timestamp);
108
- res.push(animation[i].current);
109
- });
110
- animation.current = rgbaArrayToRGBAColor(toGammaSpace(res));
111
- return finished;
112
- };
113
- const arrayOnStart = (animation, value, timestamp, previousAnimation) => {
114
- value.forEach((v, i) => {
115
- animation[i] = Object.assign({}, animationCopy);
116
- animation[i].current = v;
117
- animation[i].toValue = animation.toValue[i];
118
- animation[i].onStart(animation[i], v, timestamp, previousAnimation ? previousAnimation[i] : undefined);
119
- });
120
- animation.current = value;
121
- };
122
- const arrayOnFrame = (animation, timestamp) => {
123
- let finished = true;
124
- animation.current.forEach((v, i) => {
125
- // @ts-ignore: disable-next-line
126
- finished &= animation[i].onFrame(animation[i], timestamp);
127
- animation.current[i] = animation[i].current;
128
- });
129
- return finished;
130
- };
131
- animation.onStart = (animation, value, timestamp, previousAnimation) => {
132
- if (isColor(value)) {
133
- colorOnStart(animation, value, timestamp, previousAnimation);
134
- animation.onFrame = colorOnFrame;
135
- return;
136
- }
137
- else if (Array.isArray(value)) {
138
- arrayOnStart(animation, value, timestamp, previousAnimation);
139
- animation.onFrame = arrayOnFrame;
140
- return;
141
- }
142
- else if (typeof value === 'string') {
143
- prefNumberSuffOnStart(animation, value, timestamp, previousAnimation);
144
- animation.onFrame = prefNumberSuffOnFrame;
145
- return;
146
- }
147
- baseOnStart(animation, value, timestamp, previousAnimation);
148
- };
149
- }
150
- export function defineAnimation(starting, factory) {
151
- 'worklet';
152
- if (IN_STYLE_UPDATER) {
153
- return starting;
154
- }
155
- const create = () => {
156
- 'worklet';
157
- const animation = factory();
158
- decorateAnimation(animation);
159
- return animation;
160
- };
161
- if (_WORKLET || !NativeReanimatedModule.native) {
162
- return create();
163
- }
164
- // @ts-ignore: eslint-disable-line
165
- return create;
166
- }
167
- export function cancelAnimation(sharedValue) {
168
- 'worklet';
169
- // setting the current value cancels the animation if one is currently running
170
- sharedValue.value = sharedValue.value; // eslint-disable-line no-self-assign
171
- }
172
- // TODO it should work only if there was no animation before.
173
- export function withStartValue(startValue, animation) {
174
- 'worklet';
175
- return defineAnimation(startValue, () => {
176
- 'worklet';
177
- if (!_WORKLET && typeof animation === 'function') {
178
- animation = animation();
179
- }
180
- animation.current = startValue;
181
- return animation;
182
- });
183
- }
@@ -1,8 +0,0 @@
1
- export var KeyboardState;
2
- (function (KeyboardState) {
3
- KeyboardState[KeyboardState["UNKNOWN"] = 0] = "UNKNOWN";
4
- KeyboardState[KeyboardState["OPENING"] = 1] = "OPENING";
5
- KeyboardState[KeyboardState["OPEN"] = 2] = "OPEN";
6
- KeyboardState[KeyboardState["CLOSING"] = 3] = "CLOSING";
7
- KeyboardState[KeyboardState["CLOSED"] = 4] = "CLOSED";
8
- })(KeyboardState || (KeyboardState = {}));
@@ -1,30 +0,0 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
- import React, { forwardRef } from 'react';
13
- import { FlatList } from 'react-native';
14
- import ReanimatedView from './View';
15
- import createAnimatedComponent from '../../createAnimatedComponent';
16
- const AnimatedFlatList = createAnimatedComponent(FlatList);
17
- const createCellRenderer = (itemLayoutAnimation) => {
18
- const cellRenderer = (props) => {
19
- return (<ReanimatedView layout={itemLayoutAnimation} onLayout={props.onLayout}>
20
- {props.children}
21
- </ReanimatedView>);
22
- };
23
- return cellRenderer;
24
- };
25
- const ReanimatedFlatlist = forwardRef((props, ref) => {
26
- const { itemLayoutAnimation } = props, restProps = __rest(props, ["itemLayoutAnimation"]);
27
- const cellRenderer = React.useMemo(() => createCellRenderer(itemLayoutAnimation), []);
28
- return (<AnimatedFlatList ref={ref} {...restProps} CellRendererComponent={cellRenderer}/>);
29
- });
30
- export default ReanimatedFlatlist;
@@ -1,4 +0,0 @@
1
- import { Image } from 'react-native';
2
- import createAnimatedComponent from '../../createAnimatedComponent';
3
- const AnimatedImage = createAnimatedComponent(Image);
4
- export default AnimatedImage;
@@ -1,4 +0,0 @@
1
- import { ScrollView } from 'react-native';
2
- import createAnimatedComponent from '../../createAnimatedComponent';
3
- const AnimatedScrollView = createAnimatedComponent(ScrollView);
4
- export default AnimatedScrollView;
@@ -1,4 +0,0 @@
1
- import { Text } from 'react-native';
2
- import createAnimatedComponent from '../../createAnimatedComponent';
3
- const AnimatedText = createAnimatedComponent(Text);
4
- export default AnimatedText;
@@ -1,4 +0,0 @@
1
- import { View } from 'react-native';
2
- import createAnimatedComponent from '../../createAnimatedComponent';
3
- const AnimatedView = createAnimatedComponent(View);
4
- export default AnimatedView;
@@ -1,269 +0,0 @@
1
- /* global _WORKLET _getCurrentTime _frameTimestamp _eventTimestamp, _setGlobalConsole */
2
- import NativeReanimatedModule from './NativeReanimated';
3
- import { Platform } from 'react-native';
4
- import { nativeShouldBeMock, shouldBeUseWeb, isWeb } from './PlatformChecker';
5
- if (global._setGlobalConsole === undefined) {
6
- // it can happen when Reanimated plugin wasn't added, but the user uses the only API from version 1
7
- global._setGlobalConsole = () => {
8
- // noop
9
- };
10
- }
11
- const testWorklet = () => {
12
- 'worklet';
13
- };
14
- const throwUninitializedReanimatedException = () => {
15
- throw new Error("Failed to initialize react-native-reanimated library, make sure you followed installation steps here: https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/installation/ \n1) Make sure reanimated's babel plugin is installed in your babel.config.js (you should have 'react-native-reanimated/plugin' listed there - also see the above link for details) \n2) Make sure you reset build cache after updating the config, run: yarn start --reset-cache");
16
- };
17
- export const checkPluginState = (throwError = true) => {
18
- if (!testWorklet.__workletHash && !shouldBeUseWeb()) {
19
- if (throwError) {
20
- throwUninitializedReanimatedException();
21
- }
22
- return false;
23
- }
24
- return true;
25
- };
26
- export const isConfigured = (throwError = false) => {
27
- return checkPluginState(throwError);
28
- };
29
- export const isConfiguredCheck = () => {
30
- checkPluginState(true);
31
- };
32
- function pushFrame(frame) {
33
- NativeReanimatedModule.pushFrame(frame);
34
- }
35
- export function requestFrame(frame) {
36
- 'worklet';
37
- if (NativeReanimatedModule.native) {
38
- requestAnimationFrame(frame);
39
- }
40
- else {
41
- pushFrame(frame);
42
- }
43
- }
44
- global._WORKLET = false;
45
- global._log = function (s) {
46
- console.log(s);
47
- };
48
- export function runOnUI(worklet) {
49
- return makeShareable(worklet);
50
- }
51
- export function makeShareable(value) {
52
- isConfiguredCheck();
53
- return NativeReanimatedModule.makeShareable(value);
54
- }
55
- export function getViewProp(viewTag, propName) {
56
- return new Promise((resolve, reject) => {
57
- return NativeReanimatedModule.getViewProp(viewTag, propName, (result) => {
58
- if (typeof result === 'string' && result.substr(0, 6) === 'error:') {
59
- reject(result);
60
- }
61
- else {
62
- resolve(result);
63
- }
64
- });
65
- });
66
- }
67
- let _getTimestamp;
68
- if (nativeShouldBeMock()) {
69
- _getTimestamp = () => {
70
- return NativeReanimatedModule.getTimestamp();
71
- };
72
- }
73
- else {
74
- _getTimestamp = () => {
75
- 'worklet';
76
- if (_frameTimestamp) {
77
- return _frameTimestamp;
78
- }
79
- if (_eventTimestamp) {
80
- return _eventTimestamp;
81
- }
82
- return _getCurrentTime();
83
- };
84
- }
85
- export function getTimestamp() {
86
- 'worklet';
87
- if (Platform.OS === 'web') {
88
- return NativeReanimatedModule.getTimestamp();
89
- }
90
- return _getTimestamp();
91
- }
92
- function workletValueSetter(value) {
93
- 'worklet';
94
- const previousAnimation = this._animation;
95
- if (previousAnimation) {
96
- previousAnimation.cancelled = true;
97
- this._animation = null;
98
- }
99
- if (typeof value === 'function' ||
100
- (value !== null &&
101
- typeof value === 'object' &&
102
- value.onFrame !== undefined)) {
103
- const animation = typeof value === 'function'
104
- ? value()
105
- : value;
106
- // prevent setting again to the same value
107
- // and triggering the mappers that treat this value as an input
108
- // this happens when the animation's target value(stored in animation.current until animation.onStart is called) is set to the same value as a current one(this._value)
109
- // built in animations that are not higher order(withTiming, withSpring) hold target value in .current
110
- if (this._value === animation.current && !animation.isHigherOrder) {
111
- animation.callback && animation.callback(true);
112
- return;
113
- }
114
- // animated set
115
- const initializeAnimation = (timestamp) => {
116
- animation.onStart(animation, this.value, timestamp, previousAnimation);
117
- };
118
- initializeAnimation(getTimestamp());
119
- const step = (timestamp) => {
120
- if (animation.cancelled) {
121
- animation.callback && animation.callback(false /* finished */);
122
- return;
123
- }
124
- const finished = animation.onFrame(animation, timestamp);
125
- animation.finished = true;
126
- animation.timestamp = timestamp;
127
- this._value = animation.current;
128
- if (finished) {
129
- animation.callback && animation.callback(true /* finished */);
130
- }
131
- else {
132
- requestAnimationFrame(step);
133
- }
134
- };
135
- this._animation = animation;
136
- if (_frameTimestamp) {
137
- // frame
138
- step(_frameTimestamp);
139
- }
140
- else {
141
- requestAnimationFrame(step);
142
- }
143
- }
144
- else {
145
- // prevent setting again to the same value
146
- // and triggering the mappers that treat this value as an input
147
- if (this._value === value) {
148
- return;
149
- }
150
- this._value = value;
151
- }
152
- }
153
- // We cannot use pushFrame
154
- // so we use own implementation for js
155
- function workletValueSetterJS(value) {
156
- const previousAnimation = this._animation;
157
- if (previousAnimation) {
158
- previousAnimation.cancelled = true;
159
- this._animation = null;
160
- }
161
- if (typeof value === 'function' ||
162
- (value !== null &&
163
- typeof value === 'object' &&
164
- value.onFrame)) {
165
- // animated set
166
- const animation = typeof value === 'function'
167
- ? value()
168
- : value;
169
- let initializeAnimation = (timestamp) => {
170
- animation.onStart(animation, this.value, timestamp, previousAnimation);
171
- };
172
- const step = (timestamp) => {
173
- if (animation.cancelled) {
174
- animation.callback && animation.callback(false /* finished */);
175
- return;
176
- }
177
- if (initializeAnimation) {
178
- initializeAnimation(timestamp);
179
- initializeAnimation = null; // prevent closure from keeping ref to previous animation
180
- }
181
- const finished = animation.onFrame(animation, timestamp);
182
- animation.timestamp = timestamp;
183
- this._setValue && this._setValue(animation.current);
184
- if (finished) {
185
- animation.callback && animation.callback(true /* finished */);
186
- }
187
- else {
188
- requestFrame(step);
189
- }
190
- };
191
- this._animation = animation;
192
- requestFrame(step);
193
- }
194
- else {
195
- this._setValue && this._setValue(value);
196
- }
197
- }
198
- export function makeMutable(value) {
199
- isConfiguredCheck();
200
- return NativeReanimatedModule.makeMutable(value);
201
- }
202
- export function makeRemote(object = {}) {
203
- isConfiguredCheck();
204
- return NativeReanimatedModule.makeRemote(object);
205
- }
206
- export function startMapper(mapper, inputs = [], outputs = [], updater = () => {
207
- // noop
208
- }, viewDescriptors = []) {
209
- isConfiguredCheck();
210
- return NativeReanimatedModule.startMapper(mapper, inputs, outputs, updater, viewDescriptors);
211
- }
212
- export function stopMapper(mapperId) {
213
- NativeReanimatedModule.stopMapper(mapperId);
214
- }
215
- export function runOnJS(fun) {
216
- 'worklet';
217
- if (!_WORKLET) {
218
- return fun;
219
- }
220
- if (!fun.__callAsync) {
221
- throw new Error("Attempting to call runOnJS with an object that is not a host function. Using runOnJS is only possible with methods that are defined on the main React-Native Javascript thread and that aren't marked as worklets");
222
- }
223
- else {
224
- return fun.__callAsync;
225
- }
226
- }
227
- NativeReanimatedModule.installCoreFunctions(NativeReanimatedModule.native
228
- ? workletValueSetter
229
- : workletValueSetterJS);
230
- if (!isWeb() && isConfigured()) {
231
- const capturableConsole = console;
232
- runOnUI(() => {
233
- 'worklet';
234
- const console = {
235
- debug: runOnJS(capturableConsole.debug),
236
- log: runOnJS(capturableConsole.log),
237
- warn: runOnJS(capturableConsole.warn),
238
- error: runOnJS(capturableConsole.error),
239
- info: runOnJS(capturableConsole.info),
240
- };
241
- _setGlobalConsole(console);
242
- })();
243
- }
244
- let featuresConfig = {
245
- enableLayoutAnimations: false,
246
- setByUser: false,
247
- };
248
- export function enableLayoutAnimations(flag, isCallByUser = true) {
249
- if (isCallByUser) {
250
- featuresConfig = {
251
- enableLayoutAnimations: flag,
252
- setByUser: true,
253
- };
254
- NativeReanimatedModule.enableLayoutAnimations(flag);
255
- }
256
- else if (!featuresConfig.setByUser &&
257
- featuresConfig.enableLayoutAnimations !== flag) {
258
- featuresConfig.enableLayoutAnimations = flag;
259
- NativeReanimatedModule.enableLayoutAnimations(flag);
260
- }
261
- }
262
- export function configureProps(uiProps, nativeProps) {
263
- if (!nativeShouldBeMock()) {
264
- NativeReanimatedModule.configureProps(uiProps, nativeProps);
265
- }
266
- }
267
- export function jestResetJsReanimatedModule() {
268
- NativeReanimatedModule.jestResetModule();
269
- }
@@ -1,32 +0,0 @@
1
- import { runOnUI } from '../core';
2
- import { prepareUIRegistry } from './FrameCallbackRegistryUI';
3
- export default class FrameCallbackRegistryJS {
4
- constructor() {
5
- this.nextCallbackId = 0;
6
- prepareUIRegistry();
7
- }
8
- registerFrameCallback(callback) {
9
- if (!callback) {
10
- return -1;
11
- }
12
- const callbackId = this.nextCallbackId;
13
- this.nextCallbackId++;
14
- runOnUI(() => {
15
- 'worklet';
16
- global._frameCallbackRegistry.registerFrameCallback(callback, callbackId);
17
- })();
18
- return callbackId;
19
- }
20
- unregisterFrameCallback(callbackId) {
21
- runOnUI(() => {
22
- 'worklet';
23
- global._frameCallbackRegistry.unregisterFrameCallback(callbackId);
24
- })();
25
- }
26
- manageStateFrameCallback(callbackId, state) {
27
- runOnUI(() => {
28
- 'worklet';
29
- global._frameCallbackRegistry.manageStateFrameCallback(callbackId, state);
30
- })();
31
- }
32
- }
@@ -1,76 +0,0 @@
1
- import { runOnUI } from '../core';
2
- export const prepareUIRegistry = runOnUI(() => {
3
- 'worklet';
4
- const frameCallbackRegistry = {
5
- frameCallbackRegistry: new Map(),
6
- activeFrameCallbacks: new Set(),
7
- previousFrameTimestamp: null,
8
- runCallbacks() {
9
- const loop = (timestamp) => {
10
- if (this.previousFrameTimestamp === null) {
11
- this.previousFrameTimestamp = timestamp;
12
- }
13
- const delta = timestamp - this.previousFrameTimestamp;
14
- this.activeFrameCallbacks.forEach((callbackId) => {
15
- const callbackDetails = this.frameCallbackRegistry.get(callbackId);
16
- const { startTime } = callbackDetails;
17
- if (startTime === null) {
18
- // First frame
19
- callbackDetails.startTime = timestamp;
20
- callbackDetails.callback({
21
- timestamp,
22
- timeSincePreviousFrame: null,
23
- timeSinceFirstFrame: 0,
24
- });
25
- }
26
- else {
27
- // Next frame
28
- callbackDetails.callback({
29
- timestamp,
30
- timeSincePreviousFrame: delta,
31
- timeSinceFirstFrame: timestamp - startTime,
32
- });
33
- }
34
- });
35
- if (this.activeFrameCallbacks.size > 0) {
36
- this.previousFrameTimestamp = timestamp;
37
- requestAnimationFrame(loop);
38
- }
39
- else {
40
- this.previousFrameTimestamp = null;
41
- }
42
- };
43
- // runCallback() should only be called after registering a callback,
44
- // so if there is only one active callback, then it means that there were
45
- // zero previously and the loop isn't running yet.
46
- if (this.activeFrameCallbacks.size === 1) {
47
- requestAnimationFrame(loop);
48
- }
49
- },
50
- registerFrameCallback(callback, callbackId) {
51
- this.frameCallbackRegistry.set(callbackId, {
52
- callback: callback,
53
- startTime: null,
54
- });
55
- },
56
- unregisterFrameCallback(callbackId) {
57
- this.manageStateFrameCallback(callbackId, false);
58
- this.frameCallbackRegistry.delete(callbackId);
59
- },
60
- manageStateFrameCallback(callbackId, state) {
61
- if (callbackId === -1) {
62
- return;
63
- }
64
- if (state) {
65
- this.activeFrameCallbacks.add(callbackId);
66
- this.runCallbacks();
67
- }
68
- else {
69
- const callback = this.frameCallbackRegistry.get(callbackId);
70
- callback.startTime = null;
71
- this.activeFrameCallbacks.delete(callbackId);
72
- }
73
- },
74
- };
75
- global._frameCallbackRegistry = frameCallbackRegistry;
76
- });