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,23 +1,23 @@
1
1
  import {
2
2
  IEntryExitAnimationBuilder,
3
- EntryExitAnimationBuild,
3
+ EntryExitAnimationFunction,
4
4
  } from '../animationBuilder/commonTypes';
5
- import { BaseAnimationBuilder } from '../animationBuilder/BaseAnimationBuilder';
6
5
  import { Dimensions } from 'react-native';
6
+ import { ComplexAnimationBuilder } from '../animationBuilder';
7
7
 
8
8
  const { width, height } = Dimensions.get('window');
9
9
 
10
10
  export class ZoomIn
11
- extends BaseAnimationBuilder
11
+ extends ComplexAnimationBuilder
12
12
  implements IEntryExitAnimationBuilder {
13
13
  static createInstance(): ZoomIn {
14
14
  return new ZoomIn();
15
15
  }
16
16
 
17
- build: EntryExitAnimationBuild = () => {
17
+ build = (): EntryExitAnimationFunction => {
18
18
  const delayFunction = this.getDelayFunction();
19
19
  const [animation, config] = this.getAnimationAndConfig();
20
- const delay = this.delayV;
20
+ const delay = this.getDelay();
21
21
  const callback = this.callbackV;
22
22
 
23
23
  return () => {
@@ -36,16 +36,16 @@ export class ZoomIn
36
36
  }
37
37
 
38
38
  export class ZoomInRotate
39
- extends BaseAnimationBuilder
39
+ extends ComplexAnimationBuilder
40
40
  implements IEntryExitAnimationBuilder {
41
41
  static createInstance(): ZoomInRotate {
42
42
  return new ZoomInRotate();
43
43
  }
44
44
 
45
- build: EntryExitAnimationBuild = () => {
45
+ build = (): EntryExitAnimationFunction => {
46
46
  const delayFunction = this.getDelayFunction();
47
47
  const [animation, config] = this.getAnimationAndConfig();
48
- const delay = this.delayV;
48
+ const delay = this.getDelay();
49
49
  const rotate = this.rotateV ? this.rotateV : '0.3';
50
50
  const callback = this.callbackV;
51
51
 
@@ -68,16 +68,16 @@ export class ZoomInRotate
68
68
  }
69
69
 
70
70
  export class ZoomInLeft
71
- extends BaseAnimationBuilder
71
+ extends ComplexAnimationBuilder
72
72
  implements IEntryExitAnimationBuilder {
73
73
  static createInstance(): ZoomInLeft {
74
74
  return new ZoomInLeft();
75
75
  }
76
76
 
77
- build: EntryExitAnimationBuild = () => {
77
+ build = (): EntryExitAnimationFunction => {
78
78
  const delayFunction = this.getDelayFunction();
79
79
  const [animation, config] = this.getAnimationAndConfig();
80
- const delay = this.delayV;
80
+ const delay = this.getDelay();
81
81
  const callback = this.callbackV;
82
82
 
83
83
  return () => {
@@ -99,16 +99,16 @@ export class ZoomInLeft
99
99
  }
100
100
 
101
101
  export class ZoomInRight
102
- extends BaseAnimationBuilder
102
+ extends ComplexAnimationBuilder
103
103
  implements IEntryExitAnimationBuilder {
104
104
  static createInstance(): ZoomInRight {
105
105
  return new ZoomInRight();
106
106
  }
107
107
 
108
- build: EntryExitAnimationBuild = () => {
108
+ build = (): EntryExitAnimationFunction => {
109
109
  const delayFunction = this.getDelayFunction();
110
110
  const [animation, config] = this.getAnimationAndConfig();
111
- const delay = this.delayV;
111
+ const delay = this.getDelay();
112
112
  const callback = this.callbackV;
113
113
 
114
114
  return () => {
@@ -130,16 +130,16 @@ export class ZoomInRight
130
130
  }
131
131
 
132
132
  export class ZoomInUp
133
- extends BaseAnimationBuilder
133
+ extends ComplexAnimationBuilder
134
134
  implements IEntryExitAnimationBuilder {
135
135
  static createInstance(): ZoomInUp {
136
136
  return new ZoomInUp();
137
137
  }
138
138
 
139
- build: EntryExitAnimationBuild = () => {
139
+ build = (): EntryExitAnimationFunction => {
140
140
  const delayFunction = this.getDelayFunction();
141
141
  const [animation, config] = this.getAnimationAndConfig();
142
- const delay = this.delayV;
142
+ const delay = this.getDelay();
143
143
  const callback = this.callbackV;
144
144
 
145
145
  return () => {
@@ -161,16 +161,16 @@ export class ZoomInUp
161
161
  }
162
162
 
163
163
  export class ZoomInDown
164
- extends BaseAnimationBuilder
164
+ extends ComplexAnimationBuilder
165
165
  implements IEntryExitAnimationBuilder {
166
166
  static createInstance(): ZoomInDown {
167
167
  return new ZoomInDown();
168
168
  }
169
169
 
170
- build: EntryExitAnimationBuild = () => {
170
+ build = (): EntryExitAnimationFunction => {
171
171
  const delayFunction = this.getDelayFunction();
172
172
  const [animation, config] = this.getAnimationAndConfig();
173
- const delay = this.delayV;
173
+ const delay = this.getDelay();
174
174
  const callback = this.callbackV;
175
175
 
176
176
  return () => {
@@ -192,16 +192,16 @@ export class ZoomInDown
192
192
  }
193
193
 
194
194
  export class ZoomInEasyUp
195
- extends BaseAnimationBuilder
195
+ extends ComplexAnimationBuilder
196
196
  implements IEntryExitAnimationBuilder {
197
197
  static createInstance(): ZoomInEasyUp {
198
198
  return new ZoomInEasyUp();
199
199
  }
200
200
 
201
- build: EntryExitAnimationBuild = () => {
201
+ build = (): EntryExitAnimationFunction => {
202
202
  const delayFunction = this.getDelayFunction();
203
203
  const [animation, config] = this.getAnimationAndConfig();
204
- const delay = this.delayV;
204
+ const delay = this.getDelay();
205
205
  const callback = this.callbackV;
206
206
 
207
207
  return (values) => {
@@ -223,16 +223,16 @@ export class ZoomInEasyUp
223
223
  }
224
224
 
225
225
  export class ZoomInEasyDown
226
- extends BaseAnimationBuilder
226
+ extends ComplexAnimationBuilder
227
227
  implements IEntryExitAnimationBuilder {
228
228
  static createInstance(): ZoomInEasyDown {
229
229
  return new ZoomInEasyDown();
230
230
  }
231
231
 
232
- build: EntryExitAnimationBuild = () => {
232
+ build = (): EntryExitAnimationFunction => {
233
233
  const delayFunction = this.getDelayFunction();
234
234
  const [animation, config] = this.getAnimationAndConfig();
235
- const delay = this.delayV;
235
+ const delay = this.getDelay();
236
236
  const callback = this.callbackV;
237
237
 
238
238
  return (values) => {
@@ -254,16 +254,16 @@ export class ZoomInEasyDown
254
254
  }
255
255
 
256
256
  export class ZoomOut
257
- extends BaseAnimationBuilder
257
+ extends ComplexAnimationBuilder
258
258
  implements IEntryExitAnimationBuilder {
259
259
  static createInstance(): ZoomOut {
260
260
  return new ZoomOut();
261
261
  }
262
262
 
263
- build: EntryExitAnimationBuild = () => {
263
+ build = (): EntryExitAnimationFunction => {
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 callback = this.callbackV;
268
268
 
269
269
  return () => {
@@ -282,16 +282,16 @@ export class ZoomOut
282
282
  }
283
283
 
284
284
  export class ZoomOutRotate
285
- extends BaseAnimationBuilder
285
+ extends ComplexAnimationBuilder
286
286
  implements IEntryExitAnimationBuilder {
287
287
  static createInstance(): ZoomOutRotate {
288
288
  return new ZoomOutRotate();
289
289
  }
290
290
 
291
- build: EntryExitAnimationBuild = () => {
291
+ build = (): EntryExitAnimationFunction => {
292
292
  const delayFunction = this.getDelayFunction();
293
293
  const [animation, config] = this.getAnimationAndConfig();
294
- const delay = this.delayV;
294
+ const delay = this.getDelay();
295
295
  const rotate = this.rotateV ? this.rotateV : '0.3';
296
296
  const callback = this.callbackV;
297
297
 
@@ -314,16 +314,16 @@ export class ZoomOutRotate
314
314
  }
315
315
 
316
316
  export class ZoomOutLeft
317
- extends BaseAnimationBuilder
317
+ extends ComplexAnimationBuilder
318
318
  implements IEntryExitAnimationBuilder {
319
319
  static createInstance(): ZoomOutLeft {
320
320
  return new ZoomOutLeft();
321
321
  }
322
322
 
323
- build: EntryExitAnimationBuild = () => {
323
+ build = (): EntryExitAnimationFunction => {
324
324
  const delayFunction = this.getDelayFunction();
325
325
  const [animation, config] = this.getAnimationAndConfig();
326
- const delay = this.delayV;
326
+ const delay = this.getDelay();
327
327
  const callback = this.callbackV;
328
328
 
329
329
  return () => {
@@ -345,16 +345,16 @@ export class ZoomOutLeft
345
345
  }
346
346
 
347
347
  export class ZoomOutRight
348
- extends BaseAnimationBuilder
348
+ extends ComplexAnimationBuilder
349
349
  implements IEntryExitAnimationBuilder {
350
350
  static createInstance(): ZoomOutRight {
351
351
  return new ZoomOutRight();
352
352
  }
353
353
 
354
- build: EntryExitAnimationBuild = () => {
354
+ build = (): EntryExitAnimationFunction => {
355
355
  const delayFunction = this.getDelayFunction();
356
356
  const [animation, config] = this.getAnimationAndConfig();
357
- const delay = this.delayV;
357
+ const delay = this.getDelay();
358
358
  const callback = this.callbackV;
359
359
 
360
360
  return () => {
@@ -376,16 +376,16 @@ export class ZoomOutRight
376
376
  }
377
377
 
378
378
  export class ZoomOutUp
379
- extends BaseAnimationBuilder
379
+ extends ComplexAnimationBuilder
380
380
  implements IEntryExitAnimationBuilder {
381
381
  static createInstance(): ZoomOutUp {
382
382
  return new ZoomOutUp();
383
383
  }
384
384
 
385
- build: EntryExitAnimationBuild = () => {
385
+ build = (): EntryExitAnimationFunction => {
386
386
  const delayFunction = this.getDelayFunction();
387
387
  const [animation, config] = this.getAnimationAndConfig();
388
- const delay = this.delayV;
388
+ const delay = this.getDelay();
389
389
  const callback = this.callbackV;
390
390
 
391
391
  return () => {
@@ -407,16 +407,16 @@ export class ZoomOutUp
407
407
  }
408
408
 
409
409
  export class ZoomOutDown
410
- extends BaseAnimationBuilder
410
+ extends ComplexAnimationBuilder
411
411
  implements IEntryExitAnimationBuilder {
412
412
  static createInstance(): ZoomOutDown {
413
413
  return new ZoomOutDown();
414
414
  }
415
415
 
416
- build: EntryExitAnimationBuild = () => {
416
+ build = (): EntryExitAnimationFunction => {
417
417
  const delayFunction = this.getDelayFunction();
418
418
  const [animation, config] = this.getAnimationAndConfig();
419
- const delay = this.delayV;
419
+ const delay = this.getDelay();
420
420
  const callback = this.callbackV;
421
421
 
422
422
  return () => {
@@ -438,16 +438,16 @@ export class ZoomOutDown
438
438
  }
439
439
 
440
440
  export class ZoomOutEasyUp
441
- extends BaseAnimationBuilder
441
+ extends ComplexAnimationBuilder
442
442
  implements IEntryExitAnimationBuilder {
443
443
  static createInstance(): ZoomOutEasyUp {
444
444
  return new ZoomOutEasyUp();
445
445
  }
446
446
 
447
- build: EntryExitAnimationBuild = () => {
447
+ build = (): EntryExitAnimationFunction => {
448
448
  const delayFunction = this.getDelayFunction();
449
449
  const [animation, config] = this.getAnimationAndConfig();
450
- const delay = this.delayV;
450
+ const delay = this.getDelay();
451
451
  const callback = this.callbackV;
452
452
 
453
453
  return (values) => {
@@ -474,16 +474,16 @@ export class ZoomOutEasyUp
474
474
  }
475
475
 
476
476
  export class ZoomOutEasyDown
477
- extends BaseAnimationBuilder
477
+ extends ComplexAnimationBuilder
478
478
  implements IEntryExitAnimationBuilder {
479
479
  static createInstance(): ZoomOutEasyDown {
480
480
  return new ZoomOutEasyDown();
481
481
  }
482
482
 
483
- build: EntryExitAnimationBuild = () => {
483
+ build = (): EntryExitAnimationFunction => {
484
484
  const delayFunction = this.getDelayFunction();
485
485
  const [animation, config] = this.getAnimationAndConfig();
486
- const delay = this.delayV;
486
+ const delay = this.getDelay();
487
487
  const callback = this.callbackV;
488
488
 
489
489
  return (values) => {
@@ -0,0 +1,104 @@
1
+ import {
2
+ ILayoutAnimationBuilder,
3
+ LayoutAnimationFunction,
4
+ } from '../animationBuilder/commonTypes';
5
+ import { BaseAnimationBuilder } from '../animationBuilder';
6
+ import { EasingFn, Easing } from '../../Easing';
7
+ import { withTiming } from '../../animation';
8
+
9
+ export class CurvedTransition
10
+ extends BaseAnimationBuilder
11
+ implements ILayoutAnimationBuilder {
12
+ easingXV: EasingFn = Easing.in(Easing.ease);
13
+ easingYV: EasingFn = Easing.out(Easing.ease);
14
+ easingWidthV: EasingFn = Easing.in(Easing.exp);
15
+ easingHeightV: EasingFn = Easing.out(Easing.exp);
16
+ static createInstance(): CurvedTransition {
17
+ return new CurvedTransition();
18
+ }
19
+
20
+ static easingX(easing: EasingFn): CurvedTransition {
21
+ const instance = this.createInstance();
22
+ return instance.easingX(easing);
23
+ }
24
+
25
+ easingX(easing: EasingFn): CurvedTransition {
26
+ this.easingXV = easing;
27
+ return this;
28
+ }
29
+
30
+ static easingY(easing: EasingFn): CurvedTransition {
31
+ const instance = this.createInstance();
32
+ return instance.easingY(easing);
33
+ }
34
+
35
+ easingY(easing: EasingFn): CurvedTransition {
36
+ this.easingYV = easing;
37
+ return this;
38
+ }
39
+
40
+ static easingWidth(easing: EasingFn): CurvedTransition {
41
+ const instance = this.createInstance();
42
+ return instance.easingWidth(easing);
43
+ }
44
+
45
+ easingWidth(easing: EasingFn): CurvedTransition {
46
+ this.easingWidthV = easing;
47
+ return this;
48
+ }
49
+
50
+ static easingHeight(easing: EasingFn): CurvedTransition {
51
+ const instance = this.createInstance();
52
+ return instance.easingHeight(easing);
53
+ }
54
+
55
+ easingHeight(easing: EasingFn): CurvedTransition {
56
+ this.easingHeightV = easing;
57
+ return this;
58
+ }
59
+
60
+ build = (): LayoutAnimationFunction => {
61
+ const delayFunction = this.getDelayFunction();
62
+ const callback = this.callbackV;
63
+ const delay = this.getDelay();
64
+ const duration = this.durationV ?? 300;
65
+ const easing = {
66
+ easingX: this.easingXV,
67
+ easingY: this.easingYV,
68
+ easingWidth: this.easingWidthV,
69
+ easingHeight: this.easingHeightV,
70
+ };
71
+
72
+ return (values) => {
73
+ 'worklet';
74
+
75
+ return {
76
+ initialValues: {
77
+ originX: values.boriginX,
78
+ originY: values.boriginY,
79
+ width: values.bwidth,
80
+ height: values.bheight,
81
+ },
82
+ animations: {
83
+ originX: delayFunction(
84
+ delay,
85
+ withTiming(values.originX, { duration, easing: easing.easingX })
86
+ ),
87
+ originY: delayFunction(
88
+ delay,
89
+ withTiming(values.originY, { duration, easing: easing.easingY })
90
+ ),
91
+ width: delayFunction(
92
+ delay,
93
+ withTiming(values.width, { duration, easing: easing.easingWidth })
94
+ ),
95
+ height: delayFunction(
96
+ delay,
97
+ withTiming(values.height, { duration, easing: easing.easingHeight })
98
+ ),
99
+ },
100
+ callback: callback,
101
+ };
102
+ };
103
+ };
104
+ }
@@ -0,0 +1,213 @@
1
+ import {
2
+ ILayoutAnimationBuilder,
3
+ LayoutAnimationsValues,
4
+ LayoutAnimationFunction,
5
+ } from '../animationBuilder/commonTypes';
6
+ import { BaseAnimationBuilder } from '../animationBuilder';
7
+ import { AnimationObject, withSequence, withTiming } from '../../animation';
8
+ import { FadeIn, FadeOut } from '../defaultAnimations/Fade';
9
+ import { StyleProps, TransformProperty } from '../../commonTypes';
10
+
11
+ export class EntryExitTransition
12
+ extends BaseAnimationBuilder
13
+ implements ILayoutAnimationBuilder {
14
+ enteringV: BaseAnimationBuilder | typeof BaseAnimationBuilder = FadeIn;
15
+
16
+ exitingV: BaseAnimationBuilder | typeof BaseAnimationBuilder = FadeOut;
17
+
18
+ static createInstance(): EntryExitTransition {
19
+ return new EntryExitTransition();
20
+ }
21
+
22
+ static entering(
23
+ animation: BaseAnimationBuilder | typeof BaseAnimationBuilder
24
+ ): EntryExitTransition {
25
+ const instance = this.createInstance();
26
+ return instance.entering(animation);
27
+ }
28
+
29
+ entering(
30
+ animation: BaseAnimationBuilder | typeof BaseAnimationBuilder
31
+ ): EntryExitTransition {
32
+ this.enteringV = animation;
33
+ return this;
34
+ }
35
+
36
+ static exiting(
37
+ animation: BaseAnimationBuilder | typeof BaseAnimationBuilder
38
+ ): EntryExitTransition {
39
+ const instance = this.createInstance();
40
+ return instance.exiting(animation);
41
+ }
42
+
43
+ exiting(
44
+ animation: BaseAnimationBuilder | typeof BaseAnimationBuilder
45
+ ): EntryExitTransition {
46
+ this.exitingV = animation;
47
+ return this;
48
+ }
49
+
50
+ build = (): LayoutAnimationFunction => {
51
+ const delayFunction = this.getDelayFunction();
52
+ const callback = this.callbackV;
53
+ const delay = this.getDelay();
54
+ const enteringAnimation = this.enteringV.build();
55
+ const exitingAnimation = this.exitingV.build();
56
+ const exitingDuration = this.exitingV.getDuration();
57
+
58
+ return (values) => {
59
+ 'worklet';
60
+ const enteringValues = enteringAnimation(values);
61
+ const exitingValues = exitingAnimation(values);
62
+ const animations: StyleProps = {
63
+ transform: [],
64
+ };
65
+
66
+ for (const prop of Object.keys(exitingValues.animations)) {
67
+ if (prop === 'transform') {
68
+ exitingValues.animations[prop]?.forEach((value, index) => {
69
+ for (const transformProp of Object.keys(value)) {
70
+ animations.transform?.push({
71
+ [transformProp]: delayFunction(
72
+ delay,
73
+ withSequence(
74
+ value[transformProp as keyof TransformProperty],
75
+ withTiming(
76
+ exitingValues.initialValues.transform
77
+ ? exitingValues.initialValues.transform[index][
78
+ transformProp as keyof TransformProperty
79
+ ]
80
+ : 0,
81
+ { duration: 0 }
82
+ )
83
+ )
84
+ ),
85
+ } as TransformProperty);
86
+ }
87
+ });
88
+ } else {
89
+ const sequence =
90
+ enteringValues.animations[prop] !== undefined
91
+ ? [
92
+ exitingValues.animations[prop],
93
+ withTiming(enteringValues.initialValues[prop], {
94
+ duration: 0,
95
+ }),
96
+ enteringValues.animations[prop],
97
+ ]
98
+ : [
99
+ exitingValues.animations[prop],
100
+ withTiming(
101
+ Object.keys(values).includes(prop)
102
+ ? values[prop as keyof LayoutAnimationsValues]
103
+ : exitingValues.initialValues[prop],
104
+ { duration: 0 }
105
+ ),
106
+ ];
107
+
108
+ animations[prop] = delayFunction(delay, withSequence(...sequence));
109
+ }
110
+ }
111
+ for (const prop of Object.keys(enteringValues.animations)) {
112
+ if (prop === 'transform') {
113
+ enteringValues.animations[prop]?.forEach((value, index) => {
114
+ for (const transformProp of Object.keys(value)) {
115
+ animations.transform?.push({
116
+ [transformProp]: delayFunction(
117
+ delay + exitingDuration,
118
+ withSequence(
119
+ withTiming(
120
+ enteringValues.initialValues.transform
121
+ ? enteringValues.initialValues.transform[index][
122
+ transformProp as keyof TransformProperty
123
+ ]
124
+ : 0,
125
+ { duration: exitingDuration }
126
+ ),
127
+ value[transformProp as keyof TransformProperty]
128
+ )
129
+ ),
130
+ } as TransformProperty);
131
+ }
132
+ });
133
+ } else if (animations[prop] !== undefined) {
134
+ // it was already added in the previous loop
135
+ continue;
136
+ } else {
137
+ animations[prop] = delayFunction(
138
+ delay,
139
+ withSequence(
140
+ withTiming(enteringValues.initialValues[prop], { duration: 0 }),
141
+ enteringValues.animations[prop]
142
+ )
143
+ );
144
+ }
145
+ }
146
+
147
+ const mergedTransform = (
148
+ exitingValues.initialValues.transform ?? []
149
+ ).concat(
150
+ (enteringValues.animations.transform ?? []).map((value) => {
151
+ for (const transformProp of Object.keys(value)) {
152
+ const current = (value[
153
+ transformProp as keyof TransformProperty
154
+ ] as AnimationObject).current;
155
+ if (typeof current === 'string') {
156
+ if (current.includes('deg'))
157
+ return ({
158
+ [transformProp]: '0deg',
159
+ } as unknown) as TransformProperty;
160
+ else
161
+ return ({
162
+ [transformProp]: '0',
163
+ } as unknown) as TransformProperty;
164
+ } else if (transformProp.includes('translate')) {
165
+ return ({ [transformProp]: 0 } as unknown) as TransformProperty;
166
+ } else {
167
+ return ({ [transformProp]: 1 } as unknown) as TransformProperty;
168
+ }
169
+ }
170
+ return value;
171
+ })
172
+ );
173
+
174
+ return {
175
+ initialValues: {
176
+ ...exitingValues.initialValues,
177
+ originX: values.boriginX,
178
+ originY: values.boriginY,
179
+ width: values.bwidth,
180
+ height: values.bheight,
181
+ transform: mergedTransform,
182
+ },
183
+ animations: {
184
+ originX: delayFunction(
185
+ delay + exitingDuration,
186
+ withTiming(values.originX, { duration: exitingDuration })
187
+ ),
188
+ originY: delayFunction(
189
+ delay + exitingDuration,
190
+ withTiming(values.originY, { duration: exitingDuration })
191
+ ),
192
+ width: delayFunction(
193
+ delay + exitingDuration,
194
+ withTiming(values.width, { duration: exitingDuration })
195
+ ),
196
+ height: delayFunction(
197
+ delay + exitingDuration,
198
+ withTiming(values.height, { duration: exitingDuration })
199
+ ),
200
+ ...animations,
201
+ },
202
+ callback: callback,
203
+ };
204
+ };
205
+ };
206
+ }
207
+
208
+ export function combineTransition(
209
+ exiting: BaseAnimationBuilder | typeof BaseAnimationBuilder,
210
+ entering: BaseAnimationBuilder | typeof BaseAnimationBuilder
211
+ ): EntryExitTransition {
212
+ return EntryExitTransition.entering(entering).exiting(exiting);
213
+ }
@@ -0,0 +1,60 @@
1
+ import { withSequence, withTiming } from '../../animation';
2
+ import {
3
+ ILayoutAnimationBuilder,
4
+ LayoutAnimationFunction,
5
+ } from '../animationBuilder/commonTypes';
6
+ import { BaseAnimationBuilder } from '../animationBuilder';
7
+
8
+ export class FadingTransition
9
+ extends BaseAnimationBuilder
10
+ implements ILayoutAnimationBuilder {
11
+ static createInstance(): FadingTransition {
12
+ return new FadingTransition();
13
+ }
14
+
15
+ build = (): LayoutAnimationFunction => {
16
+ const delayFunction = this.getDelayFunction();
17
+ const callback = this.callbackV;
18
+ const delay = this.getDelay();
19
+ const duration = this.durationV ?? 500;
20
+
21
+ return (values) => {
22
+ 'worklet';
23
+ return {
24
+ initialValues: {
25
+ opacity: 1,
26
+ originX: values.boriginX,
27
+ originY: values.boriginY,
28
+ width: values.bwidth,
29
+ height: values.bheight,
30
+ },
31
+ animations: {
32
+ opacity: delayFunction(
33
+ delay,
34
+ withSequence(
35
+ withTiming(0, { duration: duration }),
36
+ withTiming(1, { duration: duration })
37
+ )
38
+ ),
39
+ originX: delayFunction(
40
+ delay + duration,
41
+ withTiming(values.originX, { duration: 50 })
42
+ ),
43
+ originY: delayFunction(
44
+ delay + duration,
45
+ withTiming(values.originY, { duration: 50 })
46
+ ),
47
+ width: delayFunction(
48
+ delay + duration,
49
+ withTiming(values.width, { duration: 50 })
50
+ ),
51
+ height: delayFunction(
52
+ delay + duration,
53
+ withTiming(values.height, { duration: 50 })
54
+ ),
55
+ },
56
+ callback: callback,
57
+ };
58
+ };
59
+ };
60
+ }