react-native-reanimated 4.3.0-rc.0 → 4.3.1

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 (176) hide show
  1. package/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +8 -5
  2. package/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -5
  3. package/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +2 -3
  4. package/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +2 -3
  5. package/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +7 -3
  6. package/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +9 -2
  7. package/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +6 -2
  8. package/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +8 -2
  9. package/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +2 -2
  10. package/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +2 -2
  11. package/Common/cpp/reanimated/Compat/WorkletsApi.h +13 -0
  12. package/Common/cpp/reanimated/Events/UIEventHandler.cpp +1 -1
  13. package/Common/cpp/reanimated/Events/UIEventHandler.h +3 -4
  14. package/Common/cpp/reanimated/Events/UIEventHandlerRegistry.cpp +3 -2
  15. package/Common/cpp/reanimated/Events/UIEventHandlerRegistry.h +1 -1
  16. package/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +2 -8
  17. package/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +2 -6
  18. package/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +1 -6
  19. package/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +1 -8
  20. package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +12 -7
  21. package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +6 -3
  22. package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +4 -6
  23. package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +25 -7
  24. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +1 -2
  25. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +1 -1
  26. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +9 -9
  27. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +2 -3
  28. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +21 -21
  29. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +3 -3
  30. package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +3 -3
  31. package/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +24 -20
  32. package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +35 -53
  33. package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +1 -2
  34. package/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +22 -22
  35. package/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +10 -10
  36. package/Common/cpp/reanimated/Tools/ReaJSIUtils.h +5 -5
  37. package/README.md +1 -1
  38. package/android/build.gradle +0 -21
  39. package/android/src/main/cpp/reanimated/android/NativeProxy.cpp +6 -10
  40. package/android/src/main/cpp/reanimated/android/NativeProxy.h +1 -2
  41. package/android/src/main/java/com/swmansion/reanimated/CopiedEvent.java +66 -9
  42. package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +16 -11
  43. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +34 -8
  44. package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NoopEventHandler.java +27 -6
  45. package/apple/reanimated/apple/REANodesManager.mm +0 -8
  46. package/apple/reanimated/apple/ReanimatedModule.mm +6 -12
  47. package/apple/reanimated/apple/native/NativeProxy.h +1 -2
  48. package/apple/reanimated/apple/native/NativeProxy.mm +1 -1
  49. package/compatibility.json +7 -29
  50. package/lib/module/PropsRegistryGarbageCollector.js +3 -0
  51. package/lib/module/PropsRegistryGarbageCollector.js.map +1 -1
  52. package/lib/module/common/style/processors/colors.js +31 -4
  53. package/lib/module/common/style/processors/colors.js.map +1 -1
  54. package/lib/module/common/style/processors/filter.js +103 -61
  55. package/lib/module/common/style/processors/filter.js.map +1 -1
  56. package/lib/module/common/style/processors/font.js +7 -1
  57. package/lib/module/common/style/processors/font.js.map +1 -1
  58. package/lib/module/common/style/processors/insets.js +26 -14
  59. package/lib/module/common/style/processors/insets.js.map +1 -1
  60. package/lib/module/common/style/processors/others.js +15 -5
  61. package/lib/module/common/style/processors/others.js.map +1 -1
  62. package/lib/module/common/style/processors/shadows.js +14 -3
  63. package/lib/module/common/style/processors/shadows.js.map +1 -1
  64. package/lib/module/common/style/processors/transform.js +30 -1
  65. package/lib/module/common/style/processors/transform.js.map +1 -1
  66. package/lib/module/common/style/processors/transformOrigin.js +20 -3
  67. package/lib/module/common/style/processors/transformOrigin.js.map +1 -1
  68. package/lib/module/common/utils/guards.js +27 -7
  69. package/lib/module/common/utils/guards.js.map +1 -1
  70. package/lib/module/common/utils/parsers.js +2 -1
  71. package/lib/module/common/utils/parsers.js.map +1 -1
  72. package/lib/module/createAnimatedComponent/AnimatedComponent.js +1 -7
  73. package/lib/module/createAnimatedComponent/AnimatedComponent.js.map +1 -1
  74. package/lib/module/css/native/managers/CSSManager.js +16 -15
  75. package/lib/module/css/native/managers/CSSManager.js.map +1 -1
  76. package/lib/module/css/native/managers/CSSTransitionsManager.js +47 -44
  77. package/lib/module/css/native/managers/CSSTransitionsManager.js.map +1 -1
  78. package/lib/module/css/native/normalization/transition/config.js +35 -17
  79. package/lib/module/css/native/normalization/transition/config.js.map +1 -1
  80. package/lib/module/css/utils/props.js +6 -0
  81. package/lib/module/css/utils/props.js.map +1 -1
  82. package/lib/module/featureFlags/index.js +1 -1
  83. package/lib/module/featureFlags/staticFlags.json +1 -1
  84. package/lib/module/hook/useAnimatedRef.js +2 -2
  85. package/lib/module/hook/useAnimatedRef.js.map +1 -1
  86. package/lib/module/hook/useAnimatedStyle.js +7 -1
  87. package/lib/module/hook/useAnimatedStyle.js.map +1 -1
  88. package/lib/module/hook/useHandler.js +82 -28
  89. package/lib/module/hook/useHandler.js.map +1 -1
  90. package/lib/module/hook/utils.js +1 -74
  91. package/lib/module/hook/utils.js.map +1 -1
  92. package/lib/module/initializers.js +2 -0
  93. package/lib/module/initializers.js.map +1 -1
  94. package/lib/module/jestUtils/common.js +10 -0
  95. package/lib/module/jestUtils/common.js.map +1 -1
  96. package/lib/module/jestUtils/index.js +2 -5
  97. package/lib/module/jestUtils/index.js.map +1 -1
  98. package/lib/module/jestUtils/index.web.js +1 -1
  99. package/lib/module/jestUtils/index.web.js.map +1 -1
  100. package/lib/module/mutables.js +5 -1
  101. package/lib/module/mutables.js.map +1 -1
  102. package/lib/module/platform-specific/jsVersion.js +1 -1
  103. package/lib/module/platform-specific/jsVersion.js.map +1 -1
  104. package/lib/typescript/PropsRegistryGarbageCollector.d.ts.map +1 -1
  105. package/lib/typescript/common/style/processors/colors.d.ts +3 -3
  106. package/lib/typescript/common/style/processors/colors.d.ts.map +1 -1
  107. package/lib/typescript/common/style/processors/filter.d.ts +0 -4
  108. package/lib/typescript/common/style/processors/filter.d.ts.map +1 -1
  109. package/lib/typescript/common/style/processors/font.d.ts +1 -1
  110. package/lib/typescript/common/style/processors/font.d.ts.map +1 -1
  111. package/lib/typescript/common/style/processors/insets.d.ts.map +1 -1
  112. package/lib/typescript/common/style/processors/others.d.ts +1 -1
  113. package/lib/typescript/common/style/processors/others.d.ts.map +1 -1
  114. package/lib/typescript/common/style/processors/shadows.d.ts.map +1 -1
  115. package/lib/typescript/common/style/processors/transform.d.ts.map +1 -1
  116. package/lib/typescript/common/style/processors/transformOrigin.d.ts +2 -2
  117. package/lib/typescript/common/style/processors/transformOrigin.d.ts.map +1 -1
  118. package/lib/typescript/common/utils/guards.d.ts +0 -1
  119. package/lib/typescript/common/utils/guards.d.ts.map +1 -1
  120. package/lib/typescript/common/utils/parsers.d.ts.map +1 -1
  121. package/lib/typescript/commonTypes.d.ts +1 -1
  122. package/lib/typescript/commonTypes.d.ts.map +1 -1
  123. package/lib/typescript/createAnimatedComponent/AnimatedComponent.d.ts.map +1 -1
  124. package/lib/typescript/css/native/managers/CSSManager.d.ts +7 -1
  125. package/lib/typescript/css/native/managers/CSSManager.d.ts.map +1 -1
  126. package/lib/typescript/css/native/managers/CSSTransitionsManager.d.ts +5 -4
  127. package/lib/typescript/css/native/managers/CSSTransitionsManager.d.ts.map +1 -1
  128. package/lib/typescript/css/native/normalization/transition/config.d.ts.map +1 -1
  129. package/lib/typescript/css/native/types/transition.d.ts +15 -1
  130. package/lib/typescript/css/native/types/transition.d.ts.map +1 -1
  131. package/lib/typescript/css/utils/props.d.ts.map +1 -1
  132. package/lib/typescript/featureFlags/index.d.ts +1 -1
  133. package/lib/typescript/hook/useAnimatedStyle.d.ts.map +1 -1
  134. package/lib/typescript/hook/useHandler.d.ts +8 -9
  135. package/lib/typescript/hook/useHandler.d.ts.map +1 -1
  136. package/lib/typescript/hook/utils.d.ts +0 -5
  137. package/lib/typescript/hook/utils.d.ts.map +1 -1
  138. package/lib/typescript/jestUtils/common.d.ts +2 -0
  139. package/lib/typescript/jestUtils/common.d.ts.map +1 -1
  140. package/lib/typescript/jestUtils/index.d.ts +4 -3
  141. package/lib/typescript/jestUtils/index.d.ts.map +1 -1
  142. package/lib/typescript/mutables.d.ts.map +1 -1
  143. package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
  144. package/lib/typescript/platform-specific/jsVersion.d.ts.map +1 -1
  145. package/package.json +13 -10
  146. package/src/PropsRegistryGarbageCollector.ts +3 -0
  147. package/src/common/style/processors/colors.ts +20 -7
  148. package/src/common/style/processors/filter.ts +95 -70
  149. package/src/common/style/processors/font.ts +5 -2
  150. package/src/common/style/processors/insets.ts +23 -14
  151. package/src/common/style/processors/others.ts +12 -6
  152. package/src/common/style/processors/shadows.ts +10 -6
  153. package/src/common/style/processors/transform.ts +15 -1
  154. package/src/common/style/processors/transformOrigin.ts +40 -11
  155. package/src/common/utils/guards.ts +21 -16
  156. package/src/common/utils/parsers.ts +1 -1
  157. package/src/commonTypes.ts +1 -1
  158. package/src/createAnimatedComponent/AnimatedComponent.tsx +1 -7
  159. package/src/css/native/managers/CSSManager.ts +29 -14
  160. package/src/css/native/managers/CSSTransitionsManager.ts +52 -54
  161. package/src/css/native/normalization/transition/config.ts +35 -27
  162. package/src/css/native/types/transition.ts +15 -1
  163. package/src/css/utils/props.ts +7 -0
  164. package/src/featureFlags/index.ts +1 -1
  165. package/src/featureFlags/staticFlags.json +1 -1
  166. package/src/hook/useAnimatedRef.ts +2 -2
  167. package/src/hook/useAnimatedStyle.ts +15 -6
  168. package/src/hook/useHandler.ts +150 -64
  169. package/src/hook/utils.ts +1 -127
  170. package/src/initializers.ts +1 -0
  171. package/src/jestUtils/common.ts +10 -0
  172. package/src/jestUtils/index.ts +5 -8
  173. package/src/jestUtils/index.web.ts +1 -1
  174. package/src/mutables.ts +5 -1
  175. package/src/platform-specific/jsVersion.ts +1 -1
  176. package/src/privateGlobals.d.ts +4 -0
@@ -32,7 +32,7 @@ std::optional<MountingTransaction> LayoutAnimationsProxy_Experimental::pullTrans
32
32
  ShadowViewMutationList filteredMutations;
33
33
  auto rootChildCount = static_cast<int>(lightNodes_[surfaceId]->children.size());
34
34
  const std::vector<std::shared_ptr<MutationNode>> roots;
35
- const bool isInTransition = transitionState_;
35
+ const bool isInTransition = static_cast<bool>(transitionState_);
36
36
 
37
37
  if (isInTransition) {
38
38
  updateLightTree(propsParserContext, mutations, filteredMutations);
@@ -538,7 +538,7 @@ void LayoutAnimationsProxy_Experimental::maybeCancelAnimation(const int tag) con
538
538
  return;
539
539
  }
540
540
  layoutAnimations_.erase(tag);
541
- uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), tag]() {
541
+ scheduleOnUI(uiScheduler_, [weakThis = weak_from_this(), tag]() {
542
542
  auto strongThis = weakThis.lock();
543
543
  if (!strongThis) {
544
544
  return;
@@ -679,8 +679,8 @@ void LayoutAnimationsProxy_Experimental::startEnteringAnimation(const std::share
679
679
  react_native_assert(parent && "Parent node is nullptr");
680
680
  const auto parentTag = parent->current.tag;
681
681
 
682
- uiScheduler_->scheduleOnUI(
683
- [weakThis = weak_from_this(), finalView, currentView, newChildShadowView, parentTag, opacity]() {
682
+ scheduleOnUI(
683
+ uiScheduler_, [weakThis = weak_from_this(), finalView, currentView, newChildShadowView, parentTag, opacity]() {
684
684
  auto strongThis = weakThis.lock();
685
685
  if (!strongThis) {
686
686
  return;
@@ -724,7 +724,7 @@ void LayoutAnimationsProxy_Experimental::startExitingAnimation(const std::shared
724
724
  react_native_assert(parent && "Parent node is nullptr");
725
725
  const auto parentTag = parent->current.tag;
726
726
 
727
- uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), tag, parentTag, oldChildShadowView, surfaceId]() {
727
+ scheduleOnUI(uiScheduler_, [weakThis = weak_from_this(), tag, parentTag, oldChildShadowView, surfaceId]() {
728
728
  auto strongThis = weakThis.lock();
729
729
  if (!strongThis) {
730
730
  return;
@@ -766,8 +766,8 @@ void LayoutAnimationsProxy_Experimental::startLayoutAnimation(const std::shared_
766
766
  react_native_assert(parent && "Parent node is nullptr");
767
767
  const auto parentTag = parent->current.tag;
768
768
 
769
- uiScheduler_->scheduleOnUI(
770
- [weakThis = weak_from_this(), surfaceId, oldChildShadowView, newChildShadowView, parentTag, tag]() {
769
+ scheduleOnUI(
770
+ uiScheduler_, [weakThis = weak_from_this(), surfaceId, oldChildShadowView, newChildShadowView, parentTag, tag]() {
771
771
  auto strongThis = weakThis.lock();
772
772
  if (!strongThis) {
773
773
  return;
@@ -811,7 +811,7 @@ void LayoutAnimationsProxy_Experimental::startSharedTransition(
811
811
  const ShadowView &before,
812
812
  const ShadowView &after,
813
813
  SurfaceId surfaceId) const {
814
- uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), before, after, surfaceId, tag]() {
814
+ scheduleOnUI(uiScheduler_, [weakThis = weak_from_this(), before, after, surfaceId, tag]() {
815
815
  auto strongThis = weakThis.lock();
816
816
  if (!strongThis) {
817
817
  return;
@@ -844,7 +844,7 @@ void LayoutAnimationsProxy_Experimental::startProgressTransition(
844
844
  const ShadowView &before,
845
845
  const ShadowView &after,
846
846
  SurfaceId surfaceId) const {
847
- uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), before, after, surfaceId]() {
847
+ scheduleOnUI(uiScheduler_, [weakThis = weak_from_this(), before, after, surfaceId]() {
848
848
  auto strongThis = weakThis.lock();
849
849
  if (!strongThis) {
850
850
  return;
@@ -1,12 +1,11 @@
1
1
  #pragma once
2
2
 
3
+ #include <reanimated/Compat/WorkletsApi.h>
3
4
  #include <reanimated/LayoutAnimations/LayoutAnimationsManager.h>
4
5
  #include <reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h>
5
6
  #include <reanimated/LayoutAnimations/LayoutAnimationsUtils.h>
6
7
  #include <reanimated/Tools/PlatformDepMethodsHolder.h>
7
8
 
8
- #include <worklets/Tools/UIScheduler.h>
9
-
10
9
  #include <react/renderer/componentregistry/ComponentDescriptorFactory.h>
11
10
  #include <react/renderer/graphics/Transform.h>
12
11
  #include <react/renderer/mounting/MountingOverrideDelegate.h>
@@ -44,7 +43,7 @@ struct LayoutAnimationsProxy_Experimental : public LayoutAnimationsProxyCommon,
44
43
  mutable Tag transitionTag_;
45
44
  mutable double transitionProgress_;
46
45
  mutable bool transitionUpdated_;
47
- mutable TransitionState transitionState_ = NONE;
46
+ mutable TransitionState transitionState_ = TransitionState::NONE;
48
47
  mutable SurfaceId transitioningSurfaceId_ = -1;
49
48
  mutable std::unordered_map<SurfaceId, std::shared_ptr<LightNode>> topScreen;
50
49
  mutable int containerTag_ = 10000002;
@@ -124,7 +124,7 @@ std::optional<SurfaceId> LayoutAnimationsProxy_Legacy::endLayoutAnimation(int ta
124
124
 
125
125
  auto node = nodeForTag_[tag];
126
126
  auto mutationNode = std::static_pointer_cast<MutationNode>(node);
127
- mutationNode->state = DEAD;
127
+ mutationNode->state = ExitingState_Legacy::DEAD;
128
128
  auto &[deadNodes] = surfaceContext_[surfaceId];
129
129
  deadNodes.insert(mutationNode);
130
130
 
@@ -172,7 +172,7 @@ void LayoutAnimationsProxy_Legacy::parseRemoveMutations(
172
172
  }
173
173
  }
174
174
  if (!deletedViews.contains(mutation.oldChildShadowView.tag)) {
175
- mutationNode->state = MOVED;
175
+ mutationNode->state = ExitingState_Legacy::MOVED;
176
176
  movedViews.insert_or_assign(mutation.oldChildShadowView.tag, -1);
177
177
  }
178
178
  nodeForTag_[tag] = mutationNode;
@@ -245,11 +245,11 @@ void LayoutAnimationsProxy_Legacy::handleRemovals(
245
245
  if (!startAnimationsRecursively(node, true, shouldAnimate, false, filteredMutations)) {
246
246
  filteredMutations.push_back(node->mutation);
247
247
  node->unflattenedParent->removeChildFromUnflattenedTree(node); //???
248
- if (node->state != MOVED) {
248
+ if (node->state != ExitingState_Legacy::MOVED) {
249
249
  maybeCancelAnimation(node->tag);
250
250
  filteredMutations.push_back(ShadowViewMutation::DeleteMutation(node->mutation.oldChildShadowView));
251
251
  nodeForTag_.erase(node->tag);
252
- node->state = DELETED;
252
+ node->state = ExitingState_Legacy::DELETED;
253
253
  #ifdef LAYOUT_ANIMATIONS_LOGS
254
254
  LOG(INFO) << "delete " << node->tag << std::endl;
255
255
  #endif
@@ -258,7 +258,7 @@ void LayoutAnimationsProxy_Legacy::handleRemovals(
258
258
  }
259
259
 
260
260
  for (const auto &node : deadNodes) {
261
- if (node->state != DELETED) {
261
+ if (node->state != ExitingState_Legacy::DELETED) {
262
262
  endAnimationsRecursively(node, filteredMutations);
263
263
  maybeDropAncestors(node->unflattenedParent, node, filteredMutations);
264
264
  }
@@ -429,12 +429,12 @@ void LayoutAnimationsProxy_Legacy::endAnimationsRecursively(
429
429
  const std::shared_ptr<MutationNode> &node,
430
430
  ShadowViewMutationList &mutations) const {
431
431
  maybeCancelAnimation(node->tag);
432
- node->state = DELETED;
432
+ node->state = ExitingState_Legacy::DELETED;
433
433
  // iterate from the end, so that children
434
434
  // with higher indices appear first in the mutations list
435
435
  for (auto it = node->unflattenedChildren.rbegin(); it != node->unflattenedChildren.rend(); it++) {
436
436
  auto &subNode = *it;
437
- if (subNode->state != DELETED) {
437
+ if (subNode->state != ExitingState_Legacy::DELETED) {
438
438
  endAnimationsRecursively(subNode, mutations);
439
439
  }
440
440
  }
@@ -457,11 +457,11 @@ void LayoutAnimationsProxy_Legacy::maybeDropAncestors(
457
457
 
458
458
  auto node = std::static_pointer_cast<MutationNode>(parent);
459
459
 
460
- if (node->children.size() == 0 && node->state != ANIMATING) {
460
+ if (node->children.size() == 0 && node->state != ExitingState_Legacy::ANIMATING) {
461
461
  nodeForTag_.erase(node->tag);
462
462
  cleanupMutations.push_back(node->mutation);
463
463
  maybeCancelAnimation(node->tag);
464
- node->state = DELETED;
464
+ node->state = ExitingState_Legacy::DELETED;
465
465
  #ifdef LAYOUT_ANIMATIONS_LOGS
466
466
  LOG(INFO) << "delete " << node->tag << std::endl;
467
467
  #endif
@@ -492,7 +492,7 @@ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
492
492
  bool hasAnimatedChildren = false;
493
493
 
494
494
  shouldRemoveSubviewsWithoutAnimations =
495
- shouldRemoveSubviewsWithoutAnimations && (!hasExitAnimation || node->state == MOVED);
495
+ shouldRemoveSubviewsWithoutAnimations && (!hasExitAnimation || node->state == ExitingState_Legacy::MOVED);
496
496
  std::vector<std::shared_ptr<MutationNode>> toBeRemoved;
497
497
 
498
498
  // iterate from the end, so that children
@@ -503,8 +503,8 @@ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
503
503
  LOG(INFO) << "child " << subNode->tag << " "
504
504
  << " " << shouldAnimate << " " << shouldRemoveSubviewsWithoutAnimations << std::endl;
505
505
  #endif
506
- if (subNode->state != UNDEFINED && subNode->state != MOVED) {
507
- if (shouldAnimate && subNode->state != DEAD) {
506
+ if (subNode->state != ExitingState_Legacy::UNDEFINED && subNode->state != ExitingState_Legacy::MOVED) {
507
+ if (shouldAnimate && subNode->state != ExitingState_Legacy::DEAD) {
508
508
  hasAnimatedChildren = true;
509
509
  } else {
510
510
  endAnimationsRecursively(subNode, mutations);
@@ -516,21 +516,21 @@ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
516
516
  LOG(INFO) << "child " << subNode->tag << " start animations returned true " << std::endl;
517
517
  #endif
518
518
  hasAnimatedChildren = true;
519
- } else if (subNode->state == MOVED) {
519
+ } else if (subNode->state == ExitingState_Legacy::MOVED) {
520
520
  mutations.push_back(subNode->mutation);
521
521
  toBeRemoved.push_back(subNode);
522
522
  } else if (shouldRemoveSubviewsWithoutAnimations) {
523
523
  maybeCancelAnimation(subNode->tag);
524
524
  mutations.push_back(subNode->mutation);
525
525
  toBeRemoved.push_back(subNode);
526
- subNode->state = DELETED;
526
+ subNode->state = ExitingState_Legacy::DELETED;
527
527
  nodeForTag_.erase(subNode->tag);
528
528
  #ifdef LAYOUT_ANIMATIONS_LOGS
529
529
  LOG(INFO) << "delete " << subNode->tag << std::endl;
530
530
  #endif
531
531
  mutations.push_back(ShadowViewMutation::DeleteMutation(subNode->mutation.oldChildShadowView));
532
532
  } else {
533
- subNode->state = WAITING;
533
+ subNode->state = ExitingState_Legacy::WAITING;
534
534
  }
535
535
  }
536
536
 
@@ -538,7 +538,7 @@ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
538
538
  node->removeChildFromUnflattenedTree(subNode);
539
539
  }
540
540
 
541
- if (node->state == MOVED) {
541
+ if (node->state == ExitingState_Legacy::MOVED) {
542
542
  auto replacement = std::make_shared<Node>(*node);
543
543
  for (const auto &subNode : node->children) {
544
544
  subNode->parent = replacement;
@@ -553,7 +553,7 @@ bool LayoutAnimationsProxy_Legacy::startAnimationsRecursively(
553
553
  bool wantAnimateExit = hasExitAnimation || hasAnimatedChildren;
554
554
 
555
555
  if (hasExitAnimation) {
556
- node->state = ANIMATING;
556
+ node->state = ExitingState_Legacy::ANIMATING;
557
557
  startExitingAnimation(node->tag, node->mutation);
558
558
  } else {
559
559
  layoutAnimationsManager_->clearLayoutAnimationConfig(node->tag);
@@ -636,7 +636,7 @@ void LayoutAnimationsProxy_Legacy::startEnteringAnimation(const int tag, ShadowV
636
636
  auto &viewProps = static_cast<const ViewProps &>(*mutation.newChildShadowView.props);
637
637
  auto opacity = viewProps.opacity;
638
638
 
639
- uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), finalView, current, mutation, opacity, tag]() {
639
+ scheduleOnUI(uiScheduler_, [weakThis = weak_from_this(), finalView, current, mutation, opacity, tag]() {
640
640
  auto strongThis = weakThis.lock();
641
641
  if (!strongThis) {
642
642
  return;
@@ -675,7 +675,7 @@ void LayoutAnimationsProxy_Legacy::startExitingAnimation(const int tag, ShadowVi
675
675
  #endif
676
676
  auto surfaceId = mutation.oldChildShadowView.surfaceId;
677
677
 
678
- uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), tag, mutation, surfaceId]() {
678
+ scheduleOnUI(uiScheduler_, [weakThis = weak_from_this(), tag, mutation, surfaceId]() {
679
679
  auto strongThis = weakThis.lock();
680
680
  if (!strongThis) {
681
681
  return;
@@ -714,7 +714,7 @@ void LayoutAnimationsProxy_Legacy::startLayoutAnimation(const int tag, const Sha
714
714
  #endif
715
715
  auto surfaceId = mutation.oldChildShadowView.surfaceId;
716
716
 
717
- uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), mutation, surfaceId, tag]() {
717
+ scheduleOnUI(uiScheduler_, [weakThis = weak_from_this(), mutation, surfaceId, tag]() {
718
718
  auto strongThis = weakThis.lock();
719
719
  if (!strongThis) {
720
720
  return;
@@ -763,7 +763,7 @@ void LayoutAnimationsProxy_Legacy::maybeCancelAnimation(const int tag) const {
763
763
  return;
764
764
  }
765
765
  layoutAnimations_.erase(tag);
766
- uiScheduler_->scheduleOnUI([weakThis = weak_from_this(), tag]() {
766
+ scheduleOnUI(uiScheduler_, [weakThis = weak_from_this(), tag]() {
767
767
  auto strongThis = weakThis.lock();
768
768
  if (!strongThis) {
769
769
  return;
@@ -5,11 +5,11 @@
5
5
  #include <react/renderer/scheduler/Scheduler.h>
6
6
  #include <react/renderer/uimanager/UIManagerAnimationDelegate.h>
7
7
  #include <react/renderer/uimanager/UIManagerBinding.h>
8
+ #include <reanimated/Compat/WorkletsApi.h>
8
9
  #include <reanimated/LayoutAnimations/LayoutAnimationsManager.h>
9
10
  #include <reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h>
10
11
  #include <reanimated/LayoutAnimations/LayoutAnimationsUtils.h>
11
12
  #include <reanimated/Tools/PlatformDepMethodsHolder.h>
12
- #include <worklets/Tools/UIScheduler.h>
13
13
 
14
14
  #include <memory>
15
15
  #include <string>
@@ -24,7 +24,7 @@ class ReanimatedModuleProxy;
24
24
 
25
25
  using namespace facebook;
26
26
 
27
- typedef enum ExitingState_Legacy : std::uint8_t {
27
+ typedef enum class ExitingState_Legacy : std::uint8_t {
28
28
  UNDEFINED = 1,
29
29
  WAITING = 2,
30
30
  ANIMATING = 4,
@@ -60,7 +60,7 @@ struct Node {
60
60
  */
61
61
  struct MutationNode : public Node {
62
62
  ShadowViewMutation mutation;
63
- ExitingState_Legacy state = UNDEFINED;
63
+ ExitingState_Legacy state = ExitingState_Legacy::UNDEFINED;
64
64
  explicit MutationNode(ShadowViewMutation &mutation) : Node(mutation.oldChildShadowView.tag), mutation(mutation) {}
65
65
  MutationNode(ShadowViewMutation &mutation, Node &&node) : Node(std::move(node)), mutation(mutation) {}
66
66
  bool isMutationNode() override;
@@ -13,7 +13,7 @@
13
13
 
14
14
  namespace reanimated {
15
15
 
16
- enum BeforeOrAfter : std::uint8_t { BEFORE = 0, AFTER = 1 };
16
+ enum BeforeOrAfter : std::uint8_t { BEFORE = 0, AFTER = 1 }; // NOLINT
17
17
 
18
18
  struct Rect {
19
19
  double width, height;
@@ -66,7 +66,7 @@ typedef enum class ExitingState : std::uint8_t {
66
66
 
67
67
  struct MutationNode;
68
68
 
69
- enum TransitionState : std::uint8_t {
69
+ enum class TransitionState : std::uint8_t {
70
70
  NONE = 0,
71
71
  START = 1,
72
72
  ACTIVE = 2,
@@ -74,7 +74,7 @@ enum TransitionState : std::uint8_t {
74
74
  CANCELLED = 4,
75
75
  };
76
76
 
77
- enum Intent : std::uint8_t {
77
+ enum class Intent : std::uint8_t {
78
78
  NO_INTENT = 0,
79
79
  TO_MOVE = 1,
80
80
  TO_DELETE = 2,
@@ -1,5 +1,6 @@
1
1
  #include <react/renderer/components/scrollview/ScrollViewState.h>
2
2
  #include <reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h>
3
+ #include <reanimated/LayoutAnimations/LayoutAnimationsUtils.h>
3
4
  #include <reanimated/Tools/ReanimatedSystraceSection.h>
4
5
  #ifndef ANDROID
5
6
  #if __has_include(<react/renderer/components/rnscreens/Props.h>)
@@ -62,9 +63,11 @@ void LayoutAnimationsProxy_Experimental::findSharedElementsOnScreen(
62
63
  auto newTransform = parseParentTransforms(node, absolutePositions);
63
64
  const auto &parent = node->parent.lock();
64
65
  react_native_assert(parent && "Parent node is nullptr");
65
- transform[index] = std::move(newTransform);
66
- snapshot[index] = copy;
67
- parentTag[index] = parent->current.tag;
66
+
67
+ int indexNum = static_cast<int>(index);
68
+ transform[indexNum] = std::move(newTransform);
69
+ snapshot[indexNum] = copy;
70
+ parentTag[indexNum] = parent->current.tag;
68
71
 
69
72
  if (parentTag[BEFORE] && parentTag[AFTER]) {
70
73
  transitions_.emplace_back(sharedTag, transition);
@@ -88,11 +91,11 @@ void LayoutAnimationsProxy_Experimental::handleProgressTransition(
88
91
  }
89
92
  transitionUpdated_ = false;
90
93
 
91
- if (!mutations.empty() || !transitionState_) {
94
+ if (!mutations.empty() || !static_cast<bool>(transitionState_)) {
92
95
  return;
93
96
  }
94
97
 
95
- if (transitionState_ == START) {
98
+ if (transitionState_ == TransitionState::START) {
96
99
  auto root = lightNodes_[surfaceId];
97
100
  auto beforeTopScreen = topScreen[surfaceId];
98
101
  auto afterTopScreen = lightNodes_[transitionTag_];
@@ -119,7 +122,7 @@ void LayoutAnimationsProxy_Experimental::handleProgressTransition(
119
122
  startProgressTransition(containerTag, before, after, surfaceId);
120
123
  }
121
124
  }
122
- } else if (transitionState_ == ACTIVE) {
125
+ } else if (transitionState_ == TransitionState::ACTIVE) {
123
126
  for (auto tag : activeTransitions_) {
124
127
  auto layoutAnimation = layoutAnimations_[tag];
125
128
  auto &updateMap = surfaceManager.getUpdateMap(layoutAnimation.finalView.surfaceId);
@@ -153,23 +156,23 @@ void LayoutAnimationsProxy_Experimental::handleProgressTransition(
153
156
  }
154
157
  }
155
158
 
156
- if (transitionState_ == START) {
157
- transitionState_ = ACTIVE;
158
- } else if (transitionState_ == END || transitionState_ == CANCELLED) {
159
+ if (transitionState_ == TransitionState::START) {
160
+ transitionState_ = TransitionState::ACTIVE;
161
+ } else if (transitionState_ == TransitionState::END || transitionState_ == TransitionState::CANCELLED) {
159
162
  for (auto tag : activeTransitions_) {
160
163
  sharedContainersToRemove_.push_back(tag);
161
164
  tagsToRestore_.push_back(restoreMap_[tag][AFTER]);
162
- if (transitionState_ == CANCELLED) {
165
+ if (transitionState_ == TransitionState::CANCELLED) {
163
166
  tagsToRestore_.push_back(restoreMap_[tag][BEFORE]);
164
167
  }
165
168
  }
166
- if (transitionState_ == END) {
169
+ if (transitionState_ == TransitionState::END) {
167
170
  topScreen[surfaceId] = lightNodes_[transitionTag_];
168
171
  synchronized_ = false;
169
172
  }
170
173
  sharedTransitionManager_->containerTags_.clear();
171
174
  activeTransitions_.clear();
172
- transitionState_ = NONE;
175
+ transitionState_ = TransitionState::NONE;
173
176
  }
174
177
  }
175
178
 
@@ -278,8 +281,9 @@ void LayoutAnimationsProxy_Experimental::hideTransitioningViews(
278
281
  ShadowViewMutationList &filteredMutations,
279
282
  const PropsParserContext &propsParserContext) const {
280
283
  for (auto &[sharedTag, transition] : transitions_) {
281
- const auto &shadowView = transition.snapshot[index];
282
- const auto &parentTag = transition.parentTag[index];
284
+ int indexNum = static_cast<int>(index);
285
+ const auto &shadowView = transition.snapshot[indexNum];
286
+ const auto &parentTag = transition.parentTag[indexNum];
283
287
  auto m = ShadowViewMutation::UpdateMutation(
284
288
  shadowView, cloneViewWithoutOpacity(shadowView, propsParserContext), parentTag);
285
289
  filteredMutations.push_back(m);
@@ -303,11 +307,11 @@ std::optional<SurfaceId> LayoutAnimationsProxy_Experimental::onTransitionProgres
303
307
  // transitions (maybe that's ok?)
304
308
  if (!isClosing && !isGoingForward && !isAndroid) {
305
309
  transitionProgress_ = progress;
306
- if (transitionState_ == NONE && progress < 1) {
307
- transitionState_ = START;
310
+ if (transitionState_ == TransitionState::NONE && progress < 1) {
311
+ transitionState_ = TransitionState::START;
308
312
  transitionTag_ = tag;
309
- } else if (transitionState_ == ACTIVE && progress == 1) {
310
- transitionState_ = END;
313
+ } else if (transitionState_ == TransitionState::ACTIVE && progress == 1) {
314
+ transitionState_ = TransitionState::END;
311
315
  }
312
316
  const auto &node = lightNodes_[tag];
313
317
  react_native_assert(node && "LightNode is nullptr");
@@ -320,8 +324,8 @@ std::optional<SurfaceId> LayoutAnimationsProxy_Experimental::onTransitionProgres
320
324
 
321
325
  std::optional<SurfaceId> LayoutAnimationsProxy_Experimental::onGestureCancel() {
322
326
  auto lock = std::unique_lock<std::recursive_mutex>(mutex);
323
- if (transitionState_) {
324
- transitionState_ = CANCELLED;
327
+ if (static_cast<bool>(transitionState_)) {
328
+ transitionState_ = TransitionState::CANCELLED;
325
329
  transitionUpdated_ = true;
326
330
  react_native_assert(transitioningSurfaceId_ != -1 && "Cancelling non-observed transition");
327
331