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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) 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.h +1 -1
  28. package/ios/LayoutReanimation/REAAnimationsManager.m +68 -19
  29. package/ios/LayoutReanimation/REAUIManager.mm +63 -18
  30. package/ios/Nodes/REAPropsNode.m +1 -1
  31. package/ios/REAEventDispatcher.m +1 -1
  32. package/ios/REAModule.h +0 -2
  33. package/ios/REAModule.m +0 -3
  34. package/ios/REANodesManager.m +1 -0
  35. package/ios/RNGestureHandlerStateManager.h +5 -0
  36. package/ios/native/NativeMethods.h +5 -0
  37. package/ios/native/NativeMethods.mm +8 -1
  38. package/ios/native/NativeProxy.h +1 -0
  39. package/ios/native/NativeProxy.mm +19 -3
  40. package/ios/native/REAInitializer.mm +7 -3
  41. package/lib/src/Animated.js +31 -0
  42. package/lib/{ConfigHelper.js → src/ConfigHelper.js} +0 -0
  43. package/lib/{ReanimatedEventEmitter.js → src/ReanimatedEventEmitter.js} +0 -0
  44. package/lib/{ReanimatedModule.js → src/ReanimatedModule.js} +0 -0
  45. package/lib/{ReanimatedModule.macos.js → src/ReanimatedModule.macos.js} +0 -0
  46. package/lib/{ReanimatedModule.native.js → src/ReanimatedModule.native.js} +0 -0
  47. package/lib/{ReanimatedModule.windows.js → src/ReanimatedModule.windows.js} +0 -0
  48. package/lib/{ReanimatedModuleCompat.js → src/ReanimatedModuleCompat.js} +0 -0
  49. package/lib/{__mocks__ → src/__mocks__}/ReanimatedEventEmitter.js +0 -0
  50. package/lib/{__mocks__ → src/__mocks__}/ReanimatedModule.native.js +0 -0
  51. package/lib/{createAnimatedComponent.js → src/createAnimatedComponent.js} +55 -37
  52. package/lib/src/index.js +31 -0
  53. package/lib/{reanimated1 → src/reanimated1}/Easing.js +0 -0
  54. package/lib/{reanimated1 → src/reanimated1}/SpringConfig.js +0 -0
  55. package/lib/{reanimated1 → src/reanimated1}/Transitioning.js +0 -0
  56. package/lib/{reanimated1 → src/reanimated1}/animations/Animation.js +0 -0
  57. package/lib/{reanimated1 → src/reanimated1}/animations/SpringUtils.js +0 -0
  58. package/lib/{reanimated1 → src/reanimated1}/animations/backwardCompatibleAnimWrapper.js +0 -0
  59. package/lib/{reanimated1 → src/reanimated1}/animations/decay.js +0 -0
  60. package/lib/{reanimated1 → src/reanimated1}/animations/spring.js +0 -0
  61. package/lib/{reanimated1 → src/reanimated1}/animations/timing.js +0 -0
  62. package/lib/{reanimated1 → src/reanimated1}/base.js +0 -0
  63. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedAlways.js +0 -0
  64. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedBezier.js +0 -0
  65. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedBlock.js +0 -0
  66. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCall.js +0 -0
  67. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCallFunc.js +0 -0
  68. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedClock.js +0 -0
  69. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedClockTest.js +0 -0
  70. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCode.js +0 -0
  71. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedConcat.js +0 -0
  72. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedCond.js +0 -0
  73. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedDebug.js +0 -0
  74. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedEvent.js +0 -0
  75. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedFunction.js +0 -0
  76. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedNode.js +0 -0
  77. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedOperator.js +0 -0
  78. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedParam.js +0 -0
  79. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedProps.js +0 -0
  80. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedSet.js +0 -0
  81. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedStartClock.js +0 -0
  82. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedStopClock.js +0 -0
  83. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedStyle.js +0 -0
  84. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedTransform.js +0 -0
  85. package/lib/{reanimated1 → src/reanimated1}/core/AnimatedValue.js +0 -0
  86. package/lib/{reanimated1 → src/reanimated1}/core/Core.test.js +1 -1
  87. package/lib/{reanimated1 → src/reanimated1}/core/InternalAnimatedValue.js +0 -0
  88. package/lib/{reanimated1 → src/reanimated1}/core/__mocks__/AnimatedProps.js +0 -0
  89. package/lib/{reanimated1 → src/reanimated1}/core/createEventObjectProxyPolyfill.js +0 -0
  90. package/lib/{reanimated1 → src/reanimated1}/derived/__mocks__/evaluateOnce.js +0 -0
  91. package/lib/{reanimated1 → src/reanimated1}/derived/acc.js +0 -0
  92. package/lib/{reanimated1 → src/reanimated1}/derived/color.js +0 -0
  93. package/lib/{reanimated1 → src/reanimated1}/derived/diff.js +0 -0
  94. package/lib/{reanimated1 → src/reanimated1}/derived/diffClamp.js +0 -0
  95. package/lib/{reanimated1 → src/reanimated1}/derived/evaluateOnce.js +0 -0
  96. package/lib/{reanimated1 → src/reanimated1}/derived/index.js +0 -0
  97. package/lib/{reanimated1 → src/reanimated1}/derived/interpolate.js +0 -0
  98. package/lib/{reanimated1 → src/reanimated1}/derived/interpolateColors.js +0 -0
  99. package/lib/{reanimated1 → src/reanimated1}/derived/onChange.js +0 -0
  100. package/lib/{reanimated1 → src/reanimated1}/derived/useCode.js +0 -0
  101. package/lib/{reanimated1 → src/reanimated1}/index.js +0 -0
  102. package/lib/{reanimated1 → src/reanimated1}/operators.js +0 -0
  103. package/lib/{reanimated1 → src/reanimated1}/useValue.js +0 -0
  104. package/lib/{reanimated1 → src/reanimated1}/val.js +0 -0
  105. package/lib/{reanimated2 → src/reanimated2}/Bezier.js +0 -0
  106. package/lib/{reanimated2 → src/reanimated2}/Colors.js +1 -97
  107. package/lib/{reanimated2 → src/reanimated2}/Easing.js +5 -0
  108. package/lib/src/reanimated2/NativeMethods.js +42 -0
  109. package/lib/{reanimated2 → src/reanimated2}/NativeReanimated/NativeReanimated.js +3 -0
  110. package/lib/{reanimated2 → src/reanimated2}/NativeReanimated/index.js +2 -2
  111. package/lib/{reanimated2 → src/reanimated2}/PlatformChecker.js +0 -0
  112. package/lib/{reanimated2 → src/reanimated2}/PropAdapters.js +0 -0
  113. package/lib/{reanimated2 → src/reanimated2}/UpdateProps.js +1 -1
  114. package/lib/{reanimated2 → src/reanimated2}/ViewDescriptorsSet.js +4 -2
  115. package/lib/{reanimated2 → src/reanimated2}/WorkletEventHandler.js +0 -0
  116. package/lib/{reanimated2 → src/reanimated2}/__mocks__/MutableValue.js +0 -0
  117. package/lib/{reanimated2 → src/reanimated2}/__mocks__/NativeReanimated.js +0 -0
  118. package/lib/{reanimated2 → src/reanimated2}/__mocks__/NativeReanimated.native.js +0 -0
  119. package/lib/{reanimated2 → src/reanimated2}/animation/commonTypes.js +0 -0
  120. package/lib/{reanimated2 → src/reanimated2}/animation/decay.js +0 -0
  121. package/lib/{reanimated2 → src/reanimated2}/animation/delay.js +0 -0
  122. package/lib/{reanimated2 → src/reanimated2}/animation/index.js +0 -0
  123. package/lib/{reanimated2 → src/reanimated2}/animation/repeat.js +0 -0
  124. package/lib/{reanimated2 → src/reanimated2}/animation/sequence.js +0 -0
  125. package/lib/{reanimated2 → src/reanimated2}/animation/spring.js +0 -0
  126. package/lib/{reanimated2 → src/reanimated2}/animation/styleAnimation.js +5 -0
  127. package/lib/{reanimated2 → src/reanimated2}/animation/timing.js +0 -0
  128. package/lib/{reanimated2 → src/reanimated2}/animation/util.js +0 -0
  129. package/lib/{reanimated2 → src/reanimated2}/commonTypes.js +0 -0
  130. package/lib/src/reanimated2/component/FlatList.js +30 -0
  131. package/lib/src/reanimated2/component/WrappedComponents.js +9 -0
  132. package/lib/src/reanimated2/component/index.js +4 -0
  133. package/lib/{reanimated2 → src/reanimated2}/core.js +27 -3
  134. package/lib/{reanimated2 → src/reanimated2}/globals.d.ts +5 -0
  135. package/lib/{reanimated2 → src/reanimated2}/hook/Hooks.js +0 -0
  136. package/lib/{reanimated2 → src/reanimated2}/hook/commonTypes.js +0 -0
  137. package/lib/{reanimated2 → src/reanimated2}/hook/index.js +0 -0
  138. package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedGestureHandler.js +1 -2
  139. package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedReaction.js +0 -0
  140. package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedRef.js +0 -0
  141. package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedScrollHandler.js +0 -0
  142. package/lib/{reanimated2 → src/reanimated2}/hook/useAnimatedStyle.js +31 -14
  143. package/lib/{reanimated2 → src/reanimated2}/hook/useDerivedValue.js +0 -0
  144. package/lib/{reanimated2 → src/reanimated2}/hook/useSharedValue.js +0 -0
  145. package/lib/{reanimated2 → src/reanimated2}/hook/utils.js +14 -11
  146. package/lib/{reanimated2 → src/reanimated2}/index.js +2 -0
  147. package/lib/src/reanimated2/interpolateColor.js +98 -0
  148. package/lib/{reanimated2 → src/reanimated2}/interpolation.js +0 -0
  149. package/lib/{reanimated2 → src/reanimated2}/jestUtils.js +0 -0
  150. package/lib/{reanimated2 → src/reanimated2}/js-reanimated/JSReanimated.js +4 -1
  151. package/lib/{reanimated2 → src/reanimated2}/js-reanimated/Mapper.js +4 -1
  152. package/lib/{reanimated2 → src/reanimated2}/js-reanimated/MapperRegistry.js +0 -0
  153. package/lib/{reanimated2 → src/reanimated2}/js-reanimated/MutableValue.js +0 -0
  154. package/lib/{reanimated2/layoutReanimation/animationBuilder → src/reanimated2/js-reanimated}/commonTypes.js +0 -0
  155. package/lib/{reanimated2 → src/reanimated2}/js-reanimated/index.js +3 -0
  156. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/LayoutAnimationRepository.js +14 -5
  157. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/BaseAnimationBuilder.js +0 -0
  158. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/ComplexAnimationBuilder.js +0 -0
  159. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/Keyframe.js +0 -0
  160. package/lib/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.js +1 -0
  161. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/animationBuilder/index.js +0 -0
  162. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Bounce.js +0 -0
  163. package/lib/src/reanimated2/layoutReanimation/defaultAnimations/Default.js +36 -0
  164. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Fade.js +0 -0
  165. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Flip.js +8 -8
  166. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Lightspeed.js +0 -0
  167. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Pinwheel.js +0 -0
  168. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Roll.js +0 -0
  169. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Rotate.js +16 -16
  170. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Slide.js +16 -16
  171. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Stretch.js +0 -0
  172. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/Zoom.js +4 -4
  173. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultAnimations/index.js +0 -0
  174. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/CurvedTransition.js +20 -8
  175. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/EntryExitTransition.js +3 -3
  176. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/FadingTransition.js +8 -8
  177. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/JumpingTransition.js +10 -10
  178. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/LinearTransition.js +8 -8
  179. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/SequencedTransition.js +8 -8
  180. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/defaultTransitions/index.js +0 -0
  181. package/lib/{reanimated2 → src/reanimated2}/layoutReanimation/index.js +0 -0
  182. package/lib/{reanimated2 → src/reanimated2}/mock.js +0 -0
  183. package/lib/{reanimated2 → src/reanimated2}/platform-specific/RNRenderer.js +0 -0
  184. package/lib/{reanimated2 → src/reanimated2}/platform-specific/RNRenderer.web.js +0 -0
  185. package/lib/{reanimated2 → src/reanimated2}/utils.js +0 -0
  186. package/lib/{setAndForwardRef.js → src/setAndForwardRef.js} +0 -0
  187. package/mock.js +2 -1
  188. package/package.json +7 -4
  189. package/plugin.js +11 -3
  190. package/react-native-reanimated.d.ts +94 -23
  191. package/src/Animated.js +11 -5
  192. package/src/createAnimatedComponent.tsx +86 -43
  193. package/src/reanimated1/core/Core.test.js +1 -1
  194. package/src/reanimated2/Colors.ts +6 -150
  195. package/src/reanimated2/Easing.ts +11 -0
  196. package/src/reanimated2/NativeMethods.ts +31 -6
  197. package/src/reanimated2/NativeReanimated/NativeReanimated.ts +5 -0
  198. package/src/reanimated2/NativeReanimated/index.ts +2 -2
  199. package/src/reanimated2/UpdateProps.ts +1 -1
  200. package/src/reanimated2/ViewDescriptorsSet.ts +6 -2
  201. package/src/reanimated2/animation/commonTypes.ts +44 -40
  202. package/src/reanimated2/animation/decay.ts +1 -1
  203. package/src/reanimated2/animation/delay.ts +2 -16
  204. package/src/reanimated2/animation/index.ts +7 -8
  205. package/src/reanimated2/animation/repeat.ts +2 -12
  206. package/src/reanimated2/animation/sequence.ts +3 -10
  207. package/src/reanimated2/animation/spring.ts +1 -1
  208. package/src/reanimated2/animation/styleAnimation.ts +10 -18
  209. package/src/reanimated2/animation/timing.ts +1 -1
  210. package/src/reanimated2/animation/util.ts +12 -9
  211. package/src/reanimated2/commonTypes.ts +48 -1
  212. package/src/reanimated2/component/FlatList.tsx +44 -0
  213. package/src/reanimated2/component/WrappedComponents.ts +11 -0
  214. package/src/reanimated2/component/index.ts +9 -0
  215. package/src/reanimated2/core.ts +39 -6
  216. package/src/reanimated2/globals.d.ts +5 -0
  217. package/src/reanimated2/hook/commonTypes.ts +5 -0
  218. package/src/reanimated2/hook/useAnimatedGestureHandler.ts +1 -2
  219. package/src/reanimated2/hook/useAnimatedRef.ts +1 -5
  220. package/src/reanimated2/hook/useAnimatedStyle.ts +35 -16
  221. package/src/reanimated2/hook/utils.ts +18 -17
  222. package/src/reanimated2/index.ts +2 -0
  223. package/src/reanimated2/interpolateColor.ts +178 -0
  224. package/src/reanimated2/js-reanimated/JSReanimated.ts +9 -4
  225. package/src/reanimated2/js-reanimated/Mapper.ts +4 -2
  226. package/src/reanimated2/js-reanimated/MapperRegistry.ts +1 -1
  227. package/src/reanimated2/js-reanimated/commonTypes.ts +51 -0
  228. package/src/reanimated2/js-reanimated/index.ts +5 -0
  229. package/src/reanimated2/layoutReanimation/LayoutAnimationRepository.ts +18 -5
  230. package/src/reanimated2/layoutReanimation/animationBuilder/commonTypes.ts +39 -20
  231. package/src/reanimated2/layoutReanimation/animationBuilder/index.ts +5 -1
  232. package/src/reanimated2/layoutReanimation/defaultAnimations/Default.ts +21 -15
  233. package/src/reanimated2/layoutReanimation/defaultAnimations/Flip.ts +29 -24
  234. package/src/reanimated2/layoutReanimation/defaultAnimations/Rotate.ts +61 -34
  235. package/src/reanimated2/layoutReanimation/defaultAnimations/Slide.ts +49 -34
  236. package/src/reanimated2/layoutReanimation/defaultAnimations/Zoom.ts +17 -12
  237. package/src/reanimated2/layoutReanimation/defaultTransitions/CurvedTransition.ts +20 -8
  238. package/src/reanimated2/layoutReanimation/defaultTransitions/EntryExitTransition.ts +15 -11
  239. package/src/reanimated2/layoutReanimation/defaultTransitions/FadingTransition.ts +8 -8
  240. package/src/reanimated2/layoutReanimation/defaultTransitions/JumpingTransition.ts +20 -14
  241. package/src/reanimated2/layoutReanimation/defaultTransitions/LinearTransition.ts +14 -8
  242. package/src/reanimated2/layoutReanimation/defaultTransitions/SequencedTransition.ts +24 -12
  243. package/src/reanimated2/utils.ts +1 -1
  244. package/lib/Animated.js +0 -25
  245. package/lib/index.js +0 -25
  246. package/lib/reanimated2/NativeMethods.js +0 -25
  247. package/lib/reanimated2/layoutReanimation/defaultAnimations/Default.js +0 -36
@@ -3,6 +3,7 @@
3
3
  #include <memory>
4
4
  #include <thread>
5
5
  #include "EventHandlerRegistry.h"
6
+ #include "FeaturesConfig.h"
6
7
  #include "FrozenObject.h"
7
8
  #include "JSIStoreValueUser.h"
8
9
  #include "Mapper.h"
@@ -84,6 +85,7 @@ NativeReanimatedModule::NativeReanimatedModule(
84
85
  platformDepMethodsHolder.scrollToFunction,
85
86
  platformDepMethodsHolder.measuringFunction,
86
87
  platformDepMethodsHolder.getCurrentTime,
88
+ platformDepMethodsHolder.setGestureStateFunction,
87
89
  layoutAnimationsProxy);
88
90
  onRenderCallback = [this](double timestampMs) {
89
91
  this->renderRequested = false;
@@ -234,6 +236,13 @@ jsi::Value NativeReanimatedModule::getViewProp(
234
236
  return jsi::Value::undefined();
235
237
  }
236
238
 
239
+ jsi::Value NativeReanimatedModule::enableLayoutAnimations(
240
+ jsi::Runtime &rt,
241
+ const jsi::Value &config) {
242
+ FeaturesConfig::setLayoutAnimationEnabled(config.getBool());
243
+ return jsi::Value::undefined();
244
+ }
245
+
237
246
  void NativeReanimatedModule::onEvent(
238
247
  std::string eventName,
239
248
  std::string eventAsString) {
@@ -99,6 +99,17 @@ static jsi::Value __hostFunction_NativeReanimatedModuleSpec_getViewProp(
99
99
  return jsi::Value::undefined();
100
100
  }
101
101
 
102
+ static jsi::Value
103
+ __hostFunction_NativeReanimatedModuleSpec_enableLayoutAnimations(
104
+ jsi::Runtime &rt,
105
+ TurboModule &turboModule,
106
+ const jsi::Value *args,
107
+ size_t count) {
108
+ static_cast<NativeReanimatedModuleSpec *>(&turboModule)
109
+ ->enableLayoutAnimations(rt, std::move(args[0]));
110
+ return jsi::Value::undefined();
111
+ }
112
+
102
113
  NativeReanimatedModuleSpec::NativeReanimatedModuleSpec(
103
114
  std::shared_ptr<CallInvoker> jsInvoker)
104
115
  : TurboModule("NativeReanimated", jsInvoker) {
@@ -124,6 +135,8 @@ NativeReanimatedModuleSpec::NativeReanimatedModuleSpec(
124
135
 
125
136
  methodMap_["getViewProp"] =
126
137
  MethodMetadata{3, __hostFunction_NativeReanimatedModuleSpec_getViewProp};
138
+ methodMap_["enableLayoutAnimations"] = MethodMetadata{
139
+ 2, __hostFunction_NativeReanimatedModuleSpec_enableLayoutAnimations};
127
140
  }
128
141
 
129
142
  } // namespace reanimated
@@ -0,0 +1,5 @@
1
+ #include "FeaturesConfig.h"
2
+
3
+ namespace reanimated {
4
+ bool FeaturesConfig::_isLayoutAnimationEnabled = false;
5
+ }
@@ -1,4 +1,5 @@
1
1
  #include "RuntimeDecorator.h"
2
+ #include <chrono>
2
3
  #include <memory>
3
4
  #include <unordered_map>
4
5
  #include "LayoutAnimationsProxy.h"
@@ -8,11 +9,15 @@
8
9
  namespace reanimated {
9
10
 
10
11
  std::unordered_map<RuntimePointer, RuntimeType>
11
- RuntimeDecorator::runtimeRegistry;
12
+ &RuntimeDecorator::runtimeRegistry() {
13
+ static std::unordered_map<RuntimePointer, RuntimeType> runtimeRegistry;
14
+ return runtimeRegistry;
15
+ }
16
+
12
17
  void RuntimeDecorator::registerRuntime(
13
18
  jsi::Runtime *runtime,
14
19
  RuntimeType runtimeType) {
15
- runtimeRegistry.insert({runtime, runtimeType});
20
+ runtimeRegistry().insert({runtime, runtimeType});
16
21
  }
17
22
 
18
23
  void RuntimeDecorator::decorateRuntime(
@@ -79,6 +84,22 @@ void RuntimeDecorator::decorateRuntime(
79
84
  jsi::PropNameID::forAscii(rt, "_setGlobalConsole"),
80
85
  1,
81
86
  setGlobalConsole));
87
+
88
+ rt.global().setProperty(
89
+ rt,
90
+ "_chronoNow",
91
+ jsi::Function::createFromHostFunction(
92
+ rt,
93
+ jsi::PropNameID::forAscii(rt, "_chronoNow"),
94
+ 0,
95
+ [](jsi::Runtime &rt,
96
+ const jsi::Value &thisValue,
97
+ const jsi::Value *args,
98
+ size_t count) -> jsi::Value {
99
+ double now = std::chrono::system_clock::now().time_since_epoch() /
100
+ std::chrono::milliseconds(1);
101
+ return jsi::Value(now);
102
+ }));
82
103
  }
83
104
 
84
105
  void RuntimeDecorator::decorateUIRuntime(
@@ -88,6 +109,7 @@ void RuntimeDecorator::decorateUIRuntime(
88
109
  const ScrollToFunction scrollTo,
89
110
  const MeasuringFunction measure,
90
111
  const TimeProviderFunction getCurrentTime,
112
+ const SetGestureStateFunction setGestureState,
91
113
  std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy) {
92
114
  RuntimeDecorator::decorateRuntime(rt, "UI");
93
115
  rt.global().setProperty(rt, "_UI", jsi::Value(true));
@@ -207,6 +229,20 @@ void RuntimeDecorator::decorateUIRuntime(
207
229
  jsi::Value _stopObservingProgress = jsi::Function::createFromHostFunction(
208
230
  rt, jsi::PropNameID::forAscii(rt, "_stopObservingProgress"), 0, clb8);
209
231
  rt.global().setProperty(rt, "_stopObservingProgress", _stopObservingProgress);
232
+
233
+ auto clb9 = [setGestureState](
234
+ jsi::Runtime &rt,
235
+ const jsi::Value &thisValue,
236
+ const jsi::Value *args,
237
+ size_t count) -> jsi::Value {
238
+ int handlerTag = static_cast<int>(args[0].asNumber());
239
+ int newState = static_cast<int>(args[1].asNumber());
240
+ setGestureState(handlerTag, newState);
241
+ return jsi::Value::undefined();
242
+ };
243
+ jsi::Value setGestureStateFunction = jsi::Function::createFromHostFunction(
244
+ rt, jsi::PropNameID::forAscii(rt, "_setGestureState"), 2, clb9);
245
+ rt.global().setProperty(rt, "_setGestureState", setGestureStateFunction);
210
246
  }
211
247
 
212
248
  } // namespace reanimated
@@ -68,6 +68,9 @@ class NativeReanimatedModule : public NativeReanimatedModuleSpec,
68
68
  const jsi::Value &propName,
69
69
  const jsi::Value &callback) override;
70
70
 
71
+ jsi::Value enableLayoutAnimations(jsi::Runtime &rt, const jsi::Value &config)
72
+ override;
73
+
71
74
  void onRender(double timestampMs);
72
75
  void onEvent(std::string eventName, std::string eventAsString);
73
76
  bool isAnyHandlerWaitingForEvent(std::string eventName);
@@ -58,6 +58,11 @@ class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule {
58
58
  const jsi::Value &viewTag,
59
59
  const jsi::Value &propName,
60
60
  const jsi::Value &callback) = 0;
61
+
62
+ // other
63
+ virtual jsi::Value enableLayoutAnimations(
64
+ jsi::Runtime &rt,
65
+ const jsi::Value &config) = 0;
61
66
  };
62
67
 
63
68
  } // namespace reanimated
@@ -0,0 +1,19 @@
1
+ #pragma once
2
+ #include <string>
3
+
4
+ namespace reanimated {
5
+
6
+ class FeaturesConfig {
7
+ public:
8
+ static inline bool isLayoutAnimationEnabled() {
9
+ return _isLayoutAnimationEnabled;
10
+ }
11
+ static inline void setLayoutAnimationEnabled(bool isLayoutAnimationEnabled) {
12
+ _isLayoutAnimationEnabled = isLayoutAnimationEnabled;
13
+ }
14
+
15
+ private:
16
+ static bool _isLayoutAnimationEnabled;
17
+ };
18
+
19
+ } // namespace reanimated
@@ -21,6 +21,7 @@ using ScrollToFunction = std::function<void(int, double, double, bool)>;
21
21
  using MeasuringFunction =
22
22
  std::function<std::vector<std::pair<std::string, double>>(int)>;
23
23
  using TimeProviderFunction = std::function<double(void)>;
24
+ using SetGestureStateFunction = std::function<void(int, int)>;
24
25
 
25
26
  struct PlatformDepMethodsHolder {
26
27
  RequestRender requestRender;
@@ -28,6 +29,7 @@ struct PlatformDepMethodsHolder {
28
29
  ScrollToFunction scrollToFunction;
29
30
  MeasuringFunction measuringFunction;
30
31
  TimeProviderFunction getCurrentTime;
32
+ SetGestureStateFunction setGestureStateFunction;
31
33
  };
32
34
 
33
35
  } // namespace reanimated
@@ -36,6 +36,7 @@ class RuntimeDecorator {
36
36
  const ScrollToFunction scrollTo,
37
37
  const MeasuringFunction measure,
38
38
  const TimeProviderFunction getCurrentTime,
39
+ const SetGestureStateFunction setGestureState,
39
40
  std::shared_ptr<LayoutAnimationsProxy> layoutAnimationsProxy);
40
41
 
41
42
  /**
@@ -58,27 +59,27 @@ class RuntimeDecorator {
58
59
  static void registerRuntime(jsi::Runtime *runtime, RuntimeType runtimeType);
59
60
 
60
61
  private:
61
- static std::unordered_map<RuntimePointer, RuntimeType> runtimeRegistry;
62
+ static std::unordered_map<RuntimePointer, RuntimeType> &runtimeRegistry();
62
63
  };
63
64
 
64
65
  inline bool RuntimeDecorator::isUIRuntime(jsi::Runtime &rt) {
65
- auto iterator = runtimeRegistry.find(&rt);
66
- if (iterator == runtimeRegistry.end())
66
+ auto iterator = runtimeRegistry().find(&rt);
67
+ if (iterator == runtimeRegistry().end())
67
68
  return false;
68
69
  return iterator->second == RuntimeType::UI;
69
70
  }
70
71
 
71
72
  inline bool RuntimeDecorator::isWorkletRuntime(jsi::Runtime &rt) {
72
- auto iterator = runtimeRegistry.find(&rt);
73
- if (iterator == runtimeRegistry.end())
73
+ auto iterator = runtimeRegistry().find(&rt);
74
+ if (iterator == runtimeRegistry().end())
74
75
  return false;
75
76
  auto type = iterator->second;
76
77
  return type == RuntimeType::UI || type == RuntimeType::Worklet;
77
78
  }
78
79
 
79
80
  inline bool RuntimeDecorator::isReactRuntime(jsi::Runtime &rt) {
80
- auto iterator = runtimeRegistry.find(&rt);
81
- if (iterator == runtimeRegistry.end())
81
+ auto iterator = runtimeRegistry().find(&rt);
82
+ if (iterator == runtimeRegistry().end())
82
83
  return true;
83
84
  return false;
84
85
  }
package/README.md CHANGED
@@ -19,7 +19,7 @@ Check out our dedicated documentation page for info about this library, API refe
19
19
 
20
20
  ## Examples
21
21
 
22
- The source code for the example (showcase) app is under the [`Example/`](https://github.com/software-mansion/react-native-reanimated/blob/master/Example/) directory.
22
+ The source code for the example (showcase) app is under the [`Example/`](https://github.com/software-mansion/react-native-reanimated/blob/main/Example/) directory.
23
23
  If you want to play with the API but don't feel like trying it on a real app, you can run the example project. Check Example/ directory README for installation instructions.
24
24
 
25
25
  ## License
@@ -5,10 +5,28 @@ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
5
5
  reactVersion = '0.0.0'
6
6
 
7
7
  begin
8
+ # standard app
9
+ # /appName/node_modules/react-native-reanimated/RNReanimated.podspec
10
+ # /appName/node_modules/react-native/package.json
8
11
  reactVersion = JSON.parse(File.read(File.join(__dir__, "..", "..", "node_modules", "react-native", "package.json")))["version"]
9
12
  rescue
10
- # Example app
11
- reactVersion = JSON.parse(File.read(File.join(__dir__, "node_modules", "react-native", "package.json")))["version"]
13
+ begin
14
+ # monorepo
15
+ # /monorepo/packages/appName/node_modules/react-native-reanimated/RNReanimated.podspec
16
+ # /monorepo/node_modules/react-native/package.json
17
+ reactVersion = JSON.parse(File.read(File.join(__dir__, "..", "..", "..", "..", "node_modules", "react-native", "package.json")))["version"]
18
+ rescue
19
+ begin
20
+ # Example app in reanimated repo
21
+ # /react-native-reanimated/RNReanimated.podspec
22
+ # /react-native-reanimated/node_modules/react-native/package.json
23
+ reactVersion = JSON.parse(File.read(File.join(__dir__, "node_modules", "react-native", "package.json")))["version"]
24
+ rescue
25
+ # should never happen
26
+ reactVersion = '0.66.0'
27
+ puts "[RNReanimated] Unable to recognized your `react-native` version! Default `react-native` version: " + reactVersion
28
+ end
29
+ end
12
30
  end
13
31
 
14
32
  rnVersion = reactVersion.split('.')[1]
@@ -75,7 +93,6 @@ Pod::Spec.new do |s|
75
93
  s.dependency 'React-RCTBlob'
76
94
  s.dependency 'React-RCTSettings'
77
95
  s.dependency 'React-RCTText'
78
- s.dependency 'React-RCTVibration'
79
96
  s.dependency 'React-RCTImage'
80
97
  s.dependency 'React-Core/RCTWebSocket'
81
98
  s.dependency 'React-cxxreact'
@@ -31,14 +31,14 @@ abstract class replaceSoTask extends DefaultTask {
31
31
  def getCurrentFlavor() {
32
32
  Gradle gradle = getGradle()
33
33
  String taskRequestName = gradle.getStartParameter().getTaskRequests().toString()
34
- Pattern pattern = Pattern.compile("(assemble|install|generate)(\\w+)(Release|Debug)")
34
+ Pattern pattern = Pattern.compile("(assemble|bundle|install|generate)(\\w*)(Release|Debug)")
35
35
  Matcher matcher = pattern.matcher(taskRequestName)
36
36
 
37
37
  if(matcher.find()) {
38
38
  return matcher.group(2)
39
39
  }
40
40
 
41
- return ""
41
+ return "NOT-FOUND"
42
42
  }
43
43
 
44
44
  def replaceSoTaskDebug
@@ -58,8 +58,9 @@ rootProject.getSubprojects().forEach({project ->
58
58
 
59
59
  if(project.getProperties().get("android") && Integer.parseInt(minor) < 65) {
60
60
  def projectProperties = project.getProperties()
61
- if(!projectProperties.get("reanimated")
62
- || (projectProperties.get("reanimated") && projectProperties.get("reanimated").get("enablePackagingOptions"))
61
+ final NOTFOUND = "NOT-FOUND"
62
+ if(!NOTFOUND.equals(getCurrentFlavor()) && (!projectProperties.get("reanimated")
63
+ || (projectProperties.get("reanimated") && projectProperties.get("reanimated").get("enablePackagingOptions")))
63
64
  ) {
64
65
  def flavorString = getCurrentFlavor()
65
66
  replaceSoTask.appName = project.getProperties().path
@@ -82,4 +83,29 @@ rootProject.getSubprojects().forEach({project ->
82
83
  }
83
84
  })
84
85
 
85
- artifacts.add("default", file("react-native-reanimated-${minor}-${engine}.aar"))
86
+ def minorCopy = Integer.parseInt(minor)
87
+ def aar = file("react-native-reanimated-${minorCopy}-${engine}.aar")
88
+
89
+ while (!aar.exists()) {
90
+ minorCopy -= 1
91
+ aar = file("react-native-reanimated-${minorCopy}-${engine}.aar")
92
+ if (minorCopy < 63) {
93
+ throw new GradleException('No aar for react-native-reanimated found.')
94
+ }
95
+ if (aar.exists()) {
96
+ println "\n\n\n"
97
+ println "****************************************************************************************"
98
+ println "\n\n\n"
99
+ println "WARNING reanimated - no version-specific reanimated AAR for react-native version " + minor + " found."
100
+ println "Falling back to AAR for react-native version " + minorCopy
101
+ println "The react-native JSI interface is not ABI-safe yet, this may result in crashes."
102
+ println "Please post a pull request to implement support for react-native version " + minor + " to the reanimated repo."
103
+ println "Thanks!"
104
+ println "\n\n\n"
105
+ println "****************************************************************************************"
106
+ }
107
+ }
108
+
109
+ artifacts.add("default", aar)
110
+
111
+ apply from: './expo/linking.gradle'
@@ -0,0 +1,46 @@
1
+ def isExpoLinked = false
2
+ rootProject.getSubprojects().forEach({ project ->
3
+ if (project.plugins.hasPlugin("com.android.application")) {
4
+ if (project.configurations.implementation.getDependencies().find { dep -> dep.name == "expo" }) {
5
+ isExpoLinked = true
6
+ }
7
+ }
8
+ })
9
+
10
+ def safeExtGet(prop, fallback) {
11
+ rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
12
+ }
13
+
14
+ if (isExpoLinked) {
15
+ apply plugin: 'com.android.library'
16
+
17
+ android {
18
+ // Disable aar bundling to fix the error when running `gradle assembleRelease` over `gradle :app:assembleRelease`
19
+ // which will throw `Direct local .aar file dependencies are not supported when building an AAR.`
20
+ tasks.whenTaskAdded { task ->
21
+ if (['bundleDebugAar', 'bundleReleaseAar'].contains(task.name)) {
22
+ task.enabled = false
23
+ }
24
+ }
25
+
26
+ compileSdkVersion safeExtGet('compileSdkVersion', 30)
27
+
28
+ sourceSets {
29
+ main.manifest.srcFile 'src/AndroidManifest.xml'
30
+ main.java.srcDirs = [ 'expo/src/main/java' ]
31
+ }
32
+
33
+ libraryVariants.all {
34
+ generateBuildConfigProvider?.get()?.enabled = false
35
+ }
36
+ }
37
+
38
+ dependencies {
39
+ implementation 'com.facebook.react:react-native:+'
40
+ implementation project(':expo-modules-core')
41
+
42
+ project.configurations.default.artifacts.each { artifact ->
43
+ api files(artifact.file)
44
+ }
45
+ }
46
+ }
@@ -0,0 +1,12 @@
1
+ package com.swmansion.reanimated;
2
+
3
+ import com.facebook.react.bridge.JavaScriptContextHolder;
4
+ import com.facebook.react.bridge.ReactApplicationContext;
5
+
6
+ public class EXReanimatedAdapter {
7
+ public static void registerJSIModules(ReactApplicationContext reactApplicationContext, JavaScriptContextHolder jsContext) {
8
+ NodesManager nodesManager =
9
+ reactApplicationContext.getNativeModule(ReanimatedModule.class).getNodesManager();
10
+ nodesManager.initWithContext(reactApplicationContext);
11
+ }
12
+ }
@@ -0,0 +1,26 @@
1
+ package expo.modules.adapters.reanimated;
2
+
3
+ import android.content.Context;
4
+
5
+ import com.facebook.react.bridge.JavaScriptContextHolder;
6
+ import com.facebook.react.bridge.ReactApplicationContext;
7
+ import com.swmansion.reanimated.EXReanimatedAdapter;
8
+
9
+ import java.util.Collections;
10
+ import java.util.List;
11
+
12
+ import expo.modules.core.interfaces.Package;
13
+ import expo.modules.core.interfaces.ReactNativeHostHandler;
14
+
15
+ public class EXReanimatedPackage implements Package {
16
+ @Override
17
+ public List<? extends ReactNativeHostHandler> createReactNativeHostHandlers(Context context) {
18
+ final ReactNativeHostHandler handler = new ReactNativeHostHandler() {
19
+ @Override
20
+ public void onRegisterJSIModules(ReactApplicationContext reactApplicationContext, JavaScriptContextHolder jsContext, boolean useDeveloperSupport) {
21
+ EXReanimatedAdapter.registerJSIModules(reactApplicationContext, jsContext);
22
+ }
23
+ };
24
+ return Collections.singletonList(handler);
25
+ }
26
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "platforms": ["android"]
3
+ }
@@ -5,10 +5,10 @@
5
5
  NS_ASSUME_NONNULL_BEGIN
6
6
 
7
7
  typedef NS_ENUM(NSInteger, ViewState) {
8
+ Inactive,
8
9
  Appearing,
9
10
  Disappearing,
10
11
  Layout,
11
- Inactive,
12
12
  ToRemove,
13
13
  };
14
14
 
@@ -7,6 +7,8 @@
7
7
 
8
8
  @interface REAAnimationsManager ()
9
9
 
10
+ typedef NS_ENUM(NSInteger, FrameConfigType) { EnteringFrame, ExitingFrame };
11
+
10
12
  @property (atomic, nullable) void (^startAnimationForTag)(NSNumber *, NSString *, NSDictionary *, NSNumber *);
11
13
  @property (atomic, nullable) void (^removeConfigForTag)(NSNumber *);
12
14
 
@@ -21,6 +23,8 @@
21
23
  NSMutableDictionary<NSNumber *, NSNumber *> *_states;
22
24
  NSMutableDictionary<NSNumber *, UIView *> *_viewForTag;
23
25
  NSMutableSet<NSNumber *> *_toRemove;
26
+ NSMutableArray<NSString *> *_targetKeys;
27
+ NSMutableArray<NSString *> *_currentKeys;
24
28
  BOOL _cleaningScheduled;
25
29
  }
26
30
 
@@ -43,6 +47,13 @@
43
47
  _viewForTag = [NSMutableDictionary new];
44
48
  _toRemove = [NSMutableSet new];
45
49
  _cleaningScheduled = false;
50
+
51
+ _targetKeys = [NSMutableArray new];
52
+ _currentKeys = [NSMutableArray new];
53
+ for (NSString *key in [[self class] layoutKeys]) {
54
+ [_targetKeys addObject:[NSString stringWithFormat:@"target%@", [key capitalizedString]]];
55
+ [_currentKeys addObject:[NSString stringWithFormat:@"current%@", [key capitalizedString]]];
56
+ }
46
57
  }
47
58
  return self;
48
59
  }
@@ -56,6 +67,8 @@
56
67
  _viewForTag = nil;
57
68
  _toRemove = nil;
58
69
  _cleaningScheduled = false;
70
+ _targetKeys = nil;
71
+ _currentKeys = nil;
59
72
  }
60
73
 
61
74
  - (void)setAnimationStartingBlock:
@@ -137,6 +150,10 @@
137
150
  NSMutableSet<NSNumber *> *roots = [NSMutableSet new];
138
151
  for (NSNumber *viewTag in _toRemove) {
139
152
  UIView *view = _viewForTag[viewTag];
153
+ if (view == nil) {
154
+ view = [_reaUiManager viewForReactTag:viewTag];
155
+ _viewForTag[viewTag] = view;
156
+ }
140
157
  [self findRoot:view roots:roots];
141
158
  }
142
159
  for (NSNumber *viewTag in roots) {
@@ -208,16 +225,53 @@
208
225
  [componentData setProps:newProps forView:view];
209
226
  }
210
227
 
211
- - (NSDictionary *)prepareDataForAnimatingWorklet:(NSMutableDictionary *)values
228
+ - (NSDictionary *)prepareDataForAnimatingWorklet:(NSMutableDictionary *)values frameConfig:(FrameConfigType)frameConfig
229
+ {
230
+ UIView *windowView = UIApplication.sharedApplication.keyWindow;
231
+ if (frameConfig == EnteringFrame) {
232
+ NSDictionary *preparedData = @{
233
+ @"targetWidth" : values[@"width"],
234
+ @"targetHeight" : values[@"height"],
235
+ @"targetOriginX" : values[@"originX"],
236
+ @"targetOriginY" : values[@"originY"],
237
+ @"targetGlobalOriginX" : values[@"globalOriginX"],
238
+ @"targetGlobalOriginY" : values[@"globalOriginY"],
239
+ @"windowWidth" : [NSNumber numberWithDouble:windowView.bounds.size.width],
240
+ @"windowHeight" : [NSNumber numberWithDouble:windowView.bounds.size.height]
241
+ };
242
+ return preparedData;
243
+ } else {
244
+ NSDictionary *preparedData = @{
245
+ @"currentWidth" : values[@"width"],
246
+ @"currentHeight" : values[@"height"],
247
+ @"currentOriginX" : values[@"originX"],
248
+ @"currentOriginY" : values[@"originY"],
249
+ @"currentGlobalOriginX" : values[@"globalOriginX"],
250
+ @"currentGlobalOriginY" : values[@"globalOriginY"],
251
+ @"windowWidth" : [NSNumber numberWithDouble:windowView.bounds.size.width],
252
+ @"windowHeight" : [NSNumber numberWithDouble:windowView.bounds.size.height]
253
+ };
254
+ return preparedData;
255
+ }
256
+ }
257
+
258
+ - (NSDictionary *)prepareDataForLayoutAnimatingWorklet:(NSMutableDictionary *)currentValues
259
+ targetValues:(NSMutableDictionary *)targetValues
212
260
  {
213
261
  UIView *windowView = UIApplication.sharedApplication.keyWindow;
214
262
  NSDictionary *preparedData = @{
215
- @"width" : values[@"width"],
216
- @"height" : values[@"height"],
217
- @"originX" : values[@"originX"],
218
- @"originY" : values[@"originY"],
219
- @"globalOriginX" : values[@"globalOriginX"],
220
- @"globalOriginY" : values[@"globalOriginY"],
263
+ @"currentWidth" : currentValues[@"width"],
264
+ @"currentHeight" : currentValues[@"height"],
265
+ @"currentOriginX" : currentValues[@"originX"],
266
+ @"currentOriginY" : currentValues[@"originY"],
267
+ @"currentGlobalOriginX" : currentValues[@"globalOriginX"],
268
+ @"currentGlobalOriginY" : currentValues[@"globalOriginY"],
269
+ @"targetWidth" : targetValues[@"width"],
270
+ @"targetHeight" : targetValues[@"height"],
271
+ @"targetOriginX" : targetValues[@"originX"],
272
+ @"targetOriginY" : targetValues[@"originY"],
273
+ @"targetGlobalOriginX" : targetValues[@"globalOriginX"],
274
+ @"targetGlobalOriginY" : targetValues[@"globalOriginY"],
221
275
  @"windowWidth" : [NSNumber numberWithDouble:windowView.bounds.size.width],
222
276
  @"windowHeight" : [NSNumber numberWithDouble:windowView.bounds.size.height]
223
277
  };
@@ -241,7 +295,7 @@
241
295
  return;
242
296
  }
243
297
  _states[tag] = [NSNumber numberWithInt:Disappearing];
244
- NSDictionary *preparedValues = [self prepareDataForAnimatingWorklet:startValues];
298
+ NSDictionary *preparedValues = [self prepareDataForAnimatingWorklet:startValues frameConfig:ExitingFrame];
245
299
  _startAnimationForTag(tag, @"exiting", preparedValues, @(0));
246
300
  }
247
301
 
@@ -257,7 +311,7 @@
257
311
  ViewState state = [_states[tag] intValue];
258
312
  if (state == Inactive) {
259
313
  if (targetValues != nil) {
260
- NSDictionary *preparedValues = [self prepareDataForAnimatingWorklet:targetValues];
314
+ NSDictionary *preparedValues = [self prepareDataForAnimatingWorklet:targetValues frameConfig:EnteringFrame];
261
315
  _startAnimationForTag(tag, @"entering", preparedValues, @(0));
262
316
  }
263
317
  return;
@@ -268,7 +322,7 @@
268
322
  {
269
323
  NSNumber *tag = view.reactTag;
270
324
  NSMutableDictionary *targetValues = after.values;
271
- NSMutableDictionary *startValues = before.values;
325
+ NSMutableDictionary *currentValues = before.values;
272
326
  if (_states[tag] == nil) {
273
327
  return;
274
328
  }
@@ -278,8 +332,9 @@
278
332
  }
279
333
  if (state == Appearing) {
280
334
  BOOL doNotStartLayout = true;
281
- for (NSString *key in [[self class] layoutKeys]) {
282
- if ([((NSNumber *)startValues[key]) doubleValue] != [((NSNumber *)targetValues[key]) doubleValue]) {
335
+ for (int i = 0; i < [[self class] layoutKeys].count; ++i) {
336
+ if ([((NSNumber *)currentValues[_currentKeys[i]]) doubleValue] !=
337
+ [((NSNumber *)targetValues[_targetKeys[i]]) doubleValue]) {
283
338
  doNotStartLayout = false;
284
339
  }
285
340
  }
@@ -288,13 +343,7 @@
288
343
  }
289
344
  }
290
345
  _states[view.reactTag] = [NSNumber numberWithInt:Layout];
291
- NSDictionary *preparedStartValues = [self prepareDataForAnimatingWorklet:startValues];
292
- NSDictionary *preparedTargetValues = [self prepareDataForAnimatingWorklet:targetValues];
293
- NSMutableDictionary *preparedValues = [NSMutableDictionary new];
294
- [preparedValues addEntriesFromDictionary:preparedTargetValues];
295
- for (NSString *key in preparedStartValues.allKeys) {
296
- preparedValues[[NSString stringWithFormat:@"%@%@", @"b", key]] = preparedStartValues[key];
297
- }
346
+ NSDictionary *preparedValues = [self prepareDataForLayoutAnimatingWorklet:currentValues targetValues:targetValues];
298
347
  _startAnimationForTag(view.reactTag, @"layout", preparedValues, @(0));
299
348
  }
300
349