react-native-screen-transitions 3.9.0-beta.0 → 3.9.0-beta.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/lib/commonjs/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js +6 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js +50 -0
- package/lib/commonjs/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js.map +1 -0
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +7 -1
- package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js +6 -1
- package/lib/module/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js.map +1 -1
- package/lib/module/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js +45 -0
- package/lib/module/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js.map +1 -0
- package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js +7 -1
- package/lib/module/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/read-screen-animation-revisions.d.ts +4 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/read-screen-animation-revisions.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.d.ts +4 -0
- package/lib/typescript/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.d.ts.map +1 -0
- package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/providers/screen/animation/helpers/read-screen-animation-revisions.ts +14 -0
- package/src/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.ts +75 -0
- package/src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx +11 -0
package/lib/commonjs/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.readScreenAnimationRevisions = void 0;
|
|
7
|
-
const readScreenAnimationRevisions = (screenInterpolatorPropsRevision, ancestorScreenAnimationSources, descendantScreenAnimationSources) => {
|
|
7
|
+
const readScreenAnimationRevisions = (screenInterpolatorPropsRevision, ancestorScreenAnimationSources, descendantScreenAnimationSources, screenInterpolatorExternalDeps) => {
|
|
8
8
|
"worklet";
|
|
9
9
|
|
|
10
10
|
screenInterpolatorPropsRevision.get();
|
|
@@ -15,6 +15,11 @@ const readScreenAnimationRevisions = (screenInterpolatorPropsRevision, ancestorS
|
|
|
15
15
|
for (let index = 0; index < descendantSources.length; index++) {
|
|
16
16
|
descendantSources[index]?.source.screenInterpolatorPropsRevision.get();
|
|
17
17
|
}
|
|
18
|
+
if (screenInterpolatorExternalDeps) {
|
|
19
|
+
for (let index = 0; index < screenInterpolatorExternalDeps.length; index++) {
|
|
20
|
+
screenInterpolatorExternalDeps[index]?.get();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
18
23
|
};
|
|
19
24
|
exports.readScreenAnimationRevisions = readScreenAnimationRevisions;
|
|
20
25
|
//# sourceMappingURL=read-screen-animation-revisions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["readScreenAnimationRevisions","screenInterpolatorPropsRevision","ancestorScreenAnimationSources","descendantScreenAnimationSources","get","index","length","descendantSources","source","exports"],"sourceRoot":"../../../../../../../src","sources":["shared/providers/screen/animation/helpers/read-screen-animation-revisions.ts"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"names":["readScreenAnimationRevisions","screenInterpolatorPropsRevision","ancestorScreenAnimationSources","descendantScreenAnimationSources","screenInterpolatorExternalDeps","get","index","length","descendantSources","source","exports"],"sourceRoot":"../../../../../../../src","sources":["shared/providers/screen/animation/helpers/read-screen-animation-revisions.ts"],"mappings":";;;;;;AASO,MAAMA,4BAA4B,GAAGA,CAC3CC,+BAAgE,EAChEC,8BAAuD,EACvDC,gCAAkE,EAClEC,8BAA+D,KAC3D;EACJ,SAAS;;EACTH,+BAA+B,CAACI,GAAG,CAAC,CAAC;EAErC,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGJ,8BAA8B,CAACK,MAAM,EAAED,KAAK,EAAE,EAAE;IAC3EJ,8BAA8B,CAC7BI,KAAK,CACL,EAAEL,+BAA+B,CAACI,GAAG,CAAC,CAAC;EACzC;EAEA,MAAMG,iBAAiB,GAAGL,gCAAgC,CAACE,GAAG,CAAC,CAAC;EAChE,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGE,iBAAiB,CAACD,MAAM,EAAED,KAAK,EAAE,EAAE;IAC9DE,iBAAiB,CAACF,KAAK,CAAC,EAAEG,MAAM,CAACR,+BAA+B,CAACI,GAAG,CAAC,CAAC;EACvE;EAEA,IAAID,8BAA8B,EAAE;IACnC,KACC,IAAIE,KAAK,GAAG,CAAC,EACbA,KAAK,GAAGF,8BAA8B,CAACG,MAAM,EAC7CD,KAAK,EAAE,EACN;MACDF,8BAA8B,CAACE,KAAK,CAAC,EAAED,GAAG,CAAC,CAAC;IAC7C;EACD;AACD,CAAC;AAACK,OAAA,CAAAV,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
package/lib/commonjs/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.collectInterpolatorSharedValues = void 0;
|
|
7
|
+
const isSharedValueLike = value => value?._isReanimatedSharedValue === true;
|
|
8
|
+
const getWorkletClosure = value => {
|
|
9
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
const closure = value.__closure;
|
|
13
|
+
return closure && typeof closure === "object" ? closure : undefined;
|
|
14
|
+
};
|
|
15
|
+
const isPlainObject = value => value !== null && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype;
|
|
16
|
+
const collectInterpolatorSharedValues = interpolators => {
|
|
17
|
+
const sharedValues = [];
|
|
18
|
+
const seen = new Set();
|
|
19
|
+
const visit = value => {
|
|
20
|
+
if (value === null || value === undefined || seen.has(value)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
seen.add(value);
|
|
24
|
+
if (isSharedValueLike(value)) {
|
|
25
|
+
sharedValues.push(value);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (typeof value === "function") {
|
|
29
|
+
visit(getWorkletClosure(value));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (Array.isArray(value)) {
|
|
33
|
+
for (let index = 0; index < value.length; index++) {
|
|
34
|
+
visit(value[index]);
|
|
35
|
+
}
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if (isPlainObject(value)) {
|
|
39
|
+
for (const item of Object.values(value)) {
|
|
40
|
+
visit(item);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
for (let index = 0; index < interpolators.length; index++) {
|
|
45
|
+
visit(getWorkletClosure(interpolators[index]));
|
|
46
|
+
}
|
|
47
|
+
return sharedValues;
|
|
48
|
+
};
|
|
49
|
+
exports.collectInterpolatorSharedValues = collectInterpolatorSharedValues;
|
|
50
|
+
//# sourceMappingURL=collect-interpolator-shared-values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isSharedValueLike","value","_isReanimatedSharedValue","getWorkletClosure","undefined","closure","__closure","isPlainObject","Object","getPrototypeOf","prototype","collectInterpolatorSharedValues","interpolators","sharedValues","seen","Set","visit","has","add","push","Array","isArray","index","length","item","values","exports"],"sourceRoot":"../../../../../../../src","sources":["shared/providers/screen/styles/helpers/collect-interpolator-shared-values.ts"],"mappings":";;;;;;AAaA,MAAMA,iBAAiB,GAAIC,KAAc,IACvCA,KAAK,EAAsCC,wBAAwB,KAAK,IAAI;AAE9E,MAAMC,iBAAiB,GAAIF,KAAc,IAAiC;EACzE,IACCA,KAAK,KAAK,IAAI,IACb,OAAOA,KAAK,KAAK,QAAQ,IAAI,OAAOA,KAAK,KAAK,UAAW,EACzD;IACD,OAAOG,SAAS;EACjB;EAEA,MAAMC,OAAO,GAAIJ,KAAK,CAA6BK,SAAS;EAC5D,OAAOD,OAAO,IAAI,OAAOA,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGD,SAAS;AACpE,CAAC;AAED,MAAMG,aAAa,GAAIN,KAAc,IACpCA,KAAK,KAAK,IAAI,IACd,OAAOA,KAAK,KAAK,QAAQ,IACzBO,MAAM,CAACC,cAAc,CAACR,KAAK,CAAC,KAAKO,MAAM,CAACE,SAAS;AAE3C,MAAMC,+BAA+B,GAC3CC,aAAyD,IAC7B;EAC5B,MAAMC,YAAoC,GAAG,EAAE;EAC/C,MAAMC,IAAI,GAAG,IAAIC,GAAG,CAAU,CAAC;EAE/B,MAAMC,KAAK,GAAIf,KAAc,IAAK;IACjC,IAAIA,KAAK,KAAK,IAAI,IAAIA,KAAK,KAAKG,SAAS,IAAIU,IAAI,CAACG,GAAG,CAAChB,KAAK,CAAC,EAAE;MAC7D;IACD;IACAa,IAAI,CAACI,GAAG,CAACjB,KAAK,CAAC;IAEf,IAAID,iBAAiB,CAACC,KAAK,CAAC,EAAE;MAC7BY,YAAY,CAACM,IAAI,CAAClB,KAAK,CAAC;MACxB;IACD;IAEA,IAAI,OAAOA,KAAK,KAAK,UAAU,EAAE;MAChCe,KAAK,CAACb,iBAAiB,CAACF,KAAK,CAAC,CAAC;MAC/B;IACD;IAEA,IAAImB,KAAK,CAACC,OAAO,CAACpB,KAAK,CAAC,EAAE;MACzB,KAAK,IAAIqB,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGrB,KAAK,CAACsB,MAAM,EAAED,KAAK,EAAE,EAAE;QAClDN,KAAK,CAACf,KAAK,CAACqB,KAAK,CAAC,CAAC;MACpB;MACA;IACD;IAEA,IAAIf,aAAa,CAACN,KAAK,CAAC,EAAE;MACzB,KAAK,MAAMuB,IAAI,IAAIhB,MAAM,CAACiB,MAAM,CAACxB,KAAK,CAAC,EAAE;QACxCe,KAAK,CAACQ,IAAI,CAAC;MACZ;IACD;EACD,CAAC;EAED,KAAK,IAAIF,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGV,aAAa,CAACW,MAAM,EAAED,KAAK,EAAE,EAAE;IAC1DN,KAAK,CAACb,iBAAiB,CAACS,aAAa,CAACU,KAAK,CAAC,CAAC,CAAC;EAC/C;EAEA,OAAOT,YAAY;AACpB,CAAC;AAACa,OAAA,CAAAf,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.useInterpolatedStylesMap = void 0;
|
|
7
|
+
var _react = require("react");
|
|
7
8
|
var _reactNativeReanimated = require("react-native-reanimated");
|
|
8
9
|
var _constants = require("../../../../constants");
|
|
9
10
|
var _animation = require("../../../../stores/animation.store");
|
|
@@ -16,6 +17,7 @@ var _readScreenAnimationRevisions = require("../../animation/helpers/read-screen
|
|
|
16
17
|
var _selectedInterpolatorOptions = require("../../animation/helpers/selected-interpolator-options");
|
|
17
18
|
var _descriptors = require("../../descriptors");
|
|
18
19
|
var _options = require("../../options");
|
|
20
|
+
var _collectInterpolatorSharedValues = require("../helpers/collect-interpolator-shared-values");
|
|
19
21
|
var _normalizeSlots = require("../helpers/normalize-slots");
|
|
20
22
|
var _openingPhase = require("../helpers/opening-phase");
|
|
21
23
|
var _stripInterpolatorOptions = require("../helpers/strip-interpolator-options");
|
|
@@ -106,6 +108,10 @@ const useInterpolatedStylesMap = () => {
|
|
|
106
108
|
const boundsAccessor = (0, _useBuildBoundsAccessor.useBuildBoundsAccessor)();
|
|
107
109
|
const transition = (0, _useBuildTransitionAccessor.useBuildTransitionAccessor)();
|
|
108
110
|
const nextInterpolatorReady = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
111
|
+
|
|
112
|
+
// In some cases, a user may want to use external shared values to drive animations in the interpoaltor.
|
|
113
|
+
// We can now support this by collecting those shared values and reading them here to trigger an update.
|
|
114
|
+
const interpolatorSharedValues = (0, _react.useMemo)(() => (0, _collectInterpolatorSharedValues.collectInterpolatorSharedValues)([currentInterpolator, nextInterpolator]), [currentInterpolator, nextInterpolator]);
|
|
109
115
|
const activeScreenKey = nextScreenKey ?? currentScreenKey;
|
|
110
116
|
const {
|
|
111
117
|
entering: activeEntering,
|
|
@@ -118,7 +124,7 @@ const useInterpolatedStylesMap = () => {
|
|
|
118
124
|
const localStylesMaps = (0, _reactNativeReanimated.useDerivedValue)(() => {
|
|
119
125
|
"worklet";
|
|
120
126
|
|
|
121
|
-
(0, _readScreenAnimationRevisions.readScreenAnimationRevisions)(screenInterpolatorPropsRevision, ancestorScreenAnimationSources, descendantScreenAnimationSources);
|
|
127
|
+
(0, _readScreenAnimationRevisions.readScreenAnimationRevisions)(screenInterpolatorPropsRevision, ancestorScreenAnimationSources, descendantScreenAnimationSources, interpolatorSharedValues);
|
|
122
128
|
const props = screenInterpolatorProps.get();
|
|
123
129
|
const {
|
|
124
130
|
current,
|
package/lib/commonjs/shared/providers/screen/styles/hooks/use-interpolated-style-maps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["_react","require","_reactNativeReanimated","_constants","_animation","_system","_logger","_animation2","_useBuildBoundsAccessor","_useBuildTransitionAccessor","_readScreenAnimationRevisions","_selectedInterpolatorOptions","_descriptors","_options","_collectInterpolatorSharedValues","_normalizeSlots","_openingPhase","_stripInterpolatorOptions","NO_STYLE_LAYERS","normalizeRawStyleMap","rawStyleMap","NO_STYLES","stylesMap","normalizeSlots","stripInterpolatorOptions","runInterpolator","interpolator","props","progress","next","bounds","transition","undefined","raw","_","__DEV__","logger","warn","appendLayer","layers","result","push","useInterpolatedStylesMap","currentScreenKey","useDescriptorsStore","s","derivations","nextScreenKey","screenOptions","useScreenOptionsContext","screenInterpolatorProps","screenInterpolatorPropsRevision","selectedInterpolatorOptions","nextInterpolator","currentInterpolator","ancestorScreenAnimationSources","descendantScreenAnimationSources","useScreenAnimationContext","boundsAccessor","useBuildBoundsAccessor","useBuildTransitionAccessor","nextInterpolatorReady","useSharedValue","interpolatorSharedValues","useMemo","collectInterpolatorSharedValues","activeScreenKey","entering","activeEntering","transitionProgress","activeTransitionProgress","AnimationStore","getBag","pendingLifecycleRequestKind","activePendingLifecycleRequestKind","SystemStore","isGesturingDuringCloseAnimation","localStylesMaps","useDerivedValue","readScreenAnimationRevisions","get","current","isDragging","gesture","dragging","isNextClosing","closing","set","isInGestureMode","isPendingOpen","LifecycleTransitionRequestKind","Open","activeOpening","currentOwnsInterpolator","isOpeningBeforeStart","interpolatorOptionsOwner","selectedProgress","selectedNext","currentResult","syncSelectedInterpolatorOptions","options","syncScreenOptionsOverrides","nextResult","length","exports"],"sourceRoot":"../../../../../../../src","sources":["shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,sBAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AASA,IAAAK,OAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,uBAAA,GAAAP,OAAA;AACA,IAAAQ,2BAAA,GAAAR,OAAA;AAEA,IAAAS,6BAAA,GAAAT,OAAA;AACA,IAAAU,4BAAA,G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AM,KAAK,CAAC,EAAE;MACxB,OAAOrF,eAAe;IACvB;IAEA,OAAOqB,MAAM;EACd,CAAC,CAAC;EAEF,OAAO;IACNsC,eAAe;IACfhB;EACD,CAAC;AACF,CAAC;AAAC2C,OAAA,CAAA9D,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
package/lib/module/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export const readScreenAnimationRevisions = (screenInterpolatorPropsRevision, ancestorScreenAnimationSources, descendantScreenAnimationSources) => {
|
|
3
|
+
export const readScreenAnimationRevisions = (screenInterpolatorPropsRevision, ancestorScreenAnimationSources, descendantScreenAnimationSources, screenInterpolatorExternalDeps) => {
|
|
4
4
|
"worklet";
|
|
5
5
|
|
|
6
6
|
screenInterpolatorPropsRevision.get();
|
|
@@ -11,5 +11,10 @@ export const readScreenAnimationRevisions = (screenInterpolatorPropsRevision, an
|
|
|
11
11
|
for (let index = 0; index < descendantSources.length; index++) {
|
|
12
12
|
descendantSources[index]?.source.screenInterpolatorPropsRevision.get();
|
|
13
13
|
}
|
|
14
|
+
if (screenInterpolatorExternalDeps) {
|
|
15
|
+
for (let index = 0; index < screenInterpolatorExternalDeps.length; index++) {
|
|
16
|
+
screenInterpolatorExternalDeps[index]?.get();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
14
19
|
};
|
|
15
20
|
//# sourceMappingURL=read-screen-animation-revisions.js.map
|
package/lib/module/shared/providers/screen/animation/helpers/read-screen-animation-revisions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["readScreenAnimationRevisions","screenInterpolatorPropsRevision","ancestorScreenAnimationSources","descendantScreenAnimationSources","get","index","length","descendantSources","source"],"sourceRoot":"../../../../../../../src","sources":["shared/providers/screen/animation/helpers/read-screen-animation-revisions.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["readScreenAnimationRevisions","screenInterpolatorPropsRevision","ancestorScreenAnimationSources","descendantScreenAnimationSources","screenInterpolatorExternalDeps","get","index","length","descendantSources","source"],"sourceRoot":"../../../../../../../src","sources":["shared/providers/screen/animation/helpers/read-screen-animation-revisions.ts"],"mappings":";;AASA,OAAO,MAAMA,4BAA4B,GAAGA,CAC3CC,+BAAgE,EAChEC,8BAAuD,EACvDC,gCAAkE,EAClEC,8BAA+D,KAC3D;EACJ,SAAS;;EACTH,+BAA+B,CAACI,GAAG,CAAC,CAAC;EAErC,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGJ,8BAA8B,CAACK,MAAM,EAAED,KAAK,EAAE,EAAE;IAC3EJ,8BAA8B,CAC7BI,KAAK,CACL,EAAEL,+BAA+B,CAACI,GAAG,CAAC,CAAC;EACzC;EAEA,MAAMG,iBAAiB,GAAGL,gCAAgC,CAACE,GAAG,CAAC,CAAC;EAChE,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGE,iBAAiB,CAACD,MAAM,EAAED,KAAK,EAAE,EAAE;IAC9DE,iBAAiB,CAACF,KAAK,CAAC,EAAEG,MAAM,CAACR,+BAA+B,CAACI,GAAG,CAAC,CAAC;EACvE;EAEA,IAAID,8BAA8B,EAAE;IACnC,KACC,IAAIE,KAAK,GAAG,CAAC,EACbA,KAAK,GAAGF,8BAA8B,CAACG,MAAM,EAC7CD,KAAK,EAAE,EACN;MACDF,8BAA8B,CAACE,KAAK,CAAC,EAAED,GAAG,CAAC,CAAC;IAC7C;EACD;AACD,CAAC","ignoreList":[]}
|
package/lib/module/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const isSharedValueLike = value => value?._isReanimatedSharedValue === true;
|
|
4
|
+
const getWorkletClosure = value => {
|
|
5
|
+
if (value === null || typeof value !== "object" && typeof value !== "function") {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
const closure = value.__closure;
|
|
9
|
+
return closure && typeof closure === "object" ? closure : undefined;
|
|
10
|
+
};
|
|
11
|
+
const isPlainObject = value => value !== null && typeof value === "object" && Object.getPrototypeOf(value) === Object.prototype;
|
|
12
|
+
export const collectInterpolatorSharedValues = interpolators => {
|
|
13
|
+
const sharedValues = [];
|
|
14
|
+
const seen = new Set();
|
|
15
|
+
const visit = value => {
|
|
16
|
+
if (value === null || value === undefined || seen.has(value)) {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
seen.add(value);
|
|
20
|
+
if (isSharedValueLike(value)) {
|
|
21
|
+
sharedValues.push(value);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (typeof value === "function") {
|
|
25
|
+
visit(getWorkletClosure(value));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (Array.isArray(value)) {
|
|
29
|
+
for (let index = 0; index < value.length; index++) {
|
|
30
|
+
visit(value[index]);
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (isPlainObject(value)) {
|
|
35
|
+
for (const item of Object.values(value)) {
|
|
36
|
+
visit(item);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
for (let index = 0; index < interpolators.length; index++) {
|
|
41
|
+
visit(getWorkletClosure(interpolators[index]));
|
|
42
|
+
}
|
|
43
|
+
return sharedValues;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=collect-interpolator-shared-values.js.map
|
package/lib/module/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["isSharedValueLike","value","_isReanimatedSharedValue","getWorkletClosure","undefined","closure","__closure","isPlainObject","Object","getPrototypeOf","prototype","collectInterpolatorSharedValues","interpolators","sharedValues","seen","Set","visit","has","add","push","Array","isArray","index","length","item","values"],"sourceRoot":"../../../../../../../src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AC,EAAEA,KAAK,GAAGrB,KAAK,CAACsB,MAAM,EAAED,KAAK,EAAE,EAAE;QAClDN,KAAK,CAACf,KAAK,CAACqB,KAAK,CAAC,CAAC;MACpB;MACA;IACD;IAEA,IAAIf,aAAa,CAACN,KAAK,CAAC,EAAE;MACzB,KAAK,MAAMuB,IAAI,IAAIhB,MAAM,CAACiB,MAAM,CAACxB,KAAK,CAAC,EAAE;QACxCe,KAAK,CAACQ,IAAI,CAAC;MACZ;IACD;EACD,CAAC;EAED,KAAK,IAAIF,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGV,aAAa,CAACW,MAAM,EAAED,KAAK,EAAE,EAAE;IAC1DN,KAAK,CAACb,iBAAiB,CAACS,aAAa,CAACU,KAAK,CAAC,CAAC,CAAC;EAC/C;EAEA,OAAOT,YAAY;AACpB,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { useMemo } from "react";
|
|
3
4
|
import { useDerivedValue, useSharedValue } from "react-native-reanimated";
|
|
4
5
|
import { NO_STYLES } from "../../../../constants";
|
|
5
6
|
import { AnimationStore } from "../../../../stores/animation.store";
|
|
@@ -12,6 +13,7 @@ import { readScreenAnimationRevisions } from "../../animation/helpers/read-scree
|
|
|
12
13
|
import { syncSelectedInterpolatorOptions } from "../../animation/helpers/selected-interpolator-options";
|
|
13
14
|
import { useDescriptorsStore } from "../../descriptors";
|
|
14
15
|
import { syncScreenOptionsOverrides, useScreenOptionsContext } from "../../options";
|
|
16
|
+
import { collectInterpolatorSharedValues } from "../helpers/collect-interpolator-shared-values";
|
|
15
17
|
import { normalizeSlots } from "../helpers/normalize-slots";
|
|
16
18
|
import { isOpeningBeforeStart } from "../helpers/opening-phase";
|
|
17
19
|
import { stripInterpolatorOptions } from "../helpers/strip-interpolator-options";
|
|
@@ -102,6 +104,10 @@ export const useInterpolatedStylesMap = () => {
|
|
|
102
104
|
const boundsAccessor = useBuildBoundsAccessor();
|
|
103
105
|
const transition = useBuildTransitionAccessor();
|
|
104
106
|
const nextInterpolatorReady = useSharedValue(0);
|
|
107
|
+
|
|
108
|
+
// In some cases, a user may want to use external shared values to drive animations in the interpoaltor.
|
|
109
|
+
// We can now support this by collecting those shared values and reading them here to trigger an update.
|
|
110
|
+
const interpolatorSharedValues = useMemo(() => collectInterpolatorSharedValues([currentInterpolator, nextInterpolator]), [currentInterpolator, nextInterpolator]);
|
|
105
111
|
const activeScreenKey = nextScreenKey ?? currentScreenKey;
|
|
106
112
|
const {
|
|
107
113
|
entering: activeEntering,
|
|
@@ -114,7 +120,7 @@ export const useInterpolatedStylesMap = () => {
|
|
|
114
120
|
const localStylesMaps = useDerivedValue(() => {
|
|
115
121
|
"worklet";
|
|
116
122
|
|
|
117
|
-
readScreenAnimationRevisions(screenInterpolatorPropsRevision, ancestorScreenAnimationSources, descendantScreenAnimationSources);
|
|
123
|
+
readScreenAnimationRevisions(screenInterpolatorPropsRevision, ancestorScreenAnimationSources, descendantScreenAnimationSources, interpolatorSharedValues);
|
|
118
124
|
const props = screenInterpolatorProps.get();
|
|
119
125
|
const {
|
|
120
126
|
current,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useDerivedValue","useSharedValue","NO_STYLES","AnimationStore","LifecycleTransitionRequestKind","SystemStore","logger","useScreenAnimationContext","useBuildBoundsAccessor","useBuildTransitionAccessor","readScreenAnimationRevisions","syncSelectedInterpolatorOptions","useDescriptorsStore","syncScreenOptionsOverrides","useScreenOptionsContext","normalizeSlots","isOpeningBeforeStart","stripInterpolatorOptions","NO_STYLE_LAYERS","normalizeRawStyleMap","rawStyleMap","stylesMap","runInterpolator","interpolator","props","progress","next","bounds","transition","undefined","raw","_","__DEV__","warn","appendLayer","layers","result","push","useInterpolatedStylesMap","currentScreenKey","s","derivations","nextScreenKey","screenOptions","screenInterpolatorProps","screenInterpolatorPropsRevision","selectedInterpolatorOptions","nextInterpolator","currentInterpolator","ancestorScreenAnimationSources","descendantScreenAnimationSources","boundsAccessor","nextInterpolatorReady","activeScreenKey","entering","activeEntering","transitionProgress","activeTransitionProgress","getBag","pendingLifecycleRequestKind","activePendingLifecycleRequestKind","isGesturingDuringCloseAnimation","localStylesMaps","get","current","isDragging","gesture","dragging","isNextClosing","closing","set","isInGestureMode","isPendingOpen","Open","activeOpening","currentOwnsInterpolator","interpolatorOptionsOwner","selectedProgress","selectedNext","currentResult","options","nextResult","length"],"sourceRoot":"../../../../../../../src","sources":["shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx"],"mappings":";;AAAA,SAASA,eAAe,EAAEC,cAAc,QAAQ,yBAAyB;AACzE,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,cAAc,QAAQ,oCAAoC;AACnE,SACCC,8BAA8B,EAC9BC,WAAW,QACL,iCAAiC;AAMxC,SAASC,MAAM,QAAQ,0BAA0B;AACjD,SAASC,yBAAyB,QAAQ,iBAAiB;AAC3D,SAASC,sBAAsB,QAAQ,6DAA6D;AACpG,SAASC,0BAA0B,QAAQ,iEAAiE;AAE5G,SAASC,4BAA4B,QAAQ,yDAAyD;AACtG,SAASC,+BAA+B,QAAQ,uDAAuD;AACvG,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SACCC,0BAA0B,EAC1BC,uBAAuB,QACjB,eAAe;AACtB,SAASC,cAAc,QAAQ,4BAA4B;AAC3D,SAASC,oBAAoB,QAAQ,0BAA0B;AAE/D,SAASC,wBAAwB,QAAQ,uCAAuC;AAEhF,MAAMC,eAAiC,GAAG,EAAE;AAgB5C,MAAMC,oBAAoB,GACzBC,WAAoD,IAChD;EACJ,SAAS;;EAET,IAAI,CAACA,WAAW,EAAE;IACjB,
|
|
1
|
+
{"version":3,"names":["useMemo","useDerivedValue","useSharedValue","NO_STYLES","AnimationStore","LifecycleTransitionRequestKind","SystemStore","logger","useScreenAnimationContext","useBuildBoundsAccessor","useBuildTransitionAccessor","readScreenAnimationRevisions","syncSelectedInterpolatorOptions","useDescriptorsStore","syncScreenOptionsOverrides","useScreenOptionsContext","collectInterpolatorSharedValues","normalizeSlots","isOpeningBeforeStart","stripInterpolatorOptions","NO_STYLE_LAYERS","normalizeRawStyleMap","rawStyleMap","stylesMap","runInterpolator","interpolator","props","progress","next","bounds","transition","undefined","raw","_","__DEV__","warn","appendLayer","layers","result","push","useInterpolatedStylesMap","currentScreenKey","s","derivations","nextScreenKey","screenOptions","screenInterpolatorProps","screenInterpolatorPropsRevision","selectedInterpolatorOptions","nextInterpolator","currentInterpolator","ancestorScreenAnimationSources","descendantScreenAnimationSources","boundsAccessor","nextInterpolatorReady","interpolatorSharedValues","activeScreenKey","entering","activeEntering","transitionProgress","activeTransitionProgress","getBag","pendingLifecycleRequestKind","activePendingLifecycleRequestKind","isGesturingDuringCloseAnimation","localStylesMaps","get","current","isDragging","gesture","dragging","isNextClosing","closing","set","isInGestureMode","isPendingOpen","Open","activeOpening","currentOwnsInterpolator","interpolatorOptionsOwner","selectedProgress","selectedNext","currentResult","options","nextResult","length"],"sourceRoot":"../../../../../../../src","sources":["shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx"],"mappings":";;AAAA,SAASA,OAAO,QAAQ,OAAO;AAC/B,SAASC,eAAe,EAAEC,cAAc,QAAQ,yBAAyB;AACzE,SAASC,SAAS,QAAQ,uBAAuB;AACjD,SAASC,cAAc,QAAQ,oCAAoC;AACnE,SACCC,8BAA8B,EAC9BC,WAAW,QACL,iCAAiC;AAMxC,SAASC,MAAM,QAAQ,0BAA0B;AACjD,SAASC,yBAAyB,QAAQ,iBAAiB;AAC3D,SAASC,sBAAsB,QAAQ,6DAA6D;AACpG,SAASC,0BAA0B,QAAQ,iEAAiE;AAE5G,SAASC,4BAA4B,QAAQ,yDAAyD;AACtG,SAASC,+BAA+B,QAAQ,uDAAuD;AACvG,SAASC,mBAAmB,QAAQ,mBAAmB;AACvD,SACCC,0BAA0B,EAC1BC,uBAAuB,QACjB,eAAe;AACtB,SAASC,+BAA+B,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@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
1
2
|
import type { ScreenAnimationDescendantSources, ScreenAnimationSource, ScreenInterpolatorPropsRevision } from "../types";
|
|
2
|
-
|
|
3
|
+
type ScreenInterpolatorExternalDeps = Pick<SharedValue<unknown>, "get">[];
|
|
4
|
+
export declare const readScreenAnimationRevisions: (screenInterpolatorPropsRevision: ScreenInterpolatorPropsRevision, ancestorScreenAnimationSources: ScreenAnimationSource[], descendantScreenAnimationSources: ScreenAnimationDescendantSources, screenInterpolatorExternalDeps?: ScreenInterpolatorExternalDeps) => void;
|
|
5
|
+
export {};
|
|
3
6
|
//# sourceMappingURL=read-screen-animation-revisions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-screen-animation-revisions.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/animation/helpers/read-screen-animation-revisions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,gCAAgC,EAChC,qBAAqB,EACrB,+BAA+B,EAC/B,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,4BAA4B,GACxC,iCAAiC,+BAA+B,EAChE,gCAAgC,qBAAqB,EAAE,EACvD,kCAAkC,gCAAgC,
|
|
1
|
+
{"version":3,"file":"read-screen-animation-revisions.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/animation/helpers/read-screen-animation-revisions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EACX,gCAAgC,EAChC,qBAAqB,EACrB,+BAA+B,EAC/B,MAAM,UAAU,CAAC;AAElB,KAAK,8BAA8B,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC;AAE1E,eAAO,MAAM,4BAA4B,GACxC,iCAAiC,+BAA+B,EAChE,gCAAgC,qBAAqB,EAAE,EACvD,kCAAkC,gCAAgC,EAClE,iCAAiC,8BAA8B,SAyB/D,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
2
|
+
import type { ScreenStyleInterpolator } from "../../../../types/animation.types";
|
|
3
|
+
export declare const collectInterpolatorSharedValues: (interpolators: Array<ScreenStyleInterpolator | undefined>) => SharedValue<unknown>[];
|
|
4
|
+
//# sourceMappingURL=collect-interpolator-shared-values.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collect-interpolator-shared-values.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/styles/helpers/collect-interpolator-shared-values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAgCjF,eAAO,MAAM,+BAA+B,GAC3C,eAAe,KAAK,CAAC,uBAAuB,GAAG,SAAS,CAAC,KACvD,WAAW,CAAC,OAAO,CAAC,EAuCtB,CAAC"}
|
package/lib/typescript/shared/providers/screen/styles/hooks/use-interpolated-style-maps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-interpolated-style-maps.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"use-interpolated-style-maps.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/styles/hooks/use-interpolated-style-maps.tsx"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAmFvE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,wBAAwB;;;CAsJpC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
1
2
|
import type {
|
|
2
3
|
ScreenAnimationDescendantSources,
|
|
3
4
|
ScreenAnimationSource,
|
|
4
5
|
ScreenInterpolatorPropsRevision,
|
|
5
6
|
} from "../types";
|
|
6
7
|
|
|
8
|
+
type ScreenInterpolatorExternalDeps = Pick<SharedValue<unknown>, "get">[];
|
|
9
|
+
|
|
7
10
|
export const readScreenAnimationRevisions = (
|
|
8
11
|
screenInterpolatorPropsRevision: ScreenInterpolatorPropsRevision,
|
|
9
12
|
ancestorScreenAnimationSources: ScreenAnimationSource[],
|
|
10
13
|
descendantScreenAnimationSources: ScreenAnimationDescendantSources,
|
|
14
|
+
screenInterpolatorExternalDeps?: ScreenInterpolatorExternalDeps,
|
|
11
15
|
) => {
|
|
12
16
|
"worklet";
|
|
13
17
|
screenInterpolatorPropsRevision.get();
|
|
@@ -22,4 +26,14 @@ export const readScreenAnimationRevisions = (
|
|
|
22
26
|
for (let index = 0; index < descendantSources.length; index++) {
|
|
23
27
|
descendantSources[index]?.source.screenInterpolatorPropsRevision.get();
|
|
24
28
|
}
|
|
29
|
+
|
|
30
|
+
if (screenInterpolatorExternalDeps) {
|
|
31
|
+
for (
|
|
32
|
+
let index = 0;
|
|
33
|
+
index < screenInterpolatorExternalDeps.length;
|
|
34
|
+
index++
|
|
35
|
+
) {
|
|
36
|
+
screenInterpolatorExternalDeps[index]?.get();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
25
39
|
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { SharedValue } from "react-native-reanimated";
|
|
2
|
+
import type { ScreenStyleInterpolator } from "../../../../types/animation.types";
|
|
3
|
+
|
|
4
|
+
type WorkletClosure = Record<string, unknown>;
|
|
5
|
+
|
|
6
|
+
type ClosureCarrier = {
|
|
7
|
+
__closure?: WorkletClosure;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type SharedValueLike = SharedValue<unknown> & {
|
|
11
|
+
_isReanimatedSharedValue: true;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const isSharedValueLike = (value: unknown): value is SharedValueLike =>
|
|
15
|
+
(value as Partial<SharedValueLike> | null)?._isReanimatedSharedValue === true;
|
|
16
|
+
|
|
17
|
+
const getWorkletClosure = (value: unknown): WorkletClosure | undefined => {
|
|
18
|
+
if (
|
|
19
|
+
value === null ||
|
|
20
|
+
(typeof value !== "object" && typeof value !== "function")
|
|
21
|
+
) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const closure = (value as Partial<ClosureCarrier>).__closure;
|
|
26
|
+
return closure && typeof closure === "object" ? closure : undefined;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const isPlainObject = (value: unknown): value is Record<string, unknown> =>
|
|
30
|
+
value !== null &&
|
|
31
|
+
typeof value === "object" &&
|
|
32
|
+
Object.getPrototypeOf(value) === Object.prototype;
|
|
33
|
+
|
|
34
|
+
export const collectInterpolatorSharedValues = (
|
|
35
|
+
interpolators: Array<ScreenStyleInterpolator | undefined>,
|
|
36
|
+
): SharedValue<unknown>[] => {
|
|
37
|
+
const sharedValues: SharedValue<unknown>[] = [];
|
|
38
|
+
const seen = new Set<unknown>();
|
|
39
|
+
|
|
40
|
+
const visit = (value: unknown) => {
|
|
41
|
+
if (value === null || value === undefined || seen.has(value)) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
seen.add(value);
|
|
45
|
+
|
|
46
|
+
if (isSharedValueLike(value)) {
|
|
47
|
+
sharedValues.push(value);
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof value === "function") {
|
|
52
|
+
visit(getWorkletClosure(value));
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (Array.isArray(value)) {
|
|
57
|
+
for (let index = 0; index < value.length; index++) {
|
|
58
|
+
visit(value[index]);
|
|
59
|
+
}
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (isPlainObject(value)) {
|
|
64
|
+
for (const item of Object.values(value)) {
|
|
65
|
+
visit(item);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
for (let index = 0; index < interpolators.length; index++) {
|
|
71
|
+
visit(getWorkletClosure(interpolators[index]));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return sharedValues;
|
|
75
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
1
2
|
import { useDerivedValue, useSharedValue } from "react-native-reanimated";
|
|
2
3
|
import { NO_STYLES } from "../../../../constants";
|
|
3
4
|
import { AnimationStore } from "../../../../stores/animation.store";
|
|
@@ -22,6 +23,7 @@ import {
|
|
|
22
23
|
syncScreenOptionsOverrides,
|
|
23
24
|
useScreenOptionsContext,
|
|
24
25
|
} from "../../options";
|
|
26
|
+
import { collectInterpolatorSharedValues } from "../helpers/collect-interpolator-shared-values";
|
|
25
27
|
import { normalizeSlots } from "../helpers/normalize-slots";
|
|
26
28
|
import { isOpeningBeforeStart } from "../helpers/opening-phase";
|
|
27
29
|
import type { LocalStyleLayers } from "../helpers/resolve-slot-styles";
|
|
@@ -146,6 +148,14 @@ export const useInterpolatedStylesMap = () => {
|
|
|
146
148
|
const transition = useBuildTransitionAccessor();
|
|
147
149
|
const nextInterpolatorReady = useSharedValue(0);
|
|
148
150
|
|
|
151
|
+
// In some cases, a user may want to use external shared values to drive animations in the interpoaltor.
|
|
152
|
+
// We can now support this by collecting those shared values and reading them here to trigger an update.
|
|
153
|
+
const interpolatorSharedValues = useMemo(
|
|
154
|
+
() =>
|
|
155
|
+
collectInterpolatorSharedValues([currentInterpolator, nextInterpolator]),
|
|
156
|
+
[currentInterpolator, nextInterpolator],
|
|
157
|
+
);
|
|
158
|
+
|
|
149
159
|
const activeScreenKey = nextScreenKey ?? currentScreenKey;
|
|
150
160
|
const {
|
|
151
161
|
entering: activeEntering,
|
|
@@ -162,6 +172,7 @@ export const useInterpolatedStylesMap = () => {
|
|
|
162
172
|
screenInterpolatorPropsRevision,
|
|
163
173
|
ancestorScreenAnimationSources,
|
|
164
174
|
descendantScreenAnimationSources,
|
|
175
|
+
interpolatorSharedValues,
|
|
165
176
|
);
|
|
166
177
|
const props = screenInterpolatorProps.get();
|
|
167
178
|
|