react-native-reanimated 2.3.0-beta.3 → 2.3.2

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 (220) hide show
  1. package/Common/cpp/NativeModules/NativeReanimatedModule.cpp +9 -0
  2. package/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +13 -0
  3. package/Common/cpp/Tools/FeaturesConfig.cpp +5 -0
  4. package/Common/cpp/Tools/RuntimeDecorator.cpp +38 -2
  5. package/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +3 -0
  6. package/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +5 -0
  7. package/Common/cpp/headers/Tools/FeaturesConfig.h +19 -0
  8. package/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +2 -0
  9. package/Common/cpp/headers/Tools/RuntimeDecorator.h +8 -7
  10. package/README.md +1 -1
  11. package/RNReanimated.podspec +20 -3
  12. package/android/build.gradle +31 -5
  13. package/android/expo/linking.gradle +46 -0
  14. package/android/expo/src/main/java/com/swmansion/reanimated/EXReanimatedAdapter.java +12 -0
  15. package/android/expo/src/main/java/expo/modules/adapters/reanimated/EXReanimatedPackage.java +26 -0
  16. package/android/react-native-reanimated-63-hermes.aar +0 -0
  17. package/android/react-native-reanimated-63-jsc.aar +0 -0
  18. package/android/react-native-reanimated-64-hermes.aar +0 -0
  19. package/android/react-native-reanimated-64-jsc.aar +0 -0
  20. package/android/react-native-reanimated-65-hermes.aar +0 -0
  21. package/android/react-native-reanimated-65-jsc.aar +0 -0
  22. package/android/react-native-reanimated-66-hermes.aar +0 -0
  23. package/android/react-native-reanimated-66-jsc.aar +0 -0
  24. package/android/react-native-reanimated-67-hermes.aar +0 -0
  25. package/android/react-native-reanimated-67-jsc.aar +0 -0
  26. package/expo-module.config.json +3 -0
  27. package/ios/LayoutReanimation/REAAnimationsManager.m +64 -19
  28. package/ios/LayoutReanimation/REAUIManager.mm +63 -18
  29. package/ios/Nodes/REAPropsNode.m +1 -1
  30. package/ios/REAEventDispatcher.m +1 -1
  31. package/ios/REAModule.h +0 -2
  32. package/ios/REAModule.m +0 -3
  33. package/ios/REANodesManager.m +1 -0
  34. package/ios/RNGestureHandlerStateManager.h +5 -0
  35. package/ios/native/NativeMethods.h +5 -0
  36. package/ios/native/NativeMethods.mm +8 -1
  37. package/ios/native/NativeProxy.h +1 -0
  38. package/ios/native/NativeProxy.mm +10 -2
  39. package/ios/native/REAInitializer.mm +7 -3
  40. package/lib/src/Animated.js +31 -0
  41. package/lib/{ConfigHelper.js → src/ConfigHelper.js} +0 -0
  42. package/lib/{ReanimatedEventEmitter.js → src/ReanimatedEventEmitter.js} +0 -0
  43. package/lib/{ReanimatedModule.js → src/ReanimatedModule.js} +0 -0
  44. package/lib/{ReanimatedModule.macos.js → src/ReanimatedModule.macos.js} +0 -0
  45. package/lib/{ReanimatedModule.native.js → src/ReanimatedModule.native.js} +0 -0
  46. package/lib/{ReanimatedModule.windows.js → src/ReanimatedModule.windows.js} +0 -0
  47. package/lib/{ReanimatedModuleCompat.js → src/ReanimatedModuleCompat.js} +0 -0
  48. package/lib/{__mocks__ → src/__mocks__}/ReanimatedEventEmitter.js +0 -0
  49. package/lib/{__mocks__ → src/__mocks__}/ReanimatedModule.native.js +0 -0
  50. package/lib/{createAnimatedComponent.js → src/createAnimatedComponent.js} +55 -37
  51. package/lib/src/index.js +31 -0
  52. package/lib/{reanimated1 → src/reanimated1}/Easing.js +0 -0
  53. package/lib/{reanimated1 → src/reanimated1}/SpringConfig.js +0 -0
  54. package/lib/{reanimated1 → src/reanimated1}/Transitioning.js +0 -0
  55. package/lib/{reanimated1 → src/reanimated1}/animations/Animation.js +0 -0
  56. package/lib/{reanimated1 → src/reanimated1}/animations/SpringUtils.js +0 -0
  57. package/lib/{reanimated1 → src/reanimated1}/animations/backwardCompatibleAnimWrapper.js +0 -0
  58. package/lib/{reanimated1 → src/reanimated1}/animations/decay.js +0 -0
  59. package/lib/{reanimated1 → src/reanimated1}/animations/spring.js +0 -0
  60. package/lib/{reanimated1 → src/reanimated1}/animations/timing.js +0 -0
  61. package/lib/{reanimated1 → src/reanimated1}/base.js +0 -0
  62. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedAlways.js +0 -0
  63. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedBezier.js +0 -0
  64. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedBlock.js +0 -0
  65. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCall.js +0 -0
  66. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCallFunc.js +0 -0
  67. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedClock.js +0 -0
  68. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedClockTest.js +0 -0
  69. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCode.js +0 -0
  70. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedConcat.js +0 -0
  71. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCond.js +0 -0
  72. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedDebug.js +0 -0
  73. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedEvent.js +0 -0
  74. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedFunction.js +0 -0
  75. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedNode.js +0 -0
  76. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedOperator.js +0 -0
  77. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedParam.js +0 -0
  78. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedProps.js +0 -0
  79. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedSet.js +0 -0
  80. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedStartClock.js +0 -0
  81. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedStopClock.js +0 -0
  82. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedStyle.js +0 -0
  83. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedTransform.js +0 -0
  84. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedValue.js +0 -0
  85. package/lib/{reanimated1 → src/reanimated1}/core/Core.test.js +1 -1
  86. package/lib/{reanimated1 → src/reanimated1}/core/InternalAnimatedValue.js +0 -0
  87. package/lib/{reanimated1 → src/reanimated1}/core/__mocks__/AnimatedProps.js +0 -0
  88. package/lib/{reanimated1 → src/reanimated1}/core/createEventObjectProxyPolyfill.js +0 -0
  89. package/lib/{reanimated1 → src/reanimated1}/derived/__mocks__/evaluateOnce.js +0 -0
  90. package/lib/{reanimated1 → src/reanimated1}/derived/acc.js +0 -0
  91. package/lib/{reanimated1 → src/reanimated1}/derived/color.js +0 -0
  92. package/lib/{reanimated1 → src/reanimated1}/derived/diff.js +0 -0
  93. package/lib/{reanimated1 → src/reanimated1}/derived/diffClamp.js +0 -0
  94. package/lib/{reanimated1 → src/reanimated1}/derived/evaluateOnce.js +0 -0
  95. package/lib/{reanimated1 → src/reanimated1}/derived/index.js +0 -0
  96. package/lib/{reanimated1 → src/reanimated1}/derived/interpolate.js +0 -0
  97. package/lib/{reanimated1 → src/reanimated1}/derived/interpolateColors.js +0 -0
  98. package/lib/{reanimated1 → src/reanimated1}/derived/onChange.js +0 -0
  99. package/lib/{reanimated1 → src/reanimated1}/derived/useCode.js +0 -0
  100. package/lib/{reanimated1 → src/reanimated1}/index.js +0 -0
  101. package/lib/{reanimated1 → src/reanimated1}/operators.js +0 -0
  102. package/lib/{reanimated1 → src/reanimated1}/useValue.js +0 -0
  103. package/lib/{reanimated1 → src/reanimated1}/val.js +0 -0
  104. package/lib/{reanimated2 → src/reanimated2}/Bezier.js +0 -0
  105. package/lib/{reanimated2 → src/reanimated2}/Colors.js +0 -0
  106. package/lib/{reanimated2 → src/reanimated2}/Easing.js +0 -0
  107. package/lib/{reanimated2 → src/reanimated2}/NativeMethods.js +7 -0
  108. package/lib/{reanimated2 → src/reanimated2}/NativeReanimated/NativeReanimated.js +3 -0
  109. package/lib/{reanimated2 → src/reanimated2}/NativeReanimated/index.js +0 -0
  110. package/lib/{reanimated2 → src/reanimated2}/PlatformChecker.js +0 -0
  111. package/lib/{reanimated2 → src/reanimated2}/PropAdapters.js +0 -0
  112. package/lib/{reanimated2 → src/reanimated2}/UpdateProps.js +1 -1
  113. package/lib/{reanimated2 → src/reanimated2}/ViewDescriptorsSet.js +4 -2
  114. package/lib/{reanimated2 → src/reanimated2}/WorkletEventHandler.js +0 -0
  115. package/lib/{reanimated2 → src/reanimated2}/__mocks__/MutableValue.js +0 -0
  116. package/lib/{reanimated2 → src/reanimated2}/__mocks__/NativeReanimated.js +0 -0
  117. package/lib/{reanimated2 → src/reanimated2}/__mocks__/NativeReanimated.native.js +0 -0
  118. package/lib/{reanimated2 → src/reanimated2}/animation/commonTypes.js +0 -0
  119. package/lib/{reanimated2 → src/reanimated2}/animation/decay.js +0 -0
  120. package/lib/{reanimated2 → src/reanimated2}/animation/delay.js +0 -0
  121. package/lib/{reanimated2 → src/reanimated2}/animation/index.js +0 -0
  122. package/lib/{reanimated2 → src/reanimated2}/animation/repeat.js +0 -0
  123. package/lib/{reanimated2 → src/reanimated2}/animation/sequence.js +0 -0
  124. package/lib/{reanimated2 → src/reanimated2}/animation/spring.js +0 -0
  125. package/lib/{reanimated2 → src/reanimated2}/animation/styleAnimation.js +5 -0
  126. package/lib/{reanimated2 → src/reanimated2}/animation/timing.js +0 -0
  127. package/lib/{reanimated2 → src/reanimated2}/animation/util.js +0 -0
  128. package/lib/{reanimated2 → src/reanimated2}/commonTypes.js +0 -0
  129. package/lib/src/reanimated2/component/FlatList.js +30 -0
  130. package/lib/src/reanimated2/component/WrappedComponents.js +9 -0
  131. package/lib/src/reanimated2/component/index.js +4 -0
  132. package/lib/{reanimated2 → src/reanimated2}/core.js +27 -3
  133. package/lib/{reanimated2 → src/reanimated2}/globals.d.ts +5 -0
  134. package/lib/{reanimated2 → src/reanimated2}/hook/Hooks.js +0 -0
  135. package/lib/{reanimated2 → src/reanimated2}/hook/commonTypes.js +0 -0
  136. package/lib/{reanimated2 → src/reanimated2}/hook/index.js +0 -0
  137. package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedGestureHandler.js +0 -0
  138. package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedReaction.js +0 -0
  139. package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedRef.js +0 -0
  140. package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedScrollHandler.js +0 -0
  141. package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedStyle.js +0 -0
  142. package/lib/{reanimated2 → src/reanimated2}/hook/useDerivedValue.js +0 -0
  143. package/lib/{reanimated2 → src/reanimated2}/hook/useSharedValue.js +0 -0
  144. package/lib/{reanimated2 → src/reanimated2}/hook/utils.js +0 -0
  145. package/lib/{reanimated2 → src/reanimated2}/index.js +0 -0
  146. package/lib/{reanimated2 → src/reanimated2}/interpolation.js +0 -0
  147. package/lib/{reanimated2 → src/reanimated2}/jestUtils.js +0 -0
  148. package/lib/{reanimated2 → src/reanimated2}/js-reanimated/JSReanimated.js +3 -0
  149. package/lib/{reanimated2 → src/reanimated2}/js-reanimated/Mapper.js +4 -1
  150. package/lib/{reanimated2 → src/reanimated2}/js-reanimated/MapperRegistry.js +0 -0
  151. package/lib/{reanimated2 → src/reanimated2}/js-reanimated/MutableValue.js +0 -0
  152. package/lib/{reanimated2 → src/reanimated2}/js-reanimated/index.js +3 -0
  153. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/LayoutAnimationRepository.js +14 -5
  154. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +0 -0
  155. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +0 -0
  156. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/Keyframe.js +0 -0
  157. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/commonTypes.js +0 -0
  158. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/index.js +0 -0
  159. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Bounce.js +0 -0
  160. package/lib/src/reanimated2/layoutReanimation/defaultAnimations/Default.js +36 -0
  161. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Fade.js +0 -0
  162. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Flip.js +8 -8
  163. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.js +0 -0
  164. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.js +0 -0
  165. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Roll.js +0 -0
  166. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Rotate.js +16 -16
  167. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Slide.js +16 -16
  168. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Stretch.js +0 -0
  169. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Zoom.js +4 -4
  170. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/index.js +0 -0
  171. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.js +20 -8
  172. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.js +3 -3
  173. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.js +8 -8
  174. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.js +10 -10
  175. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.js +8 -8
  176. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.js +8 -8
  177. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/index.js +0 -0
  178. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/index.js +0 -0
  179. package/lib/{reanimated2 → src/reanimated2}/mock.js +0 -0
  180. package/lib/{reanimated2 → src/reanimated2}/platform-specific/RNRenderer.js +0 -0
  181. package/lib/{reanimated2 → src/reanimated2}/platform-specific/RNRenderer.web.js +0 -0
  182. package/lib/{reanimated2 → src/reanimated2}/utils.js +0 -0
  183. package/lib/{setAndForwardRef.js → src/setAndForwardRef.js} +0 -0
  184. package/mock.js +1 -1
  185. package/package.json +4 -3
  186. package/plugin.js +10 -3
  187. package/react-native-reanimated.d.ts +40 -23
  188. package/src/Animated.js +11 -5
  189. package/src/createAnimatedComponent.tsx +86 -43
  190. package/src/reanimated1/core/Core.test.js +1 -1
  191. package/src/reanimated2/NativeMethods.ts +13 -1
  192. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +4 -0
  193. package/src/reanimated2/UpdateProps.ts +1 -1
  194. package/src/reanimated2/ViewDescriptorsSet.ts +6 -2
  195. package/src/reanimated2/animation/styleAnimation.ts +9 -0
  196. package/src/reanimated2/component/FlatList.tsx +44 -0
  197. package/src/reanimated2/component/WrappedComponents.ts +11 -0
  198. package/src/reanimated2/component/index.ts +9 -0
  199. package/src/reanimated2/core.ts +38 -3
  200. package/src/reanimated2/globals.d.ts +5 -0
  201. package/src/reanimated2/js-reanimated/JSReanimated.ts +6 -0
  202. package/src/reanimated2/js-reanimated/Mapper.ts +3 -1
  203. package/src/reanimated2/js-reanimated/index.ts +5 -0
  204. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +18 -5
  205. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +39 -20
  206. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +5 -1
  207. package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +21 -15
  208. package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +29 -24
  209. package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +61 -34
  210. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +49 -34
  211. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +17 -12
  212. package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +20 -8
  213. package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +9 -9
  214. package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +8 -8
  215. package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +20 -14
  216. package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +14 -8
  217. package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +24 -12
  218. package/lib/Animated.js +0 -25
  219. package/lib/index.js +0 -25
  220. package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -36
@@ -1,6 +1,9 @@
1
1
  import {
2
- IEntryExitAnimationBuilder,
3
- EntryExitAnimationFunction,
2
+ EntryAnimationsValues,
3
+ ExitAnimationsValues,
4
+ AnimationConfigFunction,
5
+ IEntryAnimationBuilder,
6
+ IExitAnimationBuilder,
4
7
  } from '../animationBuilder/commonTypes';
5
8
  import { Dimensions } from 'react-native';
6
9
  import { ComplexAnimationBuilder } from '../animationBuilder';
@@ -9,12 +12,12 @@ const { width, height } = Dimensions.get('window');
9
12
 
10
13
  export class SlideInRight
11
14
  extends ComplexAnimationBuilder
12
- implements IEntryExitAnimationBuilder {
15
+ implements IEntryAnimationBuilder {
13
16
  static createInstance(): SlideInRight {
14
17
  return new SlideInRight();
15
18
  }
16
19
 
17
- build = (): EntryExitAnimationFunction => {
20
+ build = (): AnimationConfigFunction<EntryAnimationsValues> => {
18
21
  const delayFunction = this.getDelayFunction();
19
22
  const [animation, config] = this.getAnimationAndConfig();
20
23
  const delay = this.getDelay();
@@ -24,10 +27,13 @@ export class SlideInRight
24
27
  'worklet';
25
28
  return {
26
29
  animations: {
27
- originX: delayFunction(delay, animation(values.originX, config)),
30
+ originX: delayFunction(
31
+ delay,
32
+ animation(values.targetOriginX, config)
33
+ ),
28
34
  },
29
35
  initialValues: {
30
- originX: values.originX + width,
36
+ originX: values.targetOriginX + width,
31
37
  },
32
38
  callback: callback,
33
39
  };
@@ -37,12 +43,12 @@ export class SlideInRight
37
43
 
38
44
  export class SlideInLeft
39
45
  extends ComplexAnimationBuilder
40
- implements IEntryExitAnimationBuilder {
46
+ implements IEntryAnimationBuilder {
41
47
  static createInstance(): SlideInLeft {
42
48
  return new SlideInLeft();
43
49
  }
44
50
 
45
- build = (): EntryExitAnimationFunction => {
51
+ build = (): AnimationConfigFunction<EntryAnimationsValues> => {
46
52
  const delayFunction = this.getDelayFunction();
47
53
  const [animation, config] = this.getAnimationAndConfig();
48
54
  const delay = this.getDelay();
@@ -52,10 +58,13 @@ export class SlideInLeft
52
58
  'worklet';
53
59
  return {
54
60
  animations: {
55
- originX: delayFunction(delay, animation(values.originX, config)),
61
+ originX: delayFunction(
62
+ delay,
63
+ animation(values.targetOriginX, config)
64
+ ),
56
65
  },
57
66
  initialValues: {
58
- originX: values.originX - width,
67
+ originX: values.targetOriginX - width,
59
68
  },
60
69
  callback: callback,
61
70
  };
@@ -65,12 +74,12 @@ export class SlideInLeft
65
74
 
66
75
  export class SlideOutRight
67
76
  extends ComplexAnimationBuilder
68
- implements IEntryExitAnimationBuilder {
77
+ implements IExitAnimationBuilder {
69
78
  static createInstance(): SlideOutRight {
70
79
  return new SlideOutRight();
71
80
  }
72
81
 
73
- build = (): EntryExitAnimationFunction => {
82
+ build = (): AnimationConfigFunction<ExitAnimationsValues> => {
74
83
  const delayFunction = this.getDelayFunction();
75
84
  const [animation, config] = this.getAnimationAndConfig();
76
85
  const delay = this.getDelay();
@@ -82,11 +91,11 @@ export class SlideOutRight
82
91
  animations: {
83
92
  originX: delayFunction(
84
93
  delay,
85
- animation(Math.max(values.originX + width, width), config)
94
+ animation(Math.max(values.currentOriginX + width, width), config)
86
95
  ),
87
96
  },
88
97
  initialValues: {
89
- originX: values.originX,
98
+ originX: values.currentOriginX,
90
99
  },
91
100
  callback: callback,
92
101
  };
@@ -96,12 +105,12 @@ export class SlideOutRight
96
105
 
97
106
  export class SlideOutLeft
98
107
  extends ComplexAnimationBuilder
99
- implements IEntryExitAnimationBuilder {
108
+ implements IExitAnimationBuilder {
100
109
  static createInstance(): SlideOutLeft {
101
110
  return new SlideOutLeft();
102
111
  }
103
112
 
104
- build = (): EntryExitAnimationFunction => {
113
+ build = (): AnimationConfigFunction<ExitAnimationsValues> => {
105
114
  const delayFunction = this.getDelayFunction();
106
115
  const [animation, config] = this.getAnimationAndConfig();
107
116
  const delay = this.getDelay();
@@ -113,11 +122,11 @@ export class SlideOutLeft
113
122
  animations: {
114
123
  originX: delayFunction(
115
124
  delay,
116
- animation(Math.min(values.originX - width, -width), config)
125
+ animation(Math.min(values.currentOriginX - width, -width), config)
117
126
  ),
118
127
  },
119
128
  initialValues: {
120
- originX: values.originX,
129
+ originX: values.currentOriginX,
121
130
  },
122
131
  callback: callback,
123
132
  };
@@ -127,12 +136,12 @@ export class SlideOutLeft
127
136
 
128
137
  export class SlideInUp
129
138
  extends ComplexAnimationBuilder
130
- implements IEntryExitAnimationBuilder {
139
+ implements IEntryAnimationBuilder {
131
140
  static createInstance(): SlideInUp {
132
141
  return new SlideInUp();
133
142
  }
134
143
 
135
- build = (): EntryExitAnimationFunction => {
144
+ build = (): AnimationConfigFunction<EntryAnimationsValues> => {
136
145
  const delayFunction = this.getDelayFunction();
137
146
  const [animation, config] = this.getAnimationAndConfig();
138
147
  const delay = this.getDelay();
@@ -142,10 +151,13 @@ export class SlideInUp
142
151
  'worklet';
143
152
  return {
144
153
  animations: {
145
- originY: delayFunction(delay, animation(values.originY, config)),
154
+ originY: delayFunction(
155
+ delay,
156
+ animation(values.targetOriginY, config)
157
+ ),
146
158
  },
147
159
  initialValues: {
148
- originY: height,
160
+ originY: -height,
149
161
  },
150
162
  callback: callback,
151
163
  };
@@ -155,12 +167,12 @@ export class SlideInUp
155
167
 
156
168
  export class SlideInDown
157
169
  extends ComplexAnimationBuilder
158
- implements IEntryExitAnimationBuilder {
170
+ implements IEntryAnimationBuilder {
159
171
  static createInstance(): SlideInDown {
160
172
  return new SlideInDown();
161
173
  }
162
174
 
163
- build = (): EntryExitAnimationFunction => {
175
+ build = (): AnimationConfigFunction<EntryAnimationsValues> => {
164
176
  const delayFunction = this.getDelayFunction();
165
177
  const [animation, config] = this.getAnimationAndConfig();
166
178
  const delay = this.getDelay();
@@ -170,10 +182,13 @@ export class SlideInDown
170
182
  'worklet';
171
183
  return {
172
184
  animations: {
173
- originY: delayFunction(delay, animation(values.originY, config)),
185
+ originY: delayFunction(
186
+ delay,
187
+ animation(values.targetOriginY, config)
188
+ ),
174
189
  },
175
190
  initialValues: {
176
- originY: values.originY + height,
191
+ originY: values.targetOriginY + height,
177
192
  },
178
193
  callback: callback,
179
194
  };
@@ -183,12 +198,12 @@ export class SlideInDown
183
198
 
184
199
  export class SlideOutUp
185
200
  extends ComplexAnimationBuilder
186
- implements IEntryExitAnimationBuilder {
201
+ implements IExitAnimationBuilder {
187
202
  static createInstance(): SlideOutUp {
188
203
  return new SlideOutUp();
189
204
  }
190
205
 
191
- build = (): EntryExitAnimationFunction => {
206
+ build = (): AnimationConfigFunction<ExitAnimationsValues> => {
192
207
  const delayFunction = this.getDelayFunction();
193
208
  const [animation, config] = this.getAnimationAndConfig();
194
209
  const delay = this.getDelay();
@@ -200,10 +215,10 @@ export class SlideOutUp
200
215
  animations: {
201
216
  originY: delayFunction(
202
217
  delay,
203
- animation(Math.min(values.originY - height, -height), config)
218
+ animation(Math.min(values.currentOriginY - height, -height), config)
204
219
  ),
205
220
  },
206
- initialValues: { originY: values.originY },
221
+ initialValues: { originY: values.currentOriginY },
207
222
  callback: callback,
208
223
  };
209
224
  };
@@ -212,12 +227,12 @@ export class SlideOutUp
212
227
 
213
228
  export class SlideOutDown
214
229
  extends ComplexAnimationBuilder
215
- implements IEntryExitAnimationBuilder {
230
+ implements IExitAnimationBuilder {
216
231
  static createInstance(): SlideOutDown {
217
232
  return new SlideOutDown();
218
233
  }
219
234
 
220
- build = (): EntryExitAnimationFunction => {
235
+ build = (): AnimationConfigFunction<ExitAnimationsValues> => {
221
236
  const delayFunction = this.getDelayFunction();
222
237
  const [animation, config] = this.getAnimationAndConfig();
223
238
  const delay = this.getDelay();
@@ -229,10 +244,10 @@ export class SlideOutDown
229
244
  animations: {
230
245
  originY: delayFunction(
231
246
  delay,
232
- animation(Math.max(values.originY + height, height), config)
247
+ animation(Math.max(values.currentOriginY + height, height), config)
233
248
  ),
234
249
  },
235
- initialValues: { originY: values.originY },
250
+ initialValues: { originY: values.currentOriginY },
236
251
  callback: callback,
237
252
  };
238
253
  };
@@ -1,6 +1,11 @@
1
1
  import {
2
2
  IEntryExitAnimationBuilder,
3
3
  EntryExitAnimationFunction,
4
+ EntryAnimationsValues,
5
+ ExitAnimationsValues,
6
+ AnimationConfigFunction,
7
+ IEntryAnimationBuilder,
8
+ IExitAnimationBuilder,
4
9
  } from '../animationBuilder/commonTypes';
5
10
  import { Dimensions } from 'react-native';
6
11
  import { ComplexAnimationBuilder } from '../animationBuilder';
@@ -193,12 +198,12 @@ export class ZoomInDown
193
198
 
194
199
  export class ZoomInEasyUp
195
200
  extends ComplexAnimationBuilder
196
- implements IEntryExitAnimationBuilder {
201
+ implements IEntryAnimationBuilder {
197
202
  static createInstance(): ZoomInEasyUp {
198
203
  return new ZoomInEasyUp();
199
204
  }
200
205
 
201
- build = (): EntryExitAnimationFunction => {
206
+ build = (): AnimationConfigFunction<EntryAnimationsValues> => {
202
207
  const delayFunction = this.getDelayFunction();
203
208
  const [animation, config] = this.getAnimationAndConfig();
204
209
  const delay = this.getDelay();
@@ -214,7 +219,7 @@ export class ZoomInEasyUp
214
219
  ],
215
220
  },
216
221
  initialValues: {
217
- transform: [{ translateY: -values.height }, { scale: 0 }],
222
+ transform: [{ translateY: -values.targetHeight }, { scale: 0 }],
218
223
  },
219
224
  callback: callback,
220
225
  };
@@ -224,12 +229,12 @@ export class ZoomInEasyUp
224
229
 
225
230
  export class ZoomInEasyDown
226
231
  extends ComplexAnimationBuilder
227
- implements IEntryExitAnimationBuilder {
232
+ implements IEntryAnimationBuilder {
228
233
  static createInstance(): ZoomInEasyDown {
229
234
  return new ZoomInEasyDown();
230
235
  }
231
236
 
232
- build = (): EntryExitAnimationFunction => {
237
+ build = (): AnimationConfigFunction<EntryAnimationsValues> => {
233
238
  const delayFunction = this.getDelayFunction();
234
239
  const [animation, config] = this.getAnimationAndConfig();
235
240
  const delay = this.getDelay();
@@ -245,7 +250,7 @@ export class ZoomInEasyDown
245
250
  ],
246
251
  },
247
252
  initialValues: {
248
- transform: [{ translateY: values.height }, { scale: 0 }],
253
+ transform: [{ translateY: values.targetHeight }, { scale: 0 }],
249
254
  },
250
255
  callback: callback,
251
256
  };
@@ -439,12 +444,12 @@ export class ZoomOutDown
439
444
 
440
445
  export class ZoomOutEasyUp
441
446
  extends ComplexAnimationBuilder
442
- implements IEntryExitAnimationBuilder {
447
+ implements IExitAnimationBuilder {
443
448
  static createInstance(): ZoomOutEasyUp {
444
449
  return new ZoomOutEasyUp();
445
450
  }
446
451
 
447
- build = (): EntryExitAnimationFunction => {
452
+ build = (): AnimationConfigFunction<ExitAnimationsValues> => {
448
453
  const delayFunction = this.getDelayFunction();
449
454
  const [animation, config] = this.getAnimationAndConfig();
450
455
  const delay = this.getDelay();
@@ -458,7 +463,7 @@ export class ZoomOutEasyUp
458
463
  {
459
464
  translateY: delayFunction(
460
465
  delay,
461
- animation(-values.height, config)
466
+ animation(-values.currentHeight, config)
462
467
  ),
463
468
  },
464
469
  { scale: delayFunction(delay, animation(0, config)) },
@@ -475,12 +480,12 @@ export class ZoomOutEasyUp
475
480
 
476
481
  export class ZoomOutEasyDown
477
482
  extends ComplexAnimationBuilder
478
- implements IEntryExitAnimationBuilder {
483
+ implements IExitAnimationBuilder {
479
484
  static createInstance(): ZoomOutEasyDown {
480
485
  return new ZoomOutEasyDown();
481
486
  }
482
487
 
483
- build = (): EntryExitAnimationFunction => {
488
+ build = (): AnimationConfigFunction<ExitAnimationsValues> => {
484
489
  const delayFunction = this.getDelayFunction();
485
490
  const [animation, config] = this.getAnimationAndConfig();
486
491
  const delay = this.getDelay();
@@ -494,7 +499,7 @@ export class ZoomOutEasyDown
494
499
  {
495
500
  translateY: delayFunction(
496
501
  delay,
497
- animation(values.height, config)
502
+ animation(values.currentHeight, config)
498
503
  ),
499
504
  },
500
505
  { scale: delayFunction(delay, animation(0, config)) },
@@ -74,27 +74,39 @@ export class CurvedTransition
74
74
 
75
75
  return {
76
76
  initialValues: {
77
- originX: values.boriginX,
78
- originY: values.boriginY,
79
- width: values.bwidth,
80
- height: values.bheight,
77
+ originX: values.currentOriginX,
78
+ originY: values.currentOriginY,
79
+ width: values.currentWidth,
80
+ height: values.currentHeight,
81
81
  },
82
82
  animations: {
83
83
  originX: delayFunction(
84
84
  delay,
85
- withTiming(values.originX, { duration, easing: easing.easingX })
85
+ withTiming(values.targetOriginX, {
86
+ duration,
87
+ easing: easing.easingX,
88
+ })
86
89
  ),
87
90
  originY: delayFunction(
88
91
  delay,
89
- withTiming(values.originY, { duration, easing: easing.easingY })
92
+ withTiming(values.targetOriginY, {
93
+ duration,
94
+ easing: easing.easingY,
95
+ })
90
96
  ),
91
97
  width: delayFunction(
92
98
  delay,
93
- withTiming(values.width, { duration, easing: easing.easingWidth })
99
+ withTiming(values.targetWidth, {
100
+ duration,
101
+ easing: easing.easingWidth,
102
+ })
94
103
  ),
95
104
  height: delayFunction(
96
105
  delay,
97
- withTiming(values.height, { duration, easing: easing.easingHeight })
106
+ withTiming(values.targetHeight, {
107
+ duration,
108
+ easing: easing.easingHeight,
109
+ })
98
110
  ),
99
111
  },
100
112
  callback: callback,
@@ -122,7 +122,7 @@ export class EntryExitTransition
122
122
  transformProp as keyof TransformProperty
123
123
  ]
124
124
  : 0,
125
- { duration: 0 }
125
+ { duration: exitingDuration }
126
126
  ),
127
127
  value[transformProp as keyof TransformProperty]
128
128
  )
@@ -174,28 +174,28 @@ export class EntryExitTransition
174
174
  return {
175
175
  initialValues: {
176
176
  ...exitingValues.initialValues,
177
- originX: values.boriginX,
178
- originY: values.boriginY,
179
- width: values.bwidth,
180
- height: values.bheight,
177
+ originX: values.currentOriginX,
178
+ originY: values.currentOriginY,
179
+ width: values.currentWidth,
180
+ height: values.currentHeight,
181
181
  transform: mergedTransform,
182
182
  },
183
183
  animations: {
184
184
  originX: delayFunction(
185
185
  delay + exitingDuration,
186
- withTiming(values.originX, { duration: 0 })
186
+ withTiming(values.targetOriginX, { duration: exitingDuration })
187
187
  ),
188
188
  originY: delayFunction(
189
189
  delay + exitingDuration,
190
- withTiming(values.originY, { duration: 0 })
190
+ withTiming(values.targetOriginY, { duration: exitingDuration })
191
191
  ),
192
192
  width: delayFunction(
193
193
  delay + exitingDuration,
194
- withTiming(values.width, { duration: 0 })
194
+ withTiming(values.targetWidth, { duration: exitingDuration })
195
195
  ),
196
196
  height: delayFunction(
197
197
  delay + exitingDuration,
198
- withTiming(values.height, { duration: 0 })
198
+ withTiming(values.targetHeight, { duration: exitingDuration })
199
199
  ),
200
200
  ...animations,
201
201
  },
@@ -23,10 +23,10 @@ export class FadingTransition
23
23
  return {
24
24
  initialValues: {
25
25
  opacity: 1,
26
- originX: values.boriginX,
27
- originY: values.boriginY,
28
- width: values.bwidth,
29
- height: values.bheight,
26
+ originX: values.currentOriginX,
27
+ originY: values.currentOriginY,
28
+ width: values.currentWidth,
29
+ height: values.currentHeight,
30
30
  },
31
31
  animations: {
32
32
  opacity: delayFunction(
@@ -38,19 +38,19 @@ export class FadingTransition
38
38
  ),
39
39
  originX: delayFunction(
40
40
  delay + duration,
41
- withTiming(values.originX, { duration: 50 })
41
+ withTiming(values.targetOriginX, { duration: 50 })
42
42
  ),
43
43
  originY: delayFunction(
44
44
  delay + duration,
45
- withTiming(values.originY, { duration: 50 })
45
+ withTiming(values.targetOriginY, { duration: 50 })
46
46
  ),
47
47
  width: delayFunction(
48
48
  delay + duration,
49
- withTiming(values.width, { duration: 50 })
49
+ withTiming(values.targetWidth, { duration: 50 })
50
50
  ),
51
51
  height: delayFunction(
52
52
  delay + duration,
53
- withTiming(values.height, { duration: 50 })
53
+ withTiming(values.targetHeight, { duration: 50 })
54
54
  ),
55
55
  },
56
56
  callback: callback,
@@ -22,34 +22,40 @@ export class JumpingTransition
22
22
  return (values) => {
23
23
  'worklet';
24
24
  const d = Math.max(
25
- Math.abs(values.originX - values.boriginX),
26
- Math.abs(values.originY - values.boriginY)
25
+ Math.abs(values.targetOriginX - values.currentOriginX),
26
+ Math.abs(values.targetOriginY - values.currentOriginY)
27
27
  );
28
28
  return {
29
29
  initialValues: {
30
- originX: values.boriginX,
31
- originY: values.boriginY,
32
- width: values.bwidth,
33
- height: values.bheight,
30
+ originX: values.currentOriginX,
31
+ originY: values.currentOriginY,
32
+ width: values.currentWidth,
33
+ height: values.currentHeight,
34
34
  },
35
35
  animations: {
36
- originX: delayFunction(delay, withTiming(values.originX, config)),
36
+ originX: delayFunction(
37
+ delay,
38
+ withTiming(values.targetOriginX, config)
39
+ ),
37
40
  originY: delayFunction(
38
41
  delay,
39
42
  withSequence(
40
- withTiming(Math.min(values.originY, values.boriginY) - d, {
41
- duration,
42
- easing: Easing.out(Easing.exp),
43
- }),
44
- withTiming(values.originY, {
43
+ withTiming(
44
+ Math.min(values.targetOriginY, values.currentOriginY) - d,
45
+ {
46
+ duration,
47
+ easing: Easing.out(Easing.exp),
48
+ }
49
+ ),
50
+ withTiming(values.targetOriginY, {
45
51
  ...config,
46
52
  duration,
47
53
  easing: Easing.bounce,
48
54
  })
49
55
  )
50
56
  ),
51
- width: delayFunction(delay, withTiming(values.width, config)),
52
- height: delayFunction(delay, withTiming(values.height, config)),
57
+ width: delayFunction(delay, withTiming(values.targetWidth, config)),
58
+ height: delayFunction(delay, withTiming(values.targetHeight, config)),
53
59
  },
54
60
  callback: callback,
55
61
  };
@@ -21,16 +21,22 @@ export class LinearTransition
21
21
  'worklet';
22
22
  return {
23
23
  initialValues: {
24
- originX: values.boriginX,
25
- originY: values.boriginY,
26
- width: values.bwidth,
27
- height: values.bheight,
24
+ originX: values.currentOriginX,
25
+ originY: values.currentOriginY,
26
+ width: values.currentWidth,
27
+ height: values.currentHeight,
28
28
  },
29
29
  animations: {
30
- originX: delayFunction(delay, animation(values.originX, config)),
31
- originY: delayFunction(delay, animation(values.originY, config)),
32
- width: delayFunction(delay, animation(values.width, config)),
33
- height: delayFunction(delay, animation(values.height, config)),
30
+ originX: delayFunction(
31
+ delay,
32
+ animation(values.targetOriginX, config)
33
+ ),
34
+ originY: delayFunction(
35
+ delay,
36
+ animation(values.targetOriginY, config)
37
+ ),
38
+ width: delayFunction(delay, animation(values.targetWidth, config)),
39
+ height: delayFunction(delay, animation(values.targetHeight, config)),
34
40
  },
35
41
  callback: callback,
36
42
  };
@@ -36,38 +36,50 @@ export class SequencedTransition
36
36
  'worklet';
37
37
  return {
38
38
  initialValues: {
39
- originX: values.boriginX,
40
- originY: values.boriginY,
41
- width: values.bwidth,
42
- height: values.bheight,
39
+ originX: values.currentOriginX,
40
+ originY: values.currentOriginY,
41
+ width: values.currentWidth,
42
+ height: values.currentHeight,
43
43
  },
44
44
  animations: {
45
45
  originX: delayFunction(
46
46
  delay,
47
47
  withSequence(
48
- withTiming(reverse ? values.boriginX : values.originX, config),
49
- withTiming(values.originX, config)
48
+ withTiming(
49
+ reverse ? values.currentOriginX : values.targetOriginX,
50
+ config
51
+ ),
52
+ withTiming(values.targetOriginX, config)
50
53
  )
51
54
  ),
52
55
  originY: delayFunction(
53
56
  delay,
54
57
  withSequence(
55
- withTiming(reverse ? values.originY : values.boriginY, config),
56
- withTiming(values.originY, config)
58
+ withTiming(
59
+ reverse ? values.targetOriginY : values.currentOriginY,
60
+ config
61
+ ),
62
+ withTiming(values.targetOriginY, config)
57
63
  )
58
64
  ),
59
65
  width: delayFunction(
60
66
  delay,
61
67
  withSequence(
62
- withTiming(reverse ? values.bwidth : values.width, config),
63
- withTiming(values.width, config)
68
+ withTiming(
69
+ reverse ? values.currentWidth : values.targetWidth,
70
+ config
71
+ ),
72
+ withTiming(values.targetWidth, config)
64
73
  )
65
74
  ),
66
75
  height: delayFunction(
67
76
  delay,
68
77
  withSequence(
69
- withTiming(reverse ? values.height : values.bheight, config),
70
- withTiming(values.height, config)
78
+ withTiming(
79
+ reverse ? values.targetHeight : values.currentHeight,
80
+ config
81
+ ),
82
+ withTiming(values.targetHeight, config)
71
83
  )
72
84
  ),
73
85
  },
package/lib/Animated.js DELETED
@@ -1,25 +0,0 @@
1
- import { Image, ScrollView, Text, View } from 'react-native';
2
- import createAnimatedComponent from './createAnimatedComponent';
3
- import {
4
- addWhitelistedNativeProps,
5
- addWhitelistedUIProps,
6
- } from './ConfigHelper';
7
- import * as reanimated1 from './reanimated1';
8
-
9
- const Animated = {
10
- // components
11
- View: createAnimatedComponent(View),
12
- Text: createAnimatedComponent(Text),
13
- Image: createAnimatedComponent(Image),
14
- ScrollView: createAnimatedComponent(ScrollView),
15
- createAnimatedComponent,
16
- // configuration
17
- addWhitelistedNativeProps,
18
- addWhitelistedUIProps,
19
- // reanimated 1
20
- ...reanimated1,
21
- };
22
-
23
- export * from './reanimated2';
24
- export * from './reanimated1';
25
- export default Animated;