react-native-reanimated 4.3.2 → 4.3.3
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/Fabric/updates/AnimatedPropsRegistry.cpp +48 -23
- package/Common/cpp/reanimated/Fabric/updates/AnimatedPropsRegistry.h +13 -6
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.cpp +40 -0
- package/Common/cpp/reanimated/LayoutAnimations/LayoutAnimationsProxy_Legacy.h +4 -0
- package/Common/cpp/reanimated/NativeModules/ReanimatedModuleProxy.cpp +3 -5
- package/lib/module/PropsRegistryGarbageCollector.js +3 -6
- package/lib/module/PropsRegistryGarbageCollector.js.map +1 -1
- package/lib/module/animation/styleAnimation.js +4 -3
- package/lib/module/animation/styleAnimation.js.map +1 -1
- package/lib/module/layoutReanimation/animationsManager.js +9 -6
- package/lib/module/layoutReanimation/animationsManager.js.map +1 -1
- package/lib/module/platform-specific/jsVersion.js +1 -1
- package/lib/typescript/PropsRegistryGarbageCollector.d.ts +0 -1
- package/lib/typescript/PropsRegistryGarbageCollector.d.ts.map +1 -1
- package/lib/typescript/animation/styleAnimation.d.ts +1 -1
- package/lib/typescript/animation/styleAnimation.d.ts.map +1 -1
- package/lib/typescript/layoutReanimation/animationsManager.d.ts.map +1 -1
- package/lib/typescript/platform-specific/jsVersion.d.ts +1 -1
- package/package.json +2 -2
- package/src/PropsRegistryGarbageCollector.ts +3 -6
- package/src/animation/styleAnimation.ts +5 -3
- package/src/layoutReanimation/animationsManager.ts +9 -7
- package/src/platform-specific/jsVersion.ts +1 -1
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#include <reanimated/Fabric/updates/AnimatedPropsRegistry.h>
|
|
2
2
|
#include <reanimated/Tools/FeatureFlags.h>
|
|
3
3
|
|
|
4
|
+
#include <functional>
|
|
4
5
|
#include <memory>
|
|
5
6
|
#include <utility>
|
|
7
|
+
#include <vector>
|
|
6
8
|
|
|
7
9
|
namespace reanimated {
|
|
8
10
|
|
|
@@ -25,25 +27,59 @@ void AnimatedPropsRegistry::update(jsi::Runtime &rt, const jsi::Value &operation
|
|
|
25
27
|
addUpdatesToBatch(shadowNode, jsi::dynamicFromValue(rt, updates));
|
|
26
28
|
|
|
27
29
|
if constexpr (StaticFeatureFlags::getFlag("FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS")) {
|
|
28
|
-
|
|
30
|
+
const auto tag = shadowNode->getTag();
|
|
31
|
+
timestampMap_[tag] = timestamp;
|
|
32
|
+
// If JS already has a `settledProps` snapshot for this tag, it is now
|
|
33
|
+
// stale — schedule a refresh on the next `collectSettledUpdates`.
|
|
34
|
+
if (syncedTags_.erase(tag) > 0) {
|
|
35
|
+
invalidatedTags_.insert(tag);
|
|
36
|
+
}
|
|
29
37
|
}
|
|
30
38
|
}
|
|
31
39
|
}
|
|
32
40
|
|
|
33
|
-
jsi::Value AnimatedPropsRegistry::
|
|
34
|
-
jsi::Runtime &rt,
|
|
35
|
-
const double timestamp,
|
|
36
|
-
const double cleanupTimestamp) {
|
|
41
|
+
jsi::Value AnimatedPropsRegistry::collectSettledUpdates(jsi::Runtime &rt, const double settledTimestamp) {
|
|
37
42
|
std::lock_guard<std::mutex> lock{mutex_};
|
|
38
|
-
removeUpdatesOlderThanTimestamp(cleanupTimestamp);
|
|
39
43
|
|
|
40
44
|
std::vector<std::pair<Tag, std::reference_wrapper<const folly::dynamic>>> updates;
|
|
41
45
|
|
|
42
|
-
for (
|
|
43
|
-
auto
|
|
44
|
-
|
|
45
|
-
|
|
46
|
+
for (auto it = updatesRegistry_.begin(); it != updatesRegistry_.end();) {
|
|
47
|
+
const auto viewTag = it->first;
|
|
48
|
+
|
|
49
|
+
if (syncedTags_.contains(viewTag)) {
|
|
50
|
+
// React already has the latest value for this tag (synced on a previous
|
|
51
|
+
// call, so the `settledProps` state is committed by now) — the registry
|
|
52
|
+
// entry is redundant. `syncedTags_` is intentionally retained to detect
|
|
53
|
+
// re-animation staleness. Note that `syncedTags_` and `invalidatedTags_`
|
|
54
|
+
// are disjoint — `update()` moves tags from the former to the latter.
|
|
55
|
+
timestampMap_.erase(viewTag);
|
|
56
|
+
it = updatesRegistry_.erase(it);
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const auto timestampIt = timestampMap_.find(viewTag);
|
|
61
|
+
if (timestampIt == timestampMap_.end()) {
|
|
62
|
+
++it;
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
const bool isSettled = timestampIt->second < settledTimestamp;
|
|
66
|
+
const auto invalidatedIt = invalidatedTags_.find(viewTag);
|
|
67
|
+
const bool isInvalidated = invalidatedIt != invalidatedTags_.end();
|
|
68
|
+
if (isSettled || isInvalidated) {
|
|
69
|
+
updates.emplace_back(viewTag, std::cref(it->second.second));
|
|
70
|
+
if (isSettled) {
|
|
71
|
+
// Only settled-path tags are tracked as "synced" so that an ongoing
|
|
72
|
+
// animation doesn't re-trigger an invalidation/sync on every GC tick.
|
|
73
|
+
syncedTags_.insert(viewTag);
|
|
74
|
+
}
|
|
75
|
+
if (isInvalidated) {
|
|
76
|
+
// Only erase serviced invalidations; if a tag was invalidated but the
|
|
77
|
+
// matching update batch hasn't been flushed into updatesRegistry_ yet,
|
|
78
|
+
// we leave the entry so the next sync picks it up.
|
|
79
|
+
invalidatedTags_.erase(invalidatedIt);
|
|
80
|
+
}
|
|
46
81
|
}
|
|
82
|
+
++it;
|
|
47
83
|
}
|
|
48
84
|
|
|
49
85
|
const jsi::Array array(rt, updates.size());
|
|
@@ -58,22 +94,11 @@ jsi::Value AnimatedPropsRegistry::getUpdatesOlderThanTimestamp(
|
|
|
58
94
|
return jsi::Value(rt, array);
|
|
59
95
|
}
|
|
60
96
|
|
|
61
|
-
void AnimatedPropsRegistry::removeUpdatesOlderThanTimestamp(const double timestamp) {
|
|
62
|
-
for (auto it = timestampMap_.begin(); it != timestampMap_.end();) {
|
|
63
|
-
const auto viewTag = it->first;
|
|
64
|
-
const auto viewTimestamp = it->second;
|
|
65
|
-
if (viewTimestamp < timestamp) {
|
|
66
|
-
it = timestampMap_.erase(it);
|
|
67
|
-
updatesRegistry_.erase(viewTag);
|
|
68
|
-
} else {
|
|
69
|
-
it++;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
97
|
void AnimatedPropsRegistry::removeTag(const Tag tag) {
|
|
75
98
|
updatesRegistry_.erase(tag);
|
|
76
99
|
timestampMap_.erase(tag);
|
|
100
|
+
syncedTags_.erase(tag);
|
|
101
|
+
invalidatedTags_.erase(tag);
|
|
77
102
|
}
|
|
78
103
|
|
|
79
104
|
} // namespace reanimated
|
|
@@ -4,10 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
#include <react/renderer/uimanager/UIManager.h>
|
|
6
6
|
|
|
7
|
-
#include <memory>
|
|
8
|
-
#include <string>
|
|
9
7
|
#include <unordered_map>
|
|
10
|
-
#include <
|
|
8
|
+
#include <unordered_set>
|
|
11
9
|
|
|
12
10
|
namespace reanimated {
|
|
13
11
|
|
|
@@ -15,13 +13,22 @@ class AnimatedPropsRegistry : public UpdatesRegistry {
|
|
|
15
13
|
public:
|
|
16
14
|
void update(jsi::Runtime &rt, const jsi::Value &operations, double timestamp);
|
|
17
15
|
|
|
18
|
-
///
|
|
19
|
-
|
|
16
|
+
/// Returns updates that settled (received no update since `settledTimestamp`)
|
|
17
|
+
/// or whose synced `settledProps` snapshot was invalidated by a fresh update.
|
|
18
|
+
/// Also evicts entries that have already been synced to React — by the time
|
|
19
|
+
/// of the next call, the corresponding `settledProps` state is guaranteed to
|
|
20
|
+
/// be committed, so the registry entries are redundant.
|
|
21
|
+
jsi::Value collectSettledUpdates(jsi::Runtime &rt, double settledTimestamp);
|
|
20
22
|
|
|
21
23
|
private:
|
|
22
24
|
std::unordered_map<Tag, double> timestampMap_; // viewTag -> timestamp, protected by `mutex_`
|
|
25
|
+
// Tags whose latest values have already been pushed to React `settledProps`.
|
|
26
|
+
// Intentionally retained after eviction to detect re-animation staleness.
|
|
27
|
+
std::unordered_set<Tag> syncedTags_;
|
|
28
|
+
// Tags that were synced to React but received a fresh worklet update since;
|
|
29
|
+
// their `settledProps` are stale and need to be refreshed on the next sync.
|
|
30
|
+
std::unordered_set<Tag> invalidatedTags_;
|
|
23
31
|
|
|
24
|
-
void removeUpdatesOlderThanTimestamp(double timestamp);
|
|
25
32
|
void removeTag(Tag tag) override;
|
|
26
33
|
};
|
|
27
34
|
|
|
@@ -39,6 +39,8 @@ std::optional<MountingTransaction> LayoutAnimationsProxy_Legacy::pullTransaction
|
|
|
39
39
|
std::vector<std::shared_ptr<MutationNode>> roots;
|
|
40
40
|
std::unordered_map<Tag, Tag> movedViews;
|
|
41
41
|
|
|
42
|
+
reconcileContradictedRemovals(mutations, filteredMutations, surfaceId);
|
|
43
|
+
|
|
42
44
|
addOngoingAnimations(surfaceId, filteredMutations);
|
|
43
45
|
|
|
44
46
|
#ifdef ANDROID
|
|
@@ -64,6 +66,40 @@ std::optional<MountingTransaction> LayoutAnimationsProxy_Legacy::pullTransaction
|
|
|
64
66
|
return MountingTransaction{surfaceId, transactionNumber, std::move(filteredMutations), telemetry};
|
|
65
67
|
}
|
|
66
68
|
|
|
69
|
+
// If React re-creates or re-inserts a tag whose exiting removal we are still
|
|
70
|
+
// withholding, it has contradicted that withheld Remove/Delete. Flush it now
|
|
71
|
+
// instead of letting it fire later against a stale hierarchy (which would
|
|
72
|
+
// unmount the wrong, still-live view and crash the mounting layer).
|
|
73
|
+
//
|
|
74
|
+
// This must run before addOngoingAnimations (which would otherwise emit an
|
|
75
|
+
// Update for a tag we are about to Delete this frame) and before
|
|
76
|
+
// parseRemoveMutations, so the rest of the pipeline sees clean bookkeeping.
|
|
77
|
+
void LayoutAnimationsProxy_Legacy::reconcileContradictedRemovals(
|
|
78
|
+
ShadowViewMutationList &mutations,
|
|
79
|
+
ShadowViewMutationList &filteredMutations,
|
|
80
|
+
SurfaceId surfaceId) const {
|
|
81
|
+
auto &[deadNodes] = surfaceContext_[surfaceId];
|
|
82
|
+
for (auto &mutation : mutations) {
|
|
83
|
+
if (mutation.type != ShadowViewMutation::Type::Create && mutation.type != ShadowViewMutation::Type::Insert) {
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
auto tag = mutation.newChildShadowView.tag;
|
|
87
|
+
auto it = nodeForTag_.find(tag);
|
|
88
|
+
// Only a MutationNode represents a withheld removal; a plain Node is just a
|
|
89
|
+
// live parent of some removed child and must be left untouched.
|
|
90
|
+
if (it == nodeForTag_.end() || !it->second->isMutationNode()) {
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
auto node = std::static_pointer_cast<MutationNode>(it->second);
|
|
94
|
+
// Flush the withheld Remove/Delete for this tag (and its withheld subtree)
|
|
95
|
+
// right now, mirroring the deadNodes cleanup in handleRemovals. This removes
|
|
96
|
+
// the stale view before React's Create/Insert re-registers the same tag.
|
|
97
|
+
endAnimationsRecursively(node, filteredMutations);
|
|
98
|
+
maybeDropAncestors(node->unflattenedParent, node, filteredMutations);
|
|
99
|
+
deadNodes.erase(node);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
67
103
|
std::optional<SurfaceId> LayoutAnimationsProxy_Legacy::progressLayoutAnimation(int tag, const jsi::Object &newStyle) {
|
|
68
104
|
#ifdef LAYOUT_ANIMATIONS_LOGS
|
|
69
105
|
LOG(INFO) << "progress layout animation for tag " << tag << std::endl;
|
|
@@ -123,6 +159,10 @@ std::optional<SurfaceId> LayoutAnimationsProxy_Legacy::endLayoutAnimation(int ta
|
|
|
123
159
|
}
|
|
124
160
|
|
|
125
161
|
auto node = nodeForTag_[tag];
|
|
162
|
+
if (!node->isMutationNode()) {
|
|
163
|
+
react_native_assert(false && "exiting tag must map to a MutationNode");
|
|
164
|
+
return {};
|
|
165
|
+
}
|
|
126
166
|
auto mutationNode = std::static_pointer_cast<MutationNode>(node);
|
|
127
167
|
mutationNode->state = ExitingState_Legacy::DEAD;
|
|
128
168
|
auto &[deadNodes] = surfaceContext_[surfaceId];
|
|
@@ -148,6 +148,10 @@ struct LayoutAnimationsProxy_Legacy : public LayoutAnimationsProxyCommon,
|
|
|
148
148
|
std::optional<SurfaceId> endLayoutAnimation(int tag, bool shouldRemove) override;
|
|
149
149
|
void maybeCancelAnimation(const int tag) const;
|
|
150
150
|
|
|
151
|
+
void reconcileContradictedRemovals(
|
|
152
|
+
ShadowViewMutationList &mutations,
|
|
153
|
+
ShadowViewMutationList &filteredMutations,
|
|
154
|
+
SurfaceId surfaceId) const;
|
|
151
155
|
void parseRemoveMutations(
|
|
152
156
|
std::unordered_map<Tag, Tag> &movedViews,
|
|
153
157
|
ShadowViewMutationList &mutations,
|
|
@@ -524,15 +524,13 @@ jsi::Value ReanimatedModuleProxy::getSettledUpdates(jsi::Runtime &rt) {
|
|
|
524
524
|
StaticFeatureFlags::getFlag("FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS") &&
|
|
525
525
|
"getSettledUpdates requires FORCE_REACT_RENDER_FOR_SETTLED_ANIMATIONS static feature flag to be enabled");
|
|
526
526
|
|
|
527
|
+
constexpr double SETTLED_ANIMATION_THRESHOLD_MS = 1000;
|
|
528
|
+
|
|
527
529
|
// TODO(future): use unified timestamp
|
|
528
530
|
const auto currentTimestamp = getAnimationTimestamp_();
|
|
529
531
|
|
|
530
|
-
// TODO: fix bug when threshold difference is smaller than 1 second
|
|
531
532
|
// TODO(future): flush updates from CSS animations and CSS transitions registries
|
|
532
|
-
|
|
533
|
-
// TODO(future): move removing old updates to separate method
|
|
534
|
-
return animatedPropsRegistry_->getUpdatesOlderThanTimestamp(
|
|
535
|
-
rt, currentTimestamp - 1000 /* 1 second */, currentTimestamp - 2000 /* 2 seconds */);
|
|
533
|
+
return animatedPropsRegistry_->collectSettledUpdates(rt, currentTimestamp - SETTLED_ANIMATION_THRESHOLD_MS);
|
|
536
534
|
}
|
|
537
535
|
|
|
538
536
|
bool ReanimatedModuleProxy::handleEvent(
|
|
@@ -4,7 +4,6 @@ import { unprocessColor, unprocessColorsInProps } from './common/style/processor
|
|
|
4
4
|
import { ReanimatedModule } from './ReanimatedModule';
|
|
5
5
|
const FLUSH_INTERVAL_MS = 500;
|
|
6
6
|
export const PropsRegistryGarbageCollector = {
|
|
7
|
-
viewsCount: 0,
|
|
8
7
|
viewsMap: new Map(),
|
|
9
8
|
intervalId: null,
|
|
10
9
|
registerView(viewTag, component) {
|
|
@@ -17,15 +16,13 @@ export const PropsRegistryGarbageCollector = {
|
|
|
17
16
|
return;
|
|
18
17
|
}
|
|
19
18
|
this.viewsMap.set(viewTag, component);
|
|
20
|
-
this.
|
|
21
|
-
if (this.viewsCount === 1) {
|
|
19
|
+
if (this.viewsMap.size === 1) {
|
|
22
20
|
this.registerInterval();
|
|
23
21
|
}
|
|
24
22
|
},
|
|
25
23
|
unregisterView(viewTag) {
|
|
26
|
-
this.viewsMap.delete(viewTag);
|
|
27
|
-
this.
|
|
28
|
-
if (this.viewsCount === 0) {
|
|
24
|
+
const deleted = this.viewsMap.delete(viewTag);
|
|
25
|
+
if (deleted && this.viewsMap.size === 0) {
|
|
29
26
|
this.unregisterInterval();
|
|
30
27
|
}
|
|
31
28
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["unprocessColor","unprocessColorsInProps","ReanimatedModule","FLUSH_INTERVAL_MS","PropsRegistryGarbageCollector","
|
|
1
|
+
{"version":3,"names":["unprocessColor","unprocessColorsInProps","ReanimatedModule","FLUSH_INTERVAL_MS","PropsRegistryGarbageCollector","viewsMap","Map","intervalId","registerView","viewTag","component","has","set","size","registerInterval","unregisterView","deleted","delete","unregisterInterval","syncPropsBackToReact","settledUpdates","getSettledUpdates","styleProps","get","unprocessProps","_syncStylePropsBackToReact","setInterval","bind","clearInterval","props","unprocessBoxShadow","Array","isArray","boxShadow","map","color"],"sourceRoot":"../../src","sources":["PropsRegistryGarbageCollector.ts"],"m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,CAAA,EAAG;IACjB,IAAI,CAACP,UAAU,GAAGmB,WAAW,CAC3B,IAAI,CAACP,oBAAoB,CAACQ,IAAI,CAAC,IAAI,CAAC,EACpCxB,iBACF,CAAC;EACH,CAAC;EAEDe,kBAAkBA,CAAA,EAAG;IACnB,IAAI,IAAI,CAACX,UAAU,KAAK,IAAI,EAAE;MAC5BqB,aAAa,CAAC,IAAI,CAACrB,UAAU,CAAC;MAC9B,IAAI,CAACA,UAAU,GAAG,IAAI;IACxB;EACF;AACF,CAAC;AAED,SAASiB,cAAcA,CAACK,KAAiB,EAAE;EACzC5B,sBAAsB,CAAC4B,KAAK,CAAC;EAC7BC,kBAAkB,CAACD,KAAK,CAAC;AAC3B;AAEA,SAASC,kBAAkBA,CAACD,KAAiB,EAAE;EAC7C,IAAIE,KAAK,CAACC,OAAO,CAACH,KAAK,CAACI,SAAS,CAAC,EAAE;IAClC;IACAJ,KAAK,CAACI,SAAS,GAAGJ,KAAK,CAACI,SAAS,CAACC,GAAG,CAAED,SAAS,KAAM;MACpD,GAAGA,SAAS;MACZE,KAAK,EAAEnC,cAAc,CAACiC,SAAS,CAACE,KAAK;IACvC,CAAC,CAAC,CAAC;EACL;AACF","ignoreList":[]}
|
|
@@ -45,7 +45,7 @@ function setPath(obj, path, value) {
|
|
|
45
45
|
}
|
|
46
46
|
export function withStyleAnimation(
|
|
47
47
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
-
styleAnimations) {
|
|
48
|
+
styleAnimations, callback) {
|
|
49
49
|
'worklet';
|
|
50
50
|
|
|
51
51
|
return defineAnimation({}, () => {
|
|
@@ -148,7 +148,7 @@ styleAnimations) {
|
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
};
|
|
151
|
-
const
|
|
151
|
+
const styleAnimationCallback = finished => {
|
|
152
152
|
if (!finished) {
|
|
153
153
|
const animationsToCheck = [styleAnimations];
|
|
154
154
|
while (animationsToCheck.length > 0) {
|
|
@@ -169,6 +169,7 @@ styleAnimations) {
|
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
+
callback?.(finished);
|
|
172
173
|
};
|
|
173
174
|
return {
|
|
174
175
|
isHigherOrder: true,
|
|
@@ -176,7 +177,7 @@ styleAnimations) {
|
|
|
176
177
|
onStart,
|
|
177
178
|
current: {},
|
|
178
179
|
styleAnimations,
|
|
179
|
-
callback
|
|
180
|
+
callback: styleAnimationCallback
|
|
180
181
|
};
|
|
181
182
|
});
|
|
182
183
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["ColorProperties","logger","processColor","withTiming","defineAnimation","isValidLayoutAnimationProp","resolvePath","obj","path","keys","Array","isArray","reduce","acc","current","undefined","setPath","value","currObj","i","length","withStyleAnimation","styleAnimations","onFrame","animation","now","stillGoing","entriesToCheck","currentEntry","pop","index","push","concat","key","Object","currentStyleAnimation","finished","
|
|
1
|
+
{"version":3,"names":["ColorProperties","logger","processColor","withTiming","defineAnimation","isValidLayoutAnimationProp","resolvePath","obj","path","keys","Array","isArray","reduce","acc","current","undefined","setPath","value","currObj","i","length","withStyleAnimation","styleAnimations","callback","onFrame","animation","now","stillGoing","entriesToCheck","currentEntry","pop","index","push","concat","key","Object","currentStyleAnimation","finished","isAnimatingColorProp","includes","onStart","previousAnimation","prevAnimation","prevVal","__DEV__","warn","join","propName","trim","currentAnimation","duration","styleAnimationCallback","animationsToCheck","element","values","isHigherOrder"],"sourceRoot":"../../../src","sources":["animation/styleAnimation.ts"],"mappings":"AAAA,YAAY;;AACZ,SAASA,eAAe,QAAQ,WAAW;AAC3C,SAASC,MAAM,EAAEC,YAAY,QAAQ,WAAW;AAWhD,SAASC,UAAU,QAAQ,UAAU;AACrC,SAASC,eAAe,EAAEC,0BAA0B,QAAQ,QAAQ;;AAEpE;AACA;AACA,SAASC,WAAWA,CAClBC,GAAoB,EACpBC,IAAyC,EACN;EACnC,SAAS;;EACT,MAAMC,IAAuB,GAAGC,KAAK,CAACC,O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AC,MAAM,IACL,OAAOJ,gBAAgB,KAAK,QAAQ,IACpCA,gBAAgB,CAACT,OAAO,KAAKzB,SAAS,EACtC;YACA,KAAK,MAAME,KAAK,IAAIkB,MAAM,CAACmB,MAAM,CAACL,gBAAgB,CAAC,EAAE;cACnDG,iBAAiB,CAACpB,IAAI,CAACf,KAAK,CAAC;YAC/B;UACF,CAAC,MAAM;YACL,MAAMmB,qBAAsC,GAC1Ca,gBAAmC;YACrC,IACE,CAACb,qBAAqB,CAACC,QAAQ,IAC/BD,qBAAqB,CAACb,QAAQ,EAC9B;cACAa,qBAAqB,CAACb,QAAQ,CAAC,KAAK,CAAC;YACvC;UACF;QACF;MACF;MACAA,QAAQ,GAAGc,QAAQ,CAAC;IACtB,CAAC;IAED,OAAO;MACLkB,aAAa,EAAE,IAAI;MACnB/B,OAAO;MACPgB,OAAO;MACP1B,OAAO,EAAE,CAAC,CAAC;MACXQ,eAAe;MACfC,QAAQ,EAAE4B;IACZ,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
import { runOnUISync } from 'react-native-worklets';
|
|
4
|
-
import { withStyleAnimation } from '../animation';
|
|
4
|
+
import { cancelAnimation, withStyleAnimation } from '../animation';
|
|
5
5
|
import { SHOULD_BE_USE_WEB } from '../common';
|
|
6
6
|
import { LayoutAnimationType } from '../commonTypes';
|
|
7
7
|
import { makeMutableUI } from '../mutables';
|
|
@@ -52,8 +52,7 @@ function createLayoutAnimationManager() {
|
|
|
52
52
|
stopObservingProgress(tag, value);
|
|
53
53
|
value._value = style.initialValues;
|
|
54
54
|
}
|
|
55
|
-
const animation = withStyleAnimation(currentAnimation
|
|
56
|
-
animation.callback = finished => {
|
|
55
|
+
const animation = withStyleAnimation(currentAnimation, finished => {
|
|
57
56
|
if (finished) {
|
|
58
57
|
currentAnimationForTag.delete(tag);
|
|
59
58
|
mutableValuesForTag.delete(tag);
|
|
@@ -61,9 +60,9 @@ function createLayoutAnimationManager() {
|
|
|
61
60
|
stopObservingProgress(tag, value, shouldRemoveView);
|
|
62
61
|
}
|
|
63
62
|
if (style.callback) {
|
|
64
|
-
style.callback(finished
|
|
63
|
+
style.callback(finished);
|
|
65
64
|
}
|
|
66
|
-
};
|
|
65
|
+
});
|
|
67
66
|
startObservingProgress(tag, value);
|
|
68
67
|
value.value = animation;
|
|
69
68
|
},
|
|
@@ -72,7 +71,11 @@ function createLayoutAnimationManager() {
|
|
|
72
71
|
if (!value) {
|
|
73
72
|
return;
|
|
74
73
|
}
|
|
75
|
-
|
|
74
|
+
// native already made its cleanup, so we just do cleanup here on JS side
|
|
75
|
+
value.removeListener(tag + TAG_OFFSET);
|
|
76
|
+
cancelAnimation(value);
|
|
77
|
+
currentAnimationForTag.delete(tag);
|
|
78
|
+
mutableValuesForTag.delete(tag);
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["runOnUISync","withStyleAnimation","SHOULD_BE_USE_WEB","LayoutAnimationType","makeMutableUI","TAG_OFFSET","startObservingProgress","tag","sharedValue","addListener","global","_notifyAboutProgress","value","stopObservingProgress","removeView","removeListener","_notifyAboutEnd","createLayoutAnimationManager","currentAnimationForTag","Map","mutableValuesForTag","start","type","yogaValues","config","style","currentAnimation","animations","previousAnimation","get","set","undefined","initialValues","_value","animation","
|
|
1
|
+
{"version":3,"names":["runOnUISync","cancelAnimation","withStyleAnimation","SHOULD_BE_USE_WEB","LayoutAnimationType","makeMutableUI","TAG_OFFSET","startObservingProgress","tag","sharedValue","addListener","global","_notifyAboutProgress","value","stopObservingProgress","removeView","removeListener","_notifyAboutEnd","createLayoutAnimationManager","currentAnimationForTag","Map","mutableValuesForTag","start","type","yogaValues","config","style","currentAnimation","animations","previousAnimation","get","set","undefined","initialValues","_value","animation","finished","delete","shouldRemoveView","EXITING","callback","stop","LayoutAnimationsManager"],"s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,sBAAsB,CAACkB,MAAM,CAAC7B,GAAG,CAAC;MAClCa,mBAAmB,CAACgB,MAAM,CAAC7B,GAAG,CAAC;IACjC;EACF,CAAC;AACH;AAEA,IAAI,CAACL,iBAAiB,EAAE;EACtBH,WAAW,CAAC,MAAM;IAChB,SAAS;;IACTW,MAAM,CAAC+B,uBAAuB,GAAGxB,4BAA4B,CAAC,CAAC;EACjE,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IAnimatedComponentInternal } from './createAnimatedComponent/commonTypes';
|
|
2
2
|
export declare const PropsRegistryGarbageCollector: {
|
|
3
|
-
viewsCount: number;
|
|
4
3
|
viewsMap: Map<number, IAnimatedComponentInternal>;
|
|
5
4
|
intervalId: NodeJS.Timeout | null;
|
|
6
5
|
registerView(viewTag: number, component: IAnimatedComponentInternal): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropsRegistryGarbageCollector.d.ts","sourceRoot":"","sources":["../../src/PropsRegistryGarbageCollector.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAKxF,eAAO,MAAM,6BAA6B
|
|
1
|
+
{"version":3,"file":"PropsRegistryGarbageCollector.d.ts","sourceRoot":"","sources":["../../src/PropsRegistryGarbageCollector.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAKxF,eAAO,MAAM,6BAA6B;;gBAEpB,MAAM,CAAC,OAAO,GAAG,IAAI;0BAEnB,MAAM,aAAa,0BAA0B;4BAe3C,MAAM;;;;CAgC/B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { AnimatedStyle } from '../commonTypes';
|
|
2
2
|
import type { StyleLayoutAnimation } from './commonTypes';
|
|
3
|
-
export declare function withStyleAnimation(styleAnimations: AnimatedStyle<any
|
|
3
|
+
export declare function withStyleAnimation(styleAnimations: AnimatedStyle<any>, callback?: (finished: boolean) => void): StyleLayoutAnimation;
|
|
4
4
|
//# sourceMappingURL=styleAnimation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleAnimation.d.ts","sourceRoot":"","sources":["../../../src/animation/styleAnimation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,aAAa,EAMd,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AA6D1D,wBAAgB,kBAAkB,CAEhC,eAAe,EAAE,aAAa,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"styleAnimation.d.ts","sourceRoot":"","sources":["../../../src/animation/styleAnimation.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,aAAa,EAMd,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AA6D1D,wBAAgB,kBAAkB,CAEhC,eAAe,EAAE,aAAa,CAAC,GAAG,CAAC,EACnC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,GACrC,oBAAoB,CA6MtB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animationsManager.d.ts","sourceRoot":"","sources":["../../../src/layoutReanimation/animationsManager.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAEV,4BAA4B,EAG7B,MAAM,gBAAgB,CAAC;AA0BxB,iBAAS,4BAA4B,IAAI;IACvC,KAAK,EAAE,4BAA4B,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,
|
|
1
|
+
{"version":3,"file":"animationsManager.d.ts","sourceRoot":"","sources":["../../../src/layoutReanimation/animationsManager.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAEV,4BAA4B,EAG7B,MAAM,gBAAgB,CAAC;AA0BxB,iBAAS,4BAA4B,IAAI;IACvC,KAAK,EAAE,4BAA4B,CAAC;IACpC,IAAI,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B,CA+DA;AASD,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAC9C,OAAO,4BAA4B,CACpC,CAAC"}
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* version used to build the native part of the library in runtime. Remember to
|
|
4
4
|
* keep this in sync with the version declared in `package.json`
|
|
5
5
|
*/
|
|
6
|
-
export declare const jsVersion = "4.3.
|
|
6
|
+
export declare const jsVersion = "4.3.3";
|
|
7
7
|
//# sourceMappingURL=jsVersion.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-reanimated",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.3",
|
|
4
4
|
"description": "More powerful alternative to Animated library for React Native.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"react-native-builder-bob": "0.40.13",
|
|
137
137
|
"react-native-svg": "patch:react-native-svg@npm%3A15.15.3#~/.yarn/patches/react-native-svg-npm-15.15.3-0699a4dc13.patch",
|
|
138
138
|
"react-native-web": "0.21.1",
|
|
139
|
-
"react-native-worklets": "0.8.
|
|
139
|
+
"react-native-worklets": "0.8.3",
|
|
140
140
|
"react-test-renderer": "19.2.3",
|
|
141
141
|
"typescript": "5.8.3"
|
|
142
142
|
},
|
|
@@ -11,7 +11,6 @@ import { ReanimatedModule } from './ReanimatedModule';
|
|
|
11
11
|
const FLUSH_INTERVAL_MS = 500;
|
|
12
12
|
|
|
13
13
|
export const PropsRegistryGarbageCollector = {
|
|
14
|
-
viewsCount: 0,
|
|
15
14
|
viewsMap: new Map<number, IAnimatedComponentInternal>(),
|
|
16
15
|
intervalId: null as NodeJS.Timeout | null,
|
|
17
16
|
|
|
@@ -25,16 +24,14 @@ export const PropsRegistryGarbageCollector = {
|
|
|
25
24
|
return;
|
|
26
25
|
}
|
|
27
26
|
this.viewsMap.set(viewTag, component);
|
|
28
|
-
this.
|
|
29
|
-
if (this.viewsCount === 1) {
|
|
27
|
+
if (this.viewsMap.size === 1) {
|
|
30
28
|
this.registerInterval();
|
|
31
29
|
}
|
|
32
30
|
},
|
|
33
31
|
|
|
34
32
|
unregisterView(viewTag: number) {
|
|
35
|
-
this.viewsMap.delete(viewTag);
|
|
36
|
-
this.
|
|
37
|
-
if (this.viewsCount === 0) {
|
|
33
|
+
const deleted = this.viewsMap.delete(viewTag);
|
|
34
|
+
if (deleted && this.viewsMap.size === 0) {
|
|
38
35
|
this.unregisterInterval();
|
|
39
36
|
}
|
|
40
37
|
},
|
|
@@ -73,7 +73,8 @@ interface NestedObjectEntry<T> {
|
|
|
73
73
|
|
|
74
74
|
export function withStyleAnimation(
|
|
75
75
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
76
|
-
styleAnimations: AnimatedStyle<any
|
|
76
|
+
styleAnimations: AnimatedStyle<any>,
|
|
77
|
+
callback?: (finished: boolean) => void
|
|
77
78
|
): StyleLayoutAnimation {
|
|
78
79
|
'worklet';
|
|
79
80
|
return defineAnimation<StyleLayoutAnimation>({}, () => {
|
|
@@ -236,7 +237,7 @@ export function withStyleAnimation(
|
|
|
236
237
|
}
|
|
237
238
|
};
|
|
238
239
|
|
|
239
|
-
const
|
|
240
|
+
const styleAnimationCallback = (finished: boolean): void => {
|
|
240
241
|
if (!finished) {
|
|
241
242
|
const animationsToCheck: NestedObjectValues<AnimationObject>[] = [
|
|
242
243
|
styleAnimations,
|
|
@@ -267,6 +268,7 @@ export function withStyleAnimation(
|
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
270
|
}
|
|
271
|
+
callback?.(finished);
|
|
270
272
|
};
|
|
271
273
|
|
|
272
274
|
return {
|
|
@@ -275,7 +277,7 @@ export function withStyleAnimation(
|
|
|
275
277
|
onStart,
|
|
276
278
|
current: {},
|
|
277
279
|
styleAnimations,
|
|
278
|
-
callback,
|
|
280
|
+
callback: styleAnimationCallback,
|
|
279
281
|
} as StyleLayoutAnimation;
|
|
280
282
|
});
|
|
281
283
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { runOnUISync } from 'react-native-worklets';
|
|
4
4
|
|
|
5
|
-
import { withStyleAnimation } from '../animation';
|
|
5
|
+
import { cancelAnimation, withStyleAnimation } from '../animation';
|
|
6
6
|
import { SHOULD_BE_USE_WEB } from '../common';
|
|
7
7
|
import type {
|
|
8
8
|
LayoutAnimation,
|
|
@@ -74,9 +74,7 @@ function createLayoutAnimationManager(): {
|
|
|
74
74
|
value._value = style.initialValues;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
const animation = withStyleAnimation(currentAnimation)
|
|
78
|
-
|
|
79
|
-
animation.callback = (finished?: boolean) => {
|
|
77
|
+
const animation = withStyleAnimation(currentAnimation, (finished) => {
|
|
80
78
|
if (finished) {
|
|
81
79
|
currentAnimationForTag.delete(tag);
|
|
82
80
|
mutableValuesForTag.delete(tag);
|
|
@@ -84,9 +82,9 @@ function createLayoutAnimationManager(): {
|
|
|
84
82
|
stopObservingProgress(tag, value, shouldRemoveView);
|
|
85
83
|
}
|
|
86
84
|
if (style.callback) {
|
|
87
|
-
style.callback(finished
|
|
85
|
+
style.callback(finished);
|
|
88
86
|
}
|
|
89
|
-
};
|
|
87
|
+
});
|
|
90
88
|
|
|
91
89
|
startObservingProgress(tag, value);
|
|
92
90
|
value.value = animation;
|
|
@@ -96,7 +94,11 @@ function createLayoutAnimationManager(): {
|
|
|
96
94
|
if (!value) {
|
|
97
95
|
return;
|
|
98
96
|
}
|
|
99
|
-
|
|
97
|
+
// native already made its cleanup, so we just do cleanup here on JS side
|
|
98
|
+
value.removeListener(tag + TAG_OFFSET);
|
|
99
|
+
cancelAnimation(value);
|
|
100
|
+
currentAnimationForTag.delete(tag);
|
|
101
|
+
mutableValuesForTag.delete(tag);
|
|
100
102
|
},
|
|
101
103
|
};
|
|
102
104
|
}
|