react-native-reanimated 2.3.0-alpha.3 → 2.3.0-beta.4

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 (264) hide show
  1. package/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +15 -8
  2. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +176 -154
  3. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +49 -33
  4. package/Common/cpp/Registries/EventHandlerRegistry.cpp +14 -7
  5. package/Common/cpp/Registries/MapperRegistry.cpp +24 -20
  6. package/Common/cpp/Registries/WorkletsCache.cpp +19 -9
  7. package/Common/cpp/SharedItems/FrozenObject.cpp +17 -8
  8. package/Common/cpp/SharedItems/MutableValue.cpp +38 -25
  9. package/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +11 -7
  10. package/Common/cpp/SharedItems/RemoteObject.cpp +9 -5
  11. package/Common/cpp/SharedItems/ShareableValue.cpp +211 -160
  12. package/Common/cpp/Tools/FeaturesConfig.cpp +5 -0
  13. package/Common/cpp/Tools/JSIStoreValueUser.cpp +25 -6
  14. package/Common/cpp/Tools/Mapper.cpp +30 -30
  15. package/Common/cpp/Tools/RuntimeDecorator.cpp +124 -86
  16. package/Common/cpp/Tools/Scheduler.cpp +6 -5
  17. package/Common/cpp/Tools/WorkletEventHandler.cpp +4 -2
  18. package/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +12 -11
  19. package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +50 -31
  20. package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +34 -16
  21. package/Common/cpp/headers/Registries/EventHandlerRegistry.h +15 -8
  22. package/Common/cpp/headers/Registries/MapperRegistry.h +5 -4
  23. package/Common/cpp/headers/Registries/WorkletsCache.h +9 -7
  24. package/Common/cpp/headers/SharedItems/FrozenObject.h +19 -11
  25. package/Common/cpp/headers/SharedItems/HostFunctionHandler.h +8 -4
  26. package/Common/cpp/headers/SharedItems/MutableValue.h +23 -12
  27. package/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +12 -7
  28. package/Common/cpp/headers/SharedItems/RemoteObject.h +19 -8
  29. package/Common/cpp/headers/SharedItems/RuntimeManager.h +26 -25
  30. package/Common/cpp/headers/SharedItems/ShareableValue.h +32 -27
  31. package/Common/cpp/headers/SharedItems/SharedParent.h +10 -7
  32. package/Common/cpp/headers/SharedItems/ValueWrapper.h +95 -72
  33. package/Common/cpp/headers/SpecTools/ErrorHandler.h +18 -19
  34. package/Common/cpp/headers/Tools/FeaturesConfig.h +19 -0
  35. package/Common/cpp/headers/Tools/JSIStoreValueUser.h +13 -16
  36. package/Common/cpp/headers/Tools/Mapper.h +19 -16
  37. package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +17 -7
  38. package/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h +7 -11
  39. package/Common/cpp/headers/Tools/RuntimeDecorator.h +36 -27
  40. package/Common/cpp/headers/Tools/Scheduler.h +30 -35
  41. package/Common/cpp/headers/Tools/WorkletEventHandler.h +11 -8
  42. package/Common/cpp/hidden_headers/Logger.h +14 -14
  43. package/Common/cpp/hidden_headers/LoggerInterface.h +8 -9
  44. package/Common/cpp/hidden_headers/SpeedChecker.h +7 -8
  45. package/README.md +1 -1
  46. package/RNReanimated.podspec +24 -6
  47. package/android/build.gradle +38 -29
  48. package/android/react-native-reanimated-63-hermes.aar +0 -0
  49. package/android/react-native-reanimated-63-jsc.aar +0 -0
  50. package/android/react-native-reanimated-64-hermes.aar +0 -0
  51. package/android/react-native-reanimated-64-jsc.aar +0 -0
  52. package/android/react-native-reanimated-65-hermes.aar +0 -0
  53. package/android/react-native-reanimated-65-jsc.aar +0 -0
  54. package/android/react-native-reanimated-66-hermes.aar +0 -0
  55. package/android/react-native-reanimated-66-jsc.aar +0 -0
  56. package/android/react-native-reanimated-67-hermes.aar +0 -0
  57. package/android/react-native-reanimated-67-jsc.aar +0 -0
  58. package/ios/LayoutReanimation/REAAnimationsManager.h +10 -8
  59. package/ios/LayoutReanimation/REAAnimationsManager.m +91 -87
  60. package/ios/LayoutReanimation/REASnapshot.h +2 -2
  61. package/ios/LayoutReanimation/REASnapshot.m +8 -7
  62. package/ios/LayoutReanimation/REAUIManager.h +4 -4
  63. package/ios/LayoutReanimation/REAUIManager.mm +116 -70
  64. package/ios/Nodes/REAAlwaysNode.m +14 -15
  65. package/ios/Nodes/REABezierNode.m +8 -7
  66. package/ios/Nodes/REABlockNode.m +1 -1
  67. package/ios/Nodes/REACallFuncNode.h +0 -1
  68. package/ios/Nodes/REACallFuncNode.m +10 -8
  69. package/ios/Nodes/REAClockNodes.m +22 -20
  70. package/ios/Nodes/REAConcatNode.h +0 -1
  71. package/ios/Nodes/REAConcatNode.m +2 -2
  72. package/ios/Nodes/REACondNode.m +7 -5
  73. package/ios/Nodes/READebugNode.m +5 -4
  74. package/ios/Nodes/REAEventNode.m +1 -1
  75. package/ios/Nodes/REAFunctionNode.h +0 -1
  76. package/ios/Nodes/REAFunctionNode.m +2 -2
  77. package/ios/Nodes/REAJSCallNode.m +4 -5
  78. package/ios/Nodes/REANode.h +3 -4
  79. package/ios/Nodes/REANode.m +9 -11
  80. package/ios/Nodes/REAOperatorNode.m +68 -67
  81. package/ios/Nodes/REAParamNode.h +1 -3
  82. package/ios/Nodes/REAParamNode.m +15 -17
  83. package/ios/Nodes/REAPropsNode.h +1 -3
  84. package/ios/Nodes/REAPropsNode.m +19 -22
  85. package/ios/Nodes/REASetNode.h +0 -1
  86. package/ios/Nodes/REASetNode.m +7 -5
  87. package/ios/Nodes/REAStyleNode.h +0 -1
  88. package/ios/Nodes/REAStyleNode.m +2 -4
  89. package/ios/Nodes/REATransformNode.h +0 -1
  90. package/ios/Nodes/REATransformNode.m +3 -5
  91. package/ios/Nodes/REAValueNode.m +5 -7
  92. package/ios/REAEventDispatcher.m +4 -4
  93. package/ios/REAModule.h +0 -2
  94. package/ios/REAModule.m +29 -38
  95. package/ios/REANodesManager.h +11 -19
  96. package/ios/REANodesManager.m +106 -130
  97. package/ios/REAUtils.h +5 -3
  98. package/ios/RNGestureHandlerStateManager.h +5 -0
  99. package/ios/Transitioning/RCTConvert+REATransition.m +45 -29
  100. package/ios/Transitioning/REAAllTransitions.h +2 -2
  101. package/ios/Transitioning/REAAllTransitions.m +14 -25
  102. package/ios/Transitioning/REATransition.h +8 -7
  103. package/ios/Transitioning/REATransition.m +19 -16
  104. package/ios/Transitioning/REATransitionAnimation.h +1 -1
  105. package/ios/Transitioning/REATransitionAnimation.m +2 -3
  106. package/ios/Transitioning/REATransitionManager.m +3 -3
  107. package/ios/native/NativeMethods.h +20 -5
  108. package/ios/native/NativeMethods.mm +14 -6
  109. package/ios/native/NativeProxy.h +4 -2
  110. package/ios/native/NativeProxy.mm +84 -63
  111. package/ios/native/REAIOSErrorHandler.h +13 -10
  112. package/ios/native/REAIOSErrorHandler.mm +19 -15
  113. package/ios/native/REAIOSLogger.h +8 -8
  114. package/ios/native/REAIOSLogger.mm +10 -6
  115. package/ios/native/REAIOSScheduler.h +5 -5
  116. package/ios/native/REAIOSScheduler.mm +17 -10
  117. package/ios/native/REAInitializer.h +5 -7
  118. package/ios/native/REAInitializer.mm +43 -31
  119. package/ios/native/UIResponder+Reanimated.mm +2 -2
  120. package/lib/Animated.js +9 -1
  121. package/lib/ConfigHelper.js +121 -138
  122. package/lib/ReanimatedEventEmitter.js +0 -1
  123. package/lib/ReanimatedModule.js +0 -1
  124. package/lib/ReanimatedModule.macos.js +0 -1
  125. package/lib/ReanimatedModule.native.js +5 -6
  126. package/lib/ReanimatedModule.windows.js +0 -1
  127. package/lib/ReanimatedModuleCompat.js +64 -35
  128. package/lib/createAnimatedComponent.js +468 -487
  129. package/lib/index.js +9 -1
  130. package/lib/reanimated2/NativeMethods.js +7 -12
  131. package/lib/reanimated2/NativeReanimated/NativeReanimated.js +37 -0
  132. package/lib/reanimated2/NativeReanimated/index.js +15 -0
  133. package/lib/reanimated2/PropAdapters.js +0 -1
  134. package/lib/reanimated2/UpdateProps.js +6 -7
  135. package/lib/reanimated2/ViewDescriptorsSet.js +4 -4
  136. package/lib/reanimated2/WorkletEventHandler.js +15 -13
  137. package/lib/reanimated2/animation/delay.js +8 -2
  138. package/lib/reanimated2/animation/spring.js +2 -0
  139. package/lib/reanimated2/animation/styleAnimation.js +7 -3
  140. package/lib/reanimated2/animation/util.js +25 -2
  141. package/lib/reanimated2/core.js +41 -17
  142. package/lib/reanimated2/globals.d.ts +21 -1
  143. package/lib/reanimated2/hook/useAnimatedRef.js +1 -1
  144. package/lib/reanimated2/hook/useAnimatedStyle.js +3 -3
  145. package/lib/reanimated2/index.js +1 -0
  146. package/lib/reanimated2/interpolation.js +95 -87
  147. package/lib/reanimated2/js-reanimated/JSReanimated.js +13 -10
  148. package/lib/reanimated2/js-reanimated/Mapper.js +4 -3
  149. package/lib/reanimated2/js-reanimated/MapperRegistry.js +3 -6
  150. package/lib/reanimated2/js-reanimated/MutableValue.js +0 -2
  151. package/lib/reanimated2/js-reanimated/index.js +10 -8
  152. package/lib/reanimated2/layoutReanimation/LayoutAnimationRepository.js +33 -2
  153. package/lib/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +27 -124
  154. package/lib/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +125 -0
  155. package/lib/reanimated2/layoutReanimation/animationBuilder/index.js +1 -2
  156. package/lib/reanimated2/layoutReanimation/defaultAnimations/Bounce.js +115 -45
  157. package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +7 -2
  158. package/lib/reanimated2/layoutReanimation/defaultAnimations/Fade.js +21 -21
  159. package/lib/reanimated2/layoutReanimation/defaultAnimations/Flip.js +25 -25
  160. package/lib/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.js +19 -17
  161. package/lib/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.js +5 -5
  162. package/lib/reanimated2/layoutReanimation/defaultAnimations/Roll.js +9 -9
  163. package/lib/reanimated2/layoutReanimation/defaultAnimations/Rotate.js +17 -17
  164. package/lib/reanimated2/layoutReanimation/defaultAnimations/Slide.js +19 -19
  165. package/lib/reanimated2/layoutReanimation/defaultAnimations/Stretch.js +9 -9
  166. package/lib/reanimated2/layoutReanimation/defaultAnimations/Zoom.js +33 -33
  167. package/lib/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.js +78 -0
  168. package/lib/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.js +128 -0
  169. package/lib/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.js +37 -0
  170. package/lib/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.js +41 -0
  171. package/lib/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.js +34 -0
  172. package/lib/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.js +46 -0
  173. package/lib/reanimated2/layoutReanimation/defaultTransitions/index.js +6 -0
  174. package/lib/reanimated2/layoutReanimation/index.js +1 -0
  175. package/lib/reanimated2/mock.js +3 -1
  176. package/lib/reanimated2/utils.js +9 -0
  177. package/lib/setAndForwardRef.js +14 -48
  178. package/libSo/fbjni/jni/arm64-v8a/libfbjni.so +0 -0
  179. package/libSo/fbjni/jni/armeabi-v7a/libfbjni.so +0 -0
  180. package/libSo/fbjni/jni/x86/libfbjni.so +0 -0
  181. package/libSo/fbjni/jni/x86_64/libfbjni.so +0 -0
  182. package/mock.js +1 -1
  183. package/package.json +28 -17
  184. package/plugin.js +220 -39
  185. package/react-native-reanimated.d.ts +542 -547
  186. package/src/Animated.js +9 -1
  187. package/src/{ConfigHelper.js → ConfigHelper.ts} +15 -7
  188. package/src/{ReanimatedEventEmitter.js → ReanimatedEventEmitter.ts} +0 -0
  189. package/src/{ReanimatedModule.js → ReanimatedModule.macos.ts} +0 -0
  190. package/src/{ReanimatedModule.native.js → ReanimatedModule.native.ts} +0 -0
  191. package/src/{ReanimatedModule.macos.js → ReanimatedModule.ts} +0 -0
  192. package/src/{ReanimatedModule.windows.js → ReanimatedModule.windows.ts} +0 -0
  193. package/src/ReanimatedModuleCompat.ts +51 -0
  194. package/src/{createAnimatedComponent.js → createAnimatedComponent.tsx} +285 -126
  195. package/src/reanimated2/NativeMethods.ts +34 -13
  196. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +72 -0
  197. package/src/reanimated2/NativeReanimated/index.ts +18 -0
  198. package/src/reanimated2/PropAdapters.ts +0 -1
  199. package/src/reanimated2/UpdateProps.ts +31 -15
  200. package/src/reanimated2/ViewDescriptorsSet.ts +15 -12
  201. package/src/reanimated2/WorkletEventHandler.ts +41 -23
  202. package/src/reanimated2/animation/commonTypes.ts +4 -4
  203. package/src/reanimated2/animation/decay.ts +2 -2
  204. package/src/reanimated2/animation/delay.ts +11 -5
  205. package/src/reanimated2/animation/index.ts +7 -7
  206. package/src/reanimated2/animation/repeat.ts +4 -4
  207. package/src/reanimated2/animation/sequence.ts +2 -2
  208. package/src/reanimated2/animation/spring.ts +6 -5
  209. package/src/reanimated2/animation/styleAnimation.ts +27 -15
  210. package/src/reanimated2/animation/timing.ts +5 -5
  211. package/src/reanimated2/animation/util.ts +47 -8
  212. package/src/reanimated2/commonTypes.ts +3 -0
  213. package/src/reanimated2/core.ts +80 -34
  214. package/src/reanimated2/globals.d.ts +21 -1
  215. package/src/reanimated2/hook/useAnimatedGestureHandler.ts +1 -1
  216. package/src/reanimated2/hook/useAnimatedRef.ts +13 -15
  217. package/src/reanimated2/hook/useAnimatedScrollHandler.ts +3 -3
  218. package/src/reanimated2/hook/useAnimatedStyle.ts +7 -7
  219. package/src/reanimated2/hook/utils.ts +4 -3
  220. package/src/reanimated2/index.ts +1 -0
  221. package/src/reanimated2/interpolation.ts +170 -103
  222. package/src/reanimated2/js-reanimated/JSReanimated.ts +37 -23
  223. package/src/reanimated2/js-reanimated/Mapper.ts +22 -9
  224. package/src/reanimated2/js-reanimated/MapperRegistry.ts +22 -19
  225. package/src/reanimated2/js-reanimated/MutableValue.ts +11 -11
  226. package/src/reanimated2/js-reanimated/index.ts +31 -14
  227. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +75 -0
  228. package/src/reanimated2/layoutReanimation/animationBuilder/BaseAnimationBuilder.ts +29 -159
  229. package/src/reanimated2/layoutReanimation/animationBuilder/ComplexAnimationBuilder.ts +169 -0
  230. package/src/reanimated2/layoutReanimation/animationBuilder/Keyframe.ts +2 -2
  231. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +3 -9
  232. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +1 -5
  233. package/src/reanimated2/layoutReanimation/defaultAnimations/Bounce.ts +162 -82
  234. package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +7 -2
  235. package/src/reanimated2/layoutReanimation/defaultAnimations/Fade.ts +32 -32
  236. package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +38 -38
  237. package/src/reanimated2/layoutReanimation/defaultAnimations/Lightspeed.ts +34 -32
  238. package/src/reanimated2/layoutReanimation/defaultAnimations/Pinwheel.ts +8 -8
  239. package/src/reanimated2/layoutReanimation/defaultAnimations/Roll.ts +14 -14
  240. package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +26 -26
  241. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +28 -28
  242. package/src/reanimated2/layoutReanimation/defaultAnimations/Stretch.ts +14 -14
  243. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +50 -50
  244. package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +104 -0
  245. package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +213 -0
  246. package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +60 -0
  247. package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +58 -0
  248. package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +41 -0
  249. package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +78 -0
  250. package/src/reanimated2/layoutReanimation/defaultTransitions/index.ts +6 -0
  251. package/src/reanimated2/layoutReanimation/index.ts +1 -0
  252. package/src/reanimated2/mock.ts +3 -1
  253. package/src/reanimated2/utils.ts +21 -0
  254. package/src/{setAndForwardRef.js → setAndForwardRef.ts} +12 -2
  255. package/android/react-native-reanimated-62-hermes.aar +0 -0
  256. package/android/react-native-reanimated-62-jsc.aar +0 -0
  257. package/lib/reanimated2/NativeReanimated.js +0 -48
  258. package/lib/reanimated2/layoutReanimation/animationBuilder/BaseBounceAnimationBuilder.js +0 -55
  259. package/lib/reanimated2/layoutReanimation/animationBuilder/LayoutAnimationBuilder.js +0 -165
  260. package/src/ReanimatedModuleCompat.js +0 -37
  261. package/src/reanimated2/NativeReanimated.ts +0 -70
  262. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.tsx +0 -41
  263. package/src/reanimated2/layoutReanimation/animationBuilder/BaseBounceAnimationBuilder.ts +0 -82
  264. package/src/reanimated2/layoutReanimation/animationBuilder/LayoutAnimationBuilder.ts +0 -217
@@ -1,11 +1,11 @@
1
- import { BaseAnimationBuilder } from '../animationBuilder/BaseAnimationBuilder';
2
- export class StretchInX extends BaseAnimationBuilder {
1
+ import { ComplexAnimationBuilder } from '../animationBuilder';
2
+ export class StretchInX extends ComplexAnimationBuilder {
3
3
  constructor() {
4
4
  super(...arguments);
5
5
  this.build = () => {
6
6
  const delayFunction = this.getDelayFunction();
7
7
  const [animation, config] = this.getAnimationAndConfig();
8
- const delay = this.delayV;
8
+ const delay = this.getDelay();
9
9
  const callback = this.callbackV;
10
10
  return () => {
11
11
  'worklet';
@@ -25,13 +25,13 @@ export class StretchInX extends BaseAnimationBuilder {
25
25
  return new StretchInX();
26
26
  }
27
27
  }
28
- export class StretchInY extends BaseAnimationBuilder {
28
+ export class StretchInY extends ComplexAnimationBuilder {
29
29
  constructor() {
30
30
  super(...arguments);
31
31
  this.build = () => {
32
32
  const delayFunction = this.getDelayFunction();
33
33
  const [animation, config] = this.getAnimationAndConfig();
34
- const delay = this.delayV;
34
+ const delay = this.getDelay();
35
35
  const callback = this.callbackV;
36
36
  return () => {
37
37
  'worklet';
@@ -51,13 +51,13 @@ export class StretchInY extends BaseAnimationBuilder {
51
51
  return new StretchInY();
52
52
  }
53
53
  }
54
- export class StretchOutX extends BaseAnimationBuilder {
54
+ export class StretchOutX extends ComplexAnimationBuilder {
55
55
  constructor() {
56
56
  super(...arguments);
57
57
  this.build = () => {
58
58
  const delayFunction = this.getDelayFunction();
59
59
  const [animation, config] = this.getAnimationAndConfig();
60
- const delay = this.delayV;
60
+ const delay = this.getDelay();
61
61
  const callback = this.callbackV;
62
62
  return () => {
63
63
  'worklet';
@@ -77,13 +77,13 @@ export class StretchOutX extends BaseAnimationBuilder {
77
77
  return new StretchOutX();
78
78
  }
79
79
  }
80
- export class StretchOutY extends BaseAnimationBuilder {
80
+ export class StretchOutY extends ComplexAnimationBuilder {
81
81
  constructor() {
82
82
  super(...arguments);
83
83
  this.build = () => {
84
84
  const delayFunction = this.getDelayFunction();
85
85
  const [animation, config] = this.getAnimationAndConfig();
86
- const delay = this.delayV;
86
+ const delay = this.getDelay();
87
87
  const callback = this.callbackV;
88
88
  return () => {
89
89
  'worklet';
@@ -1,13 +1,13 @@
1
- import { BaseAnimationBuilder } from '../animationBuilder/BaseAnimationBuilder';
2
1
  import { Dimensions } from 'react-native';
2
+ import { ComplexAnimationBuilder } from '../animationBuilder';
3
3
  const { width, height } = Dimensions.get('window');
4
- export class ZoomIn extends BaseAnimationBuilder {
4
+ export class ZoomIn extends ComplexAnimationBuilder {
5
5
  constructor() {
6
6
  super(...arguments);
7
7
  this.build = () => {
8
8
  const delayFunction = this.getDelayFunction();
9
9
  const [animation, config] = this.getAnimationAndConfig();
10
- const delay = this.delayV;
10
+ const delay = this.getDelay();
11
11
  const callback = this.callbackV;
12
12
  return () => {
13
13
  'worklet';
@@ -27,13 +27,13 @@ export class ZoomIn extends BaseAnimationBuilder {
27
27
  return new ZoomIn();
28
28
  }
29
29
  }
30
- export class ZoomInRotate extends BaseAnimationBuilder {
30
+ export class ZoomInRotate extends ComplexAnimationBuilder {
31
31
  constructor() {
32
32
  super(...arguments);
33
33
  this.build = () => {
34
34
  const delayFunction = this.getDelayFunction();
35
35
  const [animation, config] = this.getAnimationAndConfig();
36
- const delay = this.delayV;
36
+ const delay = this.getDelay();
37
37
  const rotate = this.rotateV ? this.rotateV : '0.3';
38
38
  const callback = this.callbackV;
39
39
  return () => {
@@ -57,13 +57,13 @@ export class ZoomInRotate extends BaseAnimationBuilder {
57
57
  return new ZoomInRotate();
58
58
  }
59
59
  }
60
- export class ZoomInLeft extends BaseAnimationBuilder {
60
+ export class ZoomInLeft extends ComplexAnimationBuilder {
61
61
  constructor() {
62
62
  super(...arguments);
63
63
  this.build = () => {
64
64
  const delayFunction = this.getDelayFunction();
65
65
  const [animation, config] = this.getAnimationAndConfig();
66
- const delay = this.delayV;
66
+ const delay = this.getDelay();
67
67
  const callback = this.callbackV;
68
68
  return () => {
69
69
  'worklet';
@@ -86,13 +86,13 @@ export class ZoomInLeft extends BaseAnimationBuilder {
86
86
  return new ZoomInLeft();
87
87
  }
88
88
  }
89
- export class ZoomInRight extends BaseAnimationBuilder {
89
+ export class ZoomInRight extends ComplexAnimationBuilder {
90
90
  constructor() {
91
91
  super(...arguments);
92
92
  this.build = () => {
93
93
  const delayFunction = this.getDelayFunction();
94
94
  const [animation, config] = this.getAnimationAndConfig();
95
- const delay = this.delayV;
95
+ const delay = this.getDelay();
96
96
  const callback = this.callbackV;
97
97
  return () => {
98
98
  'worklet';
@@ -115,13 +115,13 @@ export class ZoomInRight extends BaseAnimationBuilder {
115
115
  return new ZoomInRight();
116
116
  }
117
117
  }
118
- export class ZoomInUp extends BaseAnimationBuilder {
118
+ export class ZoomInUp extends ComplexAnimationBuilder {
119
119
  constructor() {
120
120
  super(...arguments);
121
121
  this.build = () => {
122
122
  const delayFunction = this.getDelayFunction();
123
123
  const [animation, config] = this.getAnimationAndConfig();
124
- const delay = this.delayV;
124
+ const delay = this.getDelay();
125
125
  const callback = this.callbackV;
126
126
  return () => {
127
127
  'worklet';
@@ -144,13 +144,13 @@ export class ZoomInUp extends BaseAnimationBuilder {
144
144
  return new ZoomInUp();
145
145
  }
146
146
  }
147
- export class ZoomInDown extends BaseAnimationBuilder {
147
+ export class ZoomInDown extends ComplexAnimationBuilder {
148
148
  constructor() {
149
149
  super(...arguments);
150
150
  this.build = () => {
151
151
  const delayFunction = this.getDelayFunction();
152
152
  const [animation, config] = this.getAnimationAndConfig();
153
- const delay = this.delayV;
153
+ const delay = this.getDelay();
154
154
  const callback = this.callbackV;
155
155
  return () => {
156
156
  'worklet';
@@ -173,13 +173,13 @@ export class ZoomInDown extends BaseAnimationBuilder {
173
173
  return new ZoomInDown();
174
174
  }
175
175
  }
176
- export class ZoomInEasyUp extends BaseAnimationBuilder {
176
+ export class ZoomInEasyUp extends ComplexAnimationBuilder {
177
177
  constructor() {
178
178
  super(...arguments);
179
179
  this.build = () => {
180
180
  const delayFunction = this.getDelayFunction();
181
181
  const [animation, config] = this.getAnimationAndConfig();
182
- const delay = this.delayV;
182
+ const delay = this.getDelay();
183
183
  const callback = this.callbackV;
184
184
  return (values) => {
185
185
  'worklet';
@@ -202,13 +202,13 @@ export class ZoomInEasyUp extends BaseAnimationBuilder {
202
202
  return new ZoomInEasyUp();
203
203
  }
204
204
  }
205
- export class ZoomInEasyDown extends BaseAnimationBuilder {
205
+ export class ZoomInEasyDown extends ComplexAnimationBuilder {
206
206
  constructor() {
207
207
  super(...arguments);
208
208
  this.build = () => {
209
209
  const delayFunction = this.getDelayFunction();
210
210
  const [animation, config] = this.getAnimationAndConfig();
211
- const delay = this.delayV;
211
+ const delay = this.getDelay();
212
212
  const callback = this.callbackV;
213
213
  return (values) => {
214
214
  'worklet';
@@ -231,13 +231,13 @@ export class ZoomInEasyDown extends BaseAnimationBuilder {
231
231
  return new ZoomInEasyDown();
232
232
  }
233
233
  }
234
- export class ZoomOut extends BaseAnimationBuilder {
234
+ export class ZoomOut extends ComplexAnimationBuilder {
235
235
  constructor() {
236
236
  super(...arguments);
237
237
  this.build = () => {
238
238
  const delayFunction = this.getDelayFunction();
239
239
  const [animation, config] = this.getAnimationAndConfig();
240
- const delay = this.delayV;
240
+ const delay = this.getDelay();
241
241
  const callback = this.callbackV;
242
242
  return () => {
243
243
  'worklet';
@@ -257,13 +257,13 @@ export class ZoomOut extends BaseAnimationBuilder {
257
257
  return new ZoomOut();
258
258
  }
259
259
  }
260
- export class ZoomOutRotate extends BaseAnimationBuilder {
260
+ export class ZoomOutRotate extends ComplexAnimationBuilder {
261
261
  constructor() {
262
262
  super(...arguments);
263
263
  this.build = () => {
264
264
  const delayFunction = this.getDelayFunction();
265
265
  const [animation, config] = this.getAnimationAndConfig();
266
- const delay = this.delayV;
266
+ const delay = this.getDelay();
267
267
  const rotate = this.rotateV ? this.rotateV : '0.3';
268
268
  const callback = this.callbackV;
269
269
  return () => {
@@ -287,13 +287,13 @@ export class ZoomOutRotate extends BaseAnimationBuilder {
287
287
  return new ZoomOutRotate();
288
288
  }
289
289
  }
290
- export class ZoomOutLeft extends BaseAnimationBuilder {
290
+ export class ZoomOutLeft extends ComplexAnimationBuilder {
291
291
  constructor() {
292
292
  super(...arguments);
293
293
  this.build = () => {
294
294
  const delayFunction = this.getDelayFunction();
295
295
  const [animation, config] = this.getAnimationAndConfig();
296
- const delay = this.delayV;
296
+ const delay = this.getDelay();
297
297
  const callback = this.callbackV;
298
298
  return () => {
299
299
  'worklet';
@@ -316,13 +316,13 @@ export class ZoomOutLeft extends BaseAnimationBuilder {
316
316
  return new ZoomOutLeft();
317
317
  }
318
318
  }
319
- export class ZoomOutRight extends BaseAnimationBuilder {
319
+ export class ZoomOutRight extends ComplexAnimationBuilder {
320
320
  constructor() {
321
321
  super(...arguments);
322
322
  this.build = () => {
323
323
  const delayFunction = this.getDelayFunction();
324
324
  const [animation, config] = this.getAnimationAndConfig();
325
- const delay = this.delayV;
325
+ const delay = this.getDelay();
326
326
  const callback = this.callbackV;
327
327
  return () => {
328
328
  'worklet';
@@ -345,13 +345,13 @@ export class ZoomOutRight extends BaseAnimationBuilder {
345
345
  return new ZoomOutRight();
346
346
  }
347
347
  }
348
- export class ZoomOutUp extends BaseAnimationBuilder {
348
+ export class ZoomOutUp extends ComplexAnimationBuilder {
349
349
  constructor() {
350
350
  super(...arguments);
351
351
  this.build = () => {
352
352
  const delayFunction = this.getDelayFunction();
353
353
  const [animation, config] = this.getAnimationAndConfig();
354
- const delay = this.delayV;
354
+ const delay = this.getDelay();
355
355
  const callback = this.callbackV;
356
356
  return () => {
357
357
  'worklet';
@@ -374,13 +374,13 @@ export class ZoomOutUp extends BaseAnimationBuilder {
374
374
  return new ZoomOutUp();
375
375
  }
376
376
  }
377
- export class ZoomOutDown extends BaseAnimationBuilder {
377
+ export class ZoomOutDown extends ComplexAnimationBuilder {
378
378
  constructor() {
379
379
  super(...arguments);
380
380
  this.build = () => {
381
381
  const delayFunction = this.getDelayFunction();
382
382
  const [animation, config] = this.getAnimationAndConfig();
383
- const delay = this.delayV;
383
+ const delay = this.getDelay();
384
384
  const callback = this.callbackV;
385
385
  return () => {
386
386
  'worklet';
@@ -403,13 +403,13 @@ export class ZoomOutDown extends BaseAnimationBuilder {
403
403
  return new ZoomOutDown();
404
404
  }
405
405
  }
406
- export class ZoomOutEasyUp extends BaseAnimationBuilder {
406
+ export class ZoomOutEasyUp extends ComplexAnimationBuilder {
407
407
  constructor() {
408
408
  super(...arguments);
409
409
  this.build = () => {
410
410
  const delayFunction = this.getDelayFunction();
411
411
  const [animation, config] = this.getAnimationAndConfig();
412
- const delay = this.delayV;
412
+ const delay = this.getDelay();
413
413
  const callback = this.callbackV;
414
414
  return (values) => {
415
415
  'worklet';
@@ -434,13 +434,13 @@ export class ZoomOutEasyUp extends BaseAnimationBuilder {
434
434
  return new ZoomOutEasyUp();
435
435
  }
436
436
  }
437
- export class ZoomOutEasyDown extends BaseAnimationBuilder {
437
+ export class ZoomOutEasyDown extends ComplexAnimationBuilder {
438
438
  constructor() {
439
439
  super(...arguments);
440
440
  this.build = () => {
441
441
  const delayFunction = this.getDelayFunction();
442
442
  const [animation, config] = this.getAnimationAndConfig();
443
- const delay = this.delayV;
443
+ const delay = this.getDelay();
444
444
  const callback = this.callbackV;
445
445
  return (values) => {
446
446
  'worklet';
@@ -0,0 +1,78 @@
1
+ import { BaseAnimationBuilder } from '../animationBuilder';
2
+ import { Easing } from '../../Easing';
3
+ import { withTiming } from '../../animation';
4
+ export class CurvedTransition extends BaseAnimationBuilder {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.easingXV = Easing.in(Easing.ease);
8
+ this.easingYV = Easing.out(Easing.ease);
9
+ this.easingWidthV = Easing.in(Easing.exp);
10
+ this.easingHeightV = Easing.out(Easing.exp);
11
+ this.build = () => {
12
+ var _a;
13
+ const delayFunction = this.getDelayFunction();
14
+ const callback = this.callbackV;
15
+ const delay = this.getDelay();
16
+ const duration = (_a = this.durationV) !== null && _a !== void 0 ? _a : 300;
17
+ const easing = {
18
+ easingX: this.easingXV,
19
+ easingY: this.easingYV,
20
+ easingWidth: this.easingWidthV,
21
+ easingHeight: this.easingHeightV,
22
+ };
23
+ return (values) => {
24
+ 'worklet';
25
+ return {
26
+ initialValues: {
27
+ originX: values.boriginX,
28
+ originY: values.boriginY,
29
+ width: values.bwidth,
30
+ height: values.bheight,
31
+ },
32
+ animations: {
33
+ originX: delayFunction(delay, withTiming(values.originX, { duration, easing: easing.easingX })),
34
+ originY: delayFunction(delay, withTiming(values.originY, { duration, easing: easing.easingY })),
35
+ width: delayFunction(delay, withTiming(values.width, { duration, easing: easing.easingWidth })),
36
+ height: delayFunction(delay, withTiming(values.height, { duration, easing: easing.easingHeight })),
37
+ },
38
+ callback: callback,
39
+ };
40
+ };
41
+ };
42
+ }
43
+ static createInstance() {
44
+ return new CurvedTransition();
45
+ }
46
+ static easingX(easing) {
47
+ const instance = this.createInstance();
48
+ return instance.easingX(easing);
49
+ }
50
+ easingX(easing) {
51
+ this.easingXV = easing;
52
+ return this;
53
+ }
54
+ static easingY(easing) {
55
+ const instance = this.createInstance();
56
+ return instance.easingY(easing);
57
+ }
58
+ easingY(easing) {
59
+ this.easingYV = easing;
60
+ return this;
61
+ }
62
+ static easingWidth(easing) {
63
+ const instance = this.createInstance();
64
+ return instance.easingWidth(easing);
65
+ }
66
+ easingWidth(easing) {
67
+ this.easingWidthV = easing;
68
+ return this;
69
+ }
70
+ static easingHeight(easing) {
71
+ const instance = this.createInstance();
72
+ return instance.easingHeight(easing);
73
+ }
74
+ easingHeight(easing) {
75
+ this.easingHeightV = easing;
76
+ return this;
77
+ }
78
+ }
@@ -0,0 +1,128 @@
1
+ import { BaseAnimationBuilder } from '../animationBuilder';
2
+ import { withSequence, withTiming } from '../../animation';
3
+ import { FadeIn, FadeOut } from '../defaultAnimations/Fade';
4
+ export class EntryExitTransition extends BaseAnimationBuilder {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.enteringV = FadeIn;
8
+ this.exitingV = FadeOut;
9
+ this.build = () => {
10
+ const delayFunction = this.getDelayFunction();
11
+ const callback = this.callbackV;
12
+ const delay = this.getDelay();
13
+ const enteringAnimation = this.enteringV.build();
14
+ const exitingAnimation = this.exitingV.build();
15
+ const exitingDuration = this.exitingV.getDuration();
16
+ return (values) => {
17
+ 'worklet';
18
+ var _a, _b, _c, _d;
19
+ const enteringValues = enteringAnimation(values);
20
+ const exitingValues = exitingAnimation(values);
21
+ const animations = {
22
+ transform: [],
23
+ };
24
+ for (const prop of Object.keys(exitingValues.animations)) {
25
+ if (prop === 'transform') {
26
+ (_a = exitingValues.animations[prop]) === null || _a === void 0 ? void 0 : _a.forEach((value, index) => {
27
+ var _a;
28
+ for (const transformProp of Object.keys(value)) {
29
+ (_a = animations.transform) === null || _a === void 0 ? void 0 : _a.push({
30
+ [transformProp]: delayFunction(delay, withSequence(value[transformProp], withTiming(exitingValues.initialValues.transform
31
+ ? exitingValues.initialValues.transform[index][transformProp]
32
+ : 0, { duration: 0 }))),
33
+ });
34
+ }
35
+ });
36
+ }
37
+ else {
38
+ const sequence = enteringValues.animations[prop] !== undefined
39
+ ? [
40
+ exitingValues.animations[prop],
41
+ withTiming(enteringValues.initialValues[prop], {
42
+ duration: 0,
43
+ }),
44
+ enteringValues.animations[prop],
45
+ ]
46
+ : [
47
+ exitingValues.animations[prop],
48
+ withTiming(Object.keys(values).includes(prop)
49
+ ? values[prop]
50
+ : exitingValues.initialValues[prop], { duration: 0 }),
51
+ ];
52
+ animations[prop] = delayFunction(delay, withSequence(...sequence));
53
+ }
54
+ }
55
+ for (const prop of Object.keys(enteringValues.animations)) {
56
+ if (prop === 'transform') {
57
+ (_b = enteringValues.animations[prop]) === null || _b === void 0 ? void 0 : _b.forEach((value, index) => {
58
+ var _a;
59
+ for (const transformProp of Object.keys(value)) {
60
+ (_a = animations.transform) === null || _a === void 0 ? void 0 : _a.push({
61
+ [transformProp]: delayFunction(delay + exitingDuration, withSequence(withTiming(enteringValues.initialValues.transform
62
+ ? enteringValues.initialValues.transform[index][transformProp]
63
+ : 0, { duration: exitingDuration }), value[transformProp])),
64
+ });
65
+ }
66
+ });
67
+ }
68
+ else if (animations[prop] !== undefined) {
69
+ // it was already added in the previous loop
70
+ continue;
71
+ }
72
+ else {
73
+ animations[prop] = delayFunction(delay, withSequence(withTiming(enteringValues.initialValues[prop], { duration: 0 }), enteringValues.animations[prop]));
74
+ }
75
+ }
76
+ const mergedTransform = ((_c = exitingValues.initialValues.transform) !== null && _c !== void 0 ? _c : []).concat(((_d = enteringValues.animations.transform) !== null && _d !== void 0 ? _d : []).map((value) => {
77
+ for (const transformProp of Object.keys(value)) {
78
+ const current = value[transformProp].current;
79
+ if (typeof current === 'string') {
80
+ if (current.includes('deg'))
81
+ return {
82
+ [transformProp]: '0deg',
83
+ };
84
+ else
85
+ return {
86
+ [transformProp]: '0',
87
+ };
88
+ }
89
+ else if (transformProp.includes('translate')) {
90
+ return { [transformProp]: 0 };
91
+ }
92
+ else {
93
+ return { [transformProp]: 1 };
94
+ }
95
+ }
96
+ return value;
97
+ }));
98
+ return {
99
+ initialValues: Object.assign(Object.assign({}, exitingValues.initialValues), { originX: values.boriginX, originY: values.boriginY, width: values.bwidth, height: values.bheight, transform: mergedTransform }),
100
+ animations: Object.assign({ originX: delayFunction(delay + exitingDuration, withTiming(values.originX, { duration: exitingDuration })), originY: delayFunction(delay + exitingDuration, withTiming(values.originY, { duration: exitingDuration })), width: delayFunction(delay + exitingDuration, withTiming(values.width, { duration: exitingDuration })), height: delayFunction(delay + exitingDuration, withTiming(values.height, { duration: exitingDuration })) }, animations),
101
+ callback: callback,
102
+ };
103
+ };
104
+ };
105
+ }
106
+ static createInstance() {
107
+ return new EntryExitTransition();
108
+ }
109
+ static entering(animation) {
110
+ const instance = this.createInstance();
111
+ return instance.entering(animation);
112
+ }
113
+ entering(animation) {
114
+ this.enteringV = animation;
115
+ return this;
116
+ }
117
+ static exiting(animation) {
118
+ const instance = this.createInstance();
119
+ return instance.exiting(animation);
120
+ }
121
+ exiting(animation) {
122
+ this.exitingV = animation;
123
+ return this;
124
+ }
125
+ }
126
+ export function combineTransition(exiting, entering) {
127
+ return EntryExitTransition.entering(entering).exiting(exiting);
128
+ }
@@ -0,0 +1,37 @@
1
+ import { withSequence, withTiming } from '../../animation';
2
+ import { BaseAnimationBuilder } from '../animationBuilder';
3
+ export class FadingTransition extends BaseAnimationBuilder {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.build = () => {
7
+ var _a;
8
+ const delayFunction = this.getDelayFunction();
9
+ const callback = this.callbackV;
10
+ const delay = this.getDelay();
11
+ const duration = (_a = this.durationV) !== null && _a !== void 0 ? _a : 500;
12
+ return (values) => {
13
+ 'worklet';
14
+ return {
15
+ initialValues: {
16
+ opacity: 1,
17
+ originX: values.boriginX,
18
+ originY: values.boriginY,
19
+ width: values.bwidth,
20
+ height: values.bheight,
21
+ },
22
+ animations: {
23
+ opacity: delayFunction(delay, withSequence(withTiming(0, { duration: duration }), withTiming(1, { duration: duration }))),
24
+ originX: delayFunction(delay + duration, withTiming(values.originX, { duration: 50 })),
25
+ originY: delayFunction(delay + duration, withTiming(values.originY, { duration: 50 })),
26
+ width: delayFunction(delay + duration, withTiming(values.width, { duration: 50 })),
27
+ height: delayFunction(delay + duration, withTiming(values.height, { duration: 50 })),
28
+ },
29
+ callback: callback,
30
+ };
31
+ };
32
+ };
33
+ }
34
+ static createInstance() {
35
+ return new FadingTransition();
36
+ }
37
+ }
@@ -0,0 +1,41 @@
1
+ import { withSequence, withTiming } from '../../animation';
2
+ import { Easing } from '../../Easing';
3
+ import { BaseAnimationBuilder } from '../animationBuilder';
4
+ export class JumpingTransition extends BaseAnimationBuilder {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.build = () => {
8
+ var _a;
9
+ const delayFunction = this.getDelayFunction();
10
+ const callback = this.callbackV;
11
+ const delay = this.getDelay();
12
+ const duration = ((_a = this.durationV) !== null && _a !== void 0 ? _a : 300) / 2;
13
+ const config = { duration: duration * 2 };
14
+ return (values) => {
15
+ 'worklet';
16
+ const d = Math.max(Math.abs(values.originX - values.boriginX), Math.abs(values.originY - values.boriginY));
17
+ return {
18
+ initialValues: {
19
+ originX: values.boriginX,
20
+ originY: values.boriginY,
21
+ width: values.bwidth,
22
+ height: values.bheight,
23
+ },
24
+ animations: {
25
+ originX: delayFunction(delay, withTiming(values.originX, config)),
26
+ originY: delayFunction(delay, withSequence(withTiming(Math.min(values.originY, values.boriginY) - d, {
27
+ duration,
28
+ easing: Easing.out(Easing.exp),
29
+ }), withTiming(values.originY, Object.assign(Object.assign({}, config), { duration, easing: Easing.bounce })))),
30
+ width: delayFunction(delay, withTiming(values.width, config)),
31
+ height: delayFunction(delay, withTiming(values.height, config)),
32
+ },
33
+ callback: callback,
34
+ };
35
+ };
36
+ };
37
+ }
38
+ static createInstance() {
39
+ return new JumpingTransition();
40
+ }
41
+ }
@@ -0,0 +1,34 @@
1
+ import { ComplexAnimationBuilder } from '../animationBuilder/ComplexAnimationBuilder';
2
+ export class LinearTransition extends ComplexAnimationBuilder {
3
+ constructor() {
4
+ super(...arguments);
5
+ this.build = () => {
6
+ const delayFunction = this.getDelayFunction();
7
+ const [animation, config] = this.getAnimationAndConfig();
8
+ const callback = this.callbackV;
9
+ const delay = this.getDelay();
10
+ return (values) => {
11
+ 'worklet';
12
+ return {
13
+ initialValues: {
14
+ originX: values.boriginX,
15
+ originY: values.boriginY,
16
+ width: values.bwidth,
17
+ height: values.bheight,
18
+ },
19
+ animations: {
20
+ originX: delayFunction(delay, animation(values.originX, config)),
21
+ originY: delayFunction(delay, animation(values.originY, config)),
22
+ width: delayFunction(delay, animation(values.width, config)),
23
+ height: delayFunction(delay, animation(values.height, config)),
24
+ },
25
+ callback: callback,
26
+ };
27
+ };
28
+ };
29
+ }
30
+ static createInstance() {
31
+ return new LinearTransition();
32
+ }
33
+ }
34
+ export const Layout = LinearTransition;