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.
- package/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.cpp +8 -5
- package/Common/cpp/reanimated/AnimatedSensor/AnimatedSensorModule.h +3 -5
- package/Common/cpp/reanimated/CSS/common/values/CSSValueVariant.cpp +2 -3
- package/Common/cpp/reanimated/CSS/interpolation/PropertyInterpolator.cpp +2 -3
- package/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.cpp +7 -3
- package/Common/cpp/reanimated/CSS/registries/CSSAnimationsRegistry.h +9 -2
- package/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.cpp +6 -2
- package/Common/cpp/reanimated/CSS/registries/CSSTransitionsRegistry.h +8 -2
- package/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.cpp +2 -2
- package/Common/cpp/reanimated/CSS/utils/DelayedItemsManager.h +2 -2
- package/Common/cpp/reanimated/Compat/WorkletsApi.h +13 -0
- package/Common/cpp/reanimated/Events/UIEventHandler.cpp +1 -1
- package/Common/cpp/reanimated/Events/UIEventHandler.h +3 -4
- package/Common/cpp/reanimated/Events/UIEventHandlerRegistry.cpp +3 -2
- package/Common/cpp/reanimated/Events/UIEventHandlerRegistry.h +1 -1
- package/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.cpp +2 -8
- package/Common/cpp/reanimated/Fabric/ReanimatedCommitHook.h +2 -6
- package/Common/cpp/reanimated/Fabric/ReanimatedMountHook.cpp +1 -6
- package/Common/cpp/reanimated/Fabric/ReanimatedMountHook.h +1 -8
- package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.cpp +12 -7
- package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +6 -3
- package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.cpp +4 -6
- package/Common/cpp/reanimated/Fabric/updates/UpdatesRegistry.h +25 -7
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsManager.h +1 -2
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxyCommon.h +1 -1
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.cpp +9 -9
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Experimental.h +2 -3
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +21 -21
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +3 -3
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsUtils.h +3 -3
- package/Common/cpp/reanimated/LayoutAnimations/SharedTransitions.cpp +24 -20
- package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +35 -53
- package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.h +1 -2
- package/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.cpp +22 -22
- package/Common/cpp/reanimated/RuntimeDecorators/UIRuntimeDecorator.h +10 -10
- package/Common/cpp/reanimated/Tools/ReaJSIUtils.h +5 -5
- package/README.md +1 -1
- package/android/build.gradle +0 -21
- package/android/src/main/cpp/reanimated/android/NativeProxy.cpp +6 -10
- package/android/src/main/cpp/reanimated/android/NativeProxy.h +1 -2
- package/android/src/main/java/com/swmansion/reanimated/CopiedEvent.java +66 -9
- package/android/src/main/java/com/swmansion/reanimated/NodesManager.java +16 -11
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/EventHandler.java +34 -8
- package/android/src/main/java/com/swmansion/reanimated/nativeProxy/NoopEventHandler.java +27 -6
- package/apple/reanimated/apple/REANodesManager.mm +0 -8
- package/apple/reanimated/apple/ReanimatedModule.mm +6 -12
- package/apple/reanimated/apple/native/NativeProxy.h +1 -2
- package/apple/reanimated/apple/native/NativeProxy.mm +1 -1
- package/compatibility.json +7 -29
- package/lib/module/PropsRegistryGarbageCollector.js +3 -0
- package/lib/module/PropsRegistryGarbageCollector.js.map +1 -1
- package/lib/module/common/style/processors/colors.js +31 -4
- package/lib/module/common/style/processors/colors.js.map +1 -1
- package/lib/module/common/style/processors/filter.js +103 -61
- package/lib/module/common/style/processors/filter.js.map +1 -1
- package/lib/module/common/style/processors/font.js +7 -1
- package/lib/module/common/style/processors/font.js.map +1 -1
- package/lib/module/common/style/processors/insets.js +26 -14
- package/lib/module/common/style/processors/insets.js.map +1 -1
- package/lib/module/common/style/processors/others.js +15 -5
- package/lib/module/common/style/processors/others.js.map +1 -1
- package/lib/module/common/style/processors/shadows.js +14 -3
- package/lib/module/common/style/processors/shadows.js.map +1 -1
- package/lib/module/common/style/processors/transform.js +30 -1
- package/lib/module/common/style/processors/transform.js.map +1 -1
- package/lib/module/common/style/processors/transformOrigin.js +20 -3
- package/lib/module/common/style/processors/transformOrigin.js.map +1 -1
- package/lib/module/common/utils/guards.js +27 -7
- package/lib/module/common/utils/guards.js.map +1 -1
- package/lib/module/common/utils/parsers.js +2 -1
- package/lib/module/common/utils/parsers.js.map +1 -1
- package/lib/module/createAnimatedComponent/AnimatedComponent.js +1 -7
- package/lib/module/createAnimatedComponent/AnimatedComponent.js.map +1 -1
- package/lib/module/css/native/managers/CSSManager.js +16 -15
- package/lib/module/css/native/managers/CSSManager.js.map +1 -1
- package/lib/module/css/native/managers/CSSTransitionsManager.js +47 -44
- package/lib/module/css/native/managers/CSSTransitionsManager.js.map +1 -1
- package/lib/module/css/native/normalization/transition/config.js +35 -17
- package/lib/module/css/native/normalization/transition/config.js.map +1 -1
- package/lib/module/css/utils/props.js +6 -0
- package/lib/module/css/utils/props.js.map +1 -1
- package/lib/module/featureFlags/index.js +1 -1
- package/lib/module/featureFlags/staticFlags.json +1 -1
- package/lib/module/hook/useAnimatedRef.js +2 -2
- package/lib/module/hook/useAnimatedRef.js.map +1 -1
- package/lib/module/hook/useAnimatedStyle.js +7 -1
- package/lib/module/hook/useAnimatedStyle.js.map +1 -1
- package/lib/module/hook/useHandler.js +82 -28
- package/lib/module/hook/useHandler.js.map +1 -1
- package/lib/module/hook/utils.js +1 -74
- package/lib/module/hook/utils.js.map +1 -1
- package/lib/module/initializers.js +2 -0
- package/lib/module/initializers.js.map +1 -1
- package/lib/module/jestUtils/common.js +10 -0
- package/lib/module/jestUtils/common.js.map +1 -1
- package/lib/module/jestUtils/index.js +2 -5
- package/lib/module/jestUtils/index.js.map +1 -1
- package/lib/module/jestUtils/index.web.js +1 -1
- package/lib/module/jestUtils/index.web.js.map +1 -1
- package/lib/module/mutables.js +5 -1
- package/lib/module/mutables.js.map +1 -1
- package/lib/module/platform-specific/jsVersion.js +1 -1
- package/lib/module/platform-specific/jsVersion.js.map +1 -1
- package/lib/typescript/PropsRegistryGarbageCollector.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/colors.d.ts +3 -3
- package/lib/typescript/common/style/processors/colors.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/filter.d.ts +0 -4
- package/lib/typescript/common/style/processors/filter.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/font.d.ts +1 -1
- package/lib/typescript/common/style/processors/font.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/insets.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/others.d.ts +1 -1
- package/lib/typescript/common/style/processors/others.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/shadows.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/transform.d.ts.map +1 -1
- package/lib/typescript/common/style/processors/transformOrigin.d.ts +2 -2
- package/lib/typescript/common/style/processors/transformOrigin.d.ts.map +1 -1
- package/lib/typescript/common/utils/guards.d.ts +0 -1
- package/lib/typescript/common/utils/guards.d.ts.map +1 -1
- package/lib/typescript/common/utils/parsers.d.ts.map +1 -1
- package/lib/typescript/commonTypes.d.ts +1 -1
- package/lib/typescript/commonTypes.d.ts.map +1 -1
- package/lib/typescript/createAnimatedComponent/AnimatedComponent.d.ts.map +1 -1
- package/lib/typescript/css/native/managers/CSSManager.d.ts +7 -1
- package/lib/typescript/css/native/managers/CSSManager.d.ts.map +1 -1
- package/lib/typescript/css/native/managers/CSSTransitionsManager.d.ts +5 -4
- package/lib/typescript/css/native/managers/CSSTransitionsManager.d.ts.map +1 -1
- package/lib/typescript/css/native/normalization/transition/config.d.ts.map +1 -1
- package/lib/typescript/css/native/types/transition.d.ts +15 -1
- package/lib/typescript/css/native/types/transition.d.ts.map +1 -1
- package/lib/typescript/css/utils/props.d.ts.map +1 -1
- package/lib/typescript/featureFlags/index.d.ts +1 -1
- package/lib/typescript/hook/useAnimatedStyle.d.ts.map +1 -1
- package/lib/typescript/hook/useHandler.d.ts +8 -9
- package/lib/typescript/hook/useHandler.d.ts.map +1 -1
- package/lib/typescript/hook/utils.d.ts +0 -5
- package/lib/typescript/hook/utils.d.ts.map +1 -1
- package/lib/typescript/jestUtils/common.d.ts +2 -0
- package/lib/typescript/jestUtils/common.d.ts.map +1 -1
- package/lib/typescript/jestUtils/index.d.ts +4 -3
- package/lib/typescript/jestUtils/index.d.ts.map +1 -1
- package/lib/typescript/mutables.d.ts.map +1 -1
- package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
- package/lib/typescript/platform-specific/jsVersion.d.ts.map +1 -1
- package/package.json +13 -10
- package/src/PropsRegistryGarbageCollector.ts +3 -0
- package/src/common/style/processors/colors.ts +20 -7
- package/src/common/style/processors/filter.ts +95 -70
- package/src/common/style/processors/font.ts +5 -2
- package/src/common/style/processors/insets.ts +23 -14
- package/src/common/style/processors/others.ts +12 -6
- package/src/common/style/processors/shadows.ts +10 -6
- package/src/common/style/processors/transform.ts +15 -1
- package/src/common/style/processors/transformOrigin.ts +40 -11
- package/src/common/utils/guards.ts +21 -16
- package/src/common/utils/parsers.ts +1 -1
- package/src/commonTypes.ts +1 -1
- package/src/createAnimatedComponent/AnimatedComponent.tsx +1 -7
- package/src/css/native/managers/CSSManager.ts +29 -14
- package/src/css/native/managers/CSSTransitionsManager.ts +52 -54
- package/src/css/native/normalization/transition/config.ts +35 -27
- package/src/css/native/types/transition.ts +15 -1
- package/src/css/utils/props.ts +7 -0
- package/src/featureFlags/index.ts +1 -1
- package/src/featureFlags/staticFlags.json +1 -1
- package/src/hook/useAnimatedRef.ts +2 -2
- package/src/hook/useAnimatedStyle.ts +15 -6
- package/src/hook/useHandler.ts +150 -64
- package/src/hook/utils.ts +1 -127
- package/src/initializers.ts +1 -0
- package/src/jestUtils/common.ts +10 -0
- package/src/jestUtils/index.ts +5 -8
- package/src/jestUtils/index.web.ts +1 -1
- package/src/mutables.ts +5 -1
- package/src/platform-specific/jsVersion.ts +1 -1
- 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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
|
|
282
|
-
const auto &
|
|
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
|
|