react-native-screen-transitions 3.9.0-alpha.0 → 3.9.0-alpha.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/components/boundary/create-boundary-component.js +10 -2
- package/lib/commonjs/shared/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/portal-boundary-host.js +8 -2
- package/lib/commonjs/shared/components/boundary/portal/components/portal-boundary-host.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/portal-provider.js +5 -2
- package/lib/commonjs/shared/components/boundary/portal/components/portal-provider.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/components/portal.js +7 -4
- package/lib/commonjs/shared/components/boundary/portal/components/portal.js.map +1 -1
- package/lib/commonjs/shared/components/boundary/portal/teleport.js +23 -0
- package/lib/commonjs/shared/components/boundary/portal/teleport.js.map +1 -0
- package/lib/commonjs/shared/hooks/navigation/use-stack.js +17 -2
- package/lib/commonjs/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js +4 -13
- package/lib/commonjs/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/stack-progress.js +23 -12
- package/lib/commonjs/shared/providers/screen/animation/helpers/stack-progress.js.map +1 -1
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js +1 -0
- package/lib/commonjs/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
- package/lib/commonjs/shared/stores/animation.store.js +2 -0
- package/lib/commonjs/shared/stores/animation.store.js.map +1 -1
- package/lib/module/shared/components/boundary/create-boundary-component.js +11 -3
- package/lib/module/shared/components/boundary/create-boundary-component.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/portal-boundary-host.js +8 -2
- package/lib/module/shared/components/boundary/portal/components/portal-boundary-host.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/portal-provider.js +4 -1
- package/lib/module/shared/components/boundary/portal/components/portal-provider.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/components/portal.js +7 -4
- package/lib/module/shared/components/boundary/portal/components/portal.js.map +1 -1
- package/lib/module/shared/components/boundary/portal/teleport.js +19 -0
- package/lib/module/shared/components/boundary/portal/teleport.js.map +1 -0
- package/lib/module/shared/hooks/navigation/use-stack.js +19 -4
- package/lib/module/shared/hooks/navigation/use-stack.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js +5 -14
- package/lib/module/shared/providers/screen/animation/helpers/pipeline.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/stack-progress.js +20 -10
- package/lib/module/shared/providers/screen/animation/helpers/stack-progress.js.map +1 -1
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js +1 -0
- package/lib/module/shared/providers/screen/animation/helpers/use-build-transition-state.js.map +1 -1
- package/lib/module/shared/stores/animation.store.js +2 -0
- package/lib/module/shared/stores/animation.store.js.map +1 -1
- package/lib/typescript/shared/components/boundary/create-boundary-component.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/portal-boundary-host.d.ts +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/portal-boundary-host.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/portal-provider.d.ts +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/portal-provider.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/components/portal.d.ts.map +1 -1
- package/lib/typescript/shared/components/boundary/portal/teleport.d.ts +6 -0
- package/lib/typescript/shared/components/boundary/portal/teleport.d.ts.map +1 -0
- package/lib/typescript/shared/hooks/navigation/use-stack.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/types.d.ts +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/types.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/pipeline.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/stack-progress.d.ts +2 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/stack-progress.d.ts.map +1 -1
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts +1 -0
- package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map +1 -1
- package/lib/typescript/shared/stores/animation.store.d.ts +1 -0
- package/lib/typescript/shared/stores/animation.store.d.ts.map +1 -1
- package/package.json +6 -1
- package/src/shared/components/boundary/create-boundary-component.tsx +17 -4
- package/src/shared/components/boundary/portal/components/portal-boundary-host.tsx +10 -3
- package/src/shared/components/boundary/portal/components/portal-provider.tsx +5 -1
- package/src/shared/components/boundary/portal/components/portal.tsx +12 -7
- package/src/shared/components/boundary/portal/teleport.ts +21 -0
- package/src/shared/hooks/navigation/use-stack.tsx +32 -1
- package/src/shared/providers/screen/animation/helpers/hydrate-transition-state/types.ts +1 -0
- package/src/shared/providers/screen/animation/helpers/pipeline.ts +13 -19
- package/src/shared/providers/screen/animation/helpers/stack-progress.ts +31 -16
- package/src/shared/providers/screen/animation/helpers/use-build-transition-state.ts +2 -0
- package/src/shared/stores/animation.store.ts +3 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-stack.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/navigation/use-stack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAEN,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"use-stack.d.ts","sourceRoot":"","sources":["../../../../../src/shared/hooks/navigation/use-stack.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAEN,KAAK,SAAS,EAOd,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;A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ACF,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,iBAAiB,CAAC;CACzB,2CA4BA;AAYD,wBAAgB,QAAQ,CAAC,CAAC,SAAS,iBAAiB,GAAG,iBAAiB,KAAK,CAAC,CAAC;AAC/E,wBAAgB,QAAQ,CAAC,CAAC,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC"}
|
package/lib/typescript/shared/providers/screen/animation/helpers/hydrate-transition-state/types.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import type { BaseStackRoute } from "../../../../../types/stack.types";
|
|
|
7
7
|
export type BuiltState = {
|
|
8
8
|
transitionProgress: SharedValue<number>;
|
|
9
9
|
visualProgress: SharedValue<number>;
|
|
10
|
+
stackProgress: SharedValue<number>;
|
|
10
11
|
willAnimate: SharedValue<number>;
|
|
11
12
|
closing: SharedValue<number>;
|
|
12
13
|
progressAnimating: SharedValue<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/providers/screen/animation/helpers/hydrate-transition-state/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EACX,uBAAuB,EACvB,qBAAqB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAEvE,MAAM,MAAM,UAAU,GAAG;IACxB,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,eAAe,CAAC;IACzB,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,EAAE,uBAAuB,CAAC;IACjC,WAAW,EAAE,uBAAuB,CAAC;IACrC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3C,qBAAqB,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAClD,cAAc,EAAE,WAAW,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACxD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAClC,SAAS,EAAE,qBAAqB,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../../src/shared/providers/screen/animation/helpers/hydrate-transition-state/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,KAAK,EACX,uBAAuB,EACvB,qBAAqB,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAA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}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/animation/helpers/pipeline.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/animation/helpers/pipeline.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,YAAY,EACjB,KAAK,WAAW,EAGhB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,KAAK,EACX,wBAAwB,EACxB,uBAAuB,EACvB,MAAM,mCAAmC,CAAC;AAM3C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAInF,MAAM,MAAM,uBAAuB,GAAG,IAAI,CACzC,wBAAwB,EACxB,QAAQ,GAAG,YAAY,CACvB,CAAC;AAEF,UAAU,uBAAuB;IAChC,uBAAuB,EAAE,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAC9D,+BAA+B,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC;IACtD,2BAA2B,EAAE,WAAW,CAAC,2BAA2B,CAAC,CAAC;IACtE,gBAAgB,EAAE,uBAAuB,GAAG,SAAS,CAAC;IACtD,mBAAmB,EAAE,uBAAuB,GAAG,SAAS,CAAC;CACzD;AA0BD,wBAAgB,0BAA0B,IAAI,uBAAuB,CAqHpE"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { SharedValue } from "react-native-reanimated";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const syncStackProgressValues: (visualProgressValues: SharedValue<number>[], stackProgressValues: SharedValue<number>[]) => void;
|
|
3
|
+
export declare const resolveStackProgress: (stackProgress: SharedValue<number> | undefined, fallbackProgress: number, currentProgress: number, previousCurrentProgress: number | undefined, nextProgress: number | undefined, previousNextProgress: number | undefined) => number;
|
|
3
4
|
//# sourceMappingURL=stack-progress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stack-progress.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/animation/helpers/stack-progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"stack-progress.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/animation/helpers/stack-progress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE3D,eAAO,MAAM,uBAAuB,GACnC,sBAAsB,WAAW,CAAC,MAAM,CAAC,EAAE,EAC3C,qBAAqB,WAAW,CAAC,MAAM,CAAC,EAAE,SAa1C,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAChC,eAAe,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,EAC9C,kBAAkB,MAAM,EACxB,iBAAiB,MAAM,EACvB,yBAAyB,MAAM,GAAG,SAAS,EAC3C,cAAc,MAAM,GAAG,SAAS,EAChC,sBAAsB,MAAM,GAAG,SAAS,WAkBxC,CAAC"}
|
package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type { BaseDescriptor } from "../../descriptors";
|
|
|
6
6
|
type BuiltState = {
|
|
7
7
|
transitionProgress: SharedValue<number>;
|
|
8
8
|
visualProgress: SharedValue<number>;
|
|
9
|
+
stackProgress: SharedValue<number>;
|
|
9
10
|
willAnimate: SharedValue<number>;
|
|
10
11
|
closing: SharedValue<number>;
|
|
11
12
|
progressAnimating: SharedValue<number>;
|
package/lib/typescript/shared/providers/screen/animation/helpers/use-build-transition-state.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-build-transition-state.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/animation/helpers/use-build-transition-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,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C;AAEF,eAAO,MAAM,uBAAuB,GACnC,YAAY,cAAc,GAAG,SAAS,KACpC,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"use-build-transition-state.d.ts","sourceRoot":"","sources":["../../../../../../../src/shared/providers/screen/animation/helpers/use-build-transition-state.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAG3D,OAAO,EAEN,KAAK,eAAe,EACpB,MAAM,kCAAkC,CAAC;AAG1C,OAAO,KAAK,EACX,cAAc,EACd,MAAM,EACN,qBAAqB,EACrB,mBAAmB,EACnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAIxD,KAAK,UAAU,GAAG;IACjB,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC9B,OAAO,EAAE,eAAe,CAAC;IACzB,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,EAAE,uBAAuB,CAAC;IACjC,WAAW,EAAE,uBAAuB,CAAC;IACrC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3C,qBAAqB,EAAE,WAAW,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAClD,cAAc,EAAE,WAAW,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACxD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,uBAAuB,EAAE,MAAM,EAAE,CAAC;IAClC,SAAS,EAAE,qBAAqB,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,uBAAuB,GACnC,YAAY,cAAc,GAAG,SAAS,KACpC,UAAU,GAAG,SAgDf,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { type SharedValue } from "react-native-reanimated";
|
|
|
2
2
|
export type AnimationStoreMap = {
|
|
3
3
|
transitionProgress: SharedValue<number>;
|
|
4
4
|
visualProgress: SharedValue<number>;
|
|
5
|
+
stackProgress: SharedValue<number>;
|
|
5
6
|
willAnimate: SharedValue<number>;
|
|
6
7
|
progressAnimating: SharedValue<number>;
|
|
7
8
|
progressSettled: SharedValue<number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animation.store.d.ts","sourceRoot":"","sources":["../../../../src/shared/stores/animation.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,WAAW,EAChB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,MAAM,iBAAiB,GAAG;IAC/B,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9B,CAAC;
|
|
1
|
+
{"version":3,"file":"animation.store.d.ts","sourceRoot":"","sources":["../../../../src/shared/stores/animation.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,WAAW,EAChB,MAAM,yBAAyB,CAAC;AAGjC,MAAM,MAAM,iBAAiB,GAAG;IAC/B,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACxC,cAAc,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACjC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,eAAe,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACrC,OAAO,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC9B,CAAC;AAeF;;;;GAIG;AACH,eAAO,MAAM,cAAc,6DAYzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-screen-transitions",
|
|
3
|
-
"version": "3.9.0-alpha.
|
|
3
|
+
"version": "3.9.0-alpha.1",
|
|
4
4
|
"description": "Easy screen transitions for React Native and Expo",
|
|
5
5
|
"author": "Ed",
|
|
6
6
|
"license": "MIT",
|
|
@@ -87,6 +87,11 @@
|
|
|
87
87
|
"react-native-screens": ">=4.4.0",
|
|
88
88
|
"react-native-teleport": ">=1.1.0 <2.0.0"
|
|
89
89
|
},
|
|
90
|
+
"peerDependenciesMeta": {
|
|
91
|
+
"react-native-teleport": {
|
|
92
|
+
"optional": true
|
|
93
|
+
}
|
|
94
|
+
},
|
|
90
95
|
"devDependencies": {
|
|
91
96
|
"@testing-library/react-native": "13.3.3",
|
|
92
97
|
"@types/react": "~19.1.0",
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
useCallback,
|
|
6
6
|
useImperativeHandle,
|
|
7
7
|
useMemo,
|
|
8
|
+
useRef,
|
|
8
9
|
} from "react";
|
|
9
10
|
import type { View } from "react-native";
|
|
10
11
|
import Animated, {
|
|
@@ -17,11 +18,13 @@ import { useDescriptorsStore } from "../../providers/screen/descriptors";
|
|
|
17
18
|
import { useScreenStyles } from "../../providers/screen/styles";
|
|
18
19
|
import { createPendingPairKey } from "../../stores/bounds/helpers/link-pairs.helpers";
|
|
19
20
|
import { prepareStyleForBounds } from "../../utils/bounds/helpers/styles/styles";
|
|
21
|
+
import { logger } from "../../utils/logger";
|
|
20
22
|
import { useBoundaryPresence } from "./hooks/use-boundary-presence";
|
|
21
23
|
import { useInitialDestinationMeasurement } from "./hooks/use-initial-destination-measurement";
|
|
22
24
|
import { useInitialSourceMeasurement } from "./hooks/use-initial-source-measurement";
|
|
23
25
|
import { useMeasurer } from "./hooks/use-measurer";
|
|
24
26
|
import { useRefreshBoundary } from "./hooks/use-refresh-boundary";
|
|
27
|
+
import { isTeleportAvailable } from "./portal/teleport";
|
|
25
28
|
import {
|
|
26
29
|
BoundaryOwnerProvider,
|
|
27
30
|
useBoundaryOwner,
|
|
@@ -105,20 +108,30 @@ export function createBoundaryComponent<P extends object>(
|
|
|
105
108
|
return { zIndex, elevation };
|
|
106
109
|
});
|
|
107
110
|
|
|
111
|
+
const hasWarned = useRef(false);
|
|
112
|
+
const adjustedPortal = isTeleportAvailable ? portal : undefined;
|
|
113
|
+
|
|
114
|
+
if (!hasWarned.current && !isTeleportAvailable && portal) {
|
|
115
|
+
logger.warn(
|
|
116
|
+
"react-native-teleport is not installed and will fallback to default behavior.",
|
|
117
|
+
);
|
|
118
|
+
hasWarned.current = true;
|
|
119
|
+
}
|
|
120
|
+
|
|
108
121
|
const { contextValue, measuredRef, hasActiveTarget, targetPreparedStyles } =
|
|
109
122
|
useBoundaryOwner({
|
|
110
123
|
ownerRef,
|
|
111
124
|
associatedTargetStyles: runtimeEnabled ? associatedStyles : undefined,
|
|
112
125
|
entryTag,
|
|
113
|
-
portal,
|
|
126
|
+
portal: adjustedPortal,
|
|
114
127
|
});
|
|
115
128
|
|
|
116
129
|
const preparedStyles = targetPreparedStyles ?? ownerPreparedStyles;
|
|
117
130
|
|
|
118
131
|
const portalHost =
|
|
119
|
-
typeof
|
|
120
|
-
? (
|
|
121
|
-
:
|
|
132
|
+
typeof adjustedPortal === "object"
|
|
133
|
+
? (adjustedPortal.attachTo ?? "current-screen")
|
|
134
|
+
: adjustedPortal
|
|
122
135
|
? "current-screen"
|
|
123
136
|
: undefined;
|
|
124
137
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { memo } from "react";
|
|
2
2
|
import type { StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import Animated, { useAnimatedStyle } from "react-native-reanimated";
|
|
4
|
-
import { PortalHost as NativePortalHost } from "react-native-teleport";
|
|
5
4
|
import { NO_STYLES } from "../../../../constants";
|
|
6
5
|
import { AnimationStore } from "../../../../stores/animation.store";
|
|
7
6
|
import { getSourceScreenKeyFromPairKey } from "../../../../stores/bounds/helpers/link-pairs.helpers";
|
|
@@ -9,14 +8,16 @@ import { getLink } from "../../../../stores/bounds/internals/links";
|
|
|
9
8
|
import { GestureStore } from "../../../../stores/gesture.store";
|
|
10
9
|
import { ScrollStore } from "../../../../stores/scroll.store";
|
|
11
10
|
import type { ActivePortalBoundaryHost } from "../stores/portal-boundary-host.store";
|
|
11
|
+
import { NativePortalHost } from "../teleport";
|
|
12
12
|
import { createPortalBoundaryHostName } from "../utils/naming";
|
|
13
13
|
import {
|
|
14
14
|
type PortalOffsetPlacement,
|
|
15
15
|
resolvePortalOffsetStyle,
|
|
16
16
|
} from "../utils/offset-style";
|
|
17
17
|
|
|
18
|
-
const AnimatedPortalBoundaryHost =
|
|
19
|
-
Animated.createAnimatedComponent(NativePortalHost)
|
|
18
|
+
const AnimatedPortalBoundaryHost = NativePortalHost
|
|
19
|
+
? Animated.createAnimatedComponent(NativePortalHost)
|
|
20
|
+
: null;
|
|
20
21
|
|
|
21
22
|
type PortalBoundaryHostProps = {
|
|
22
23
|
host: ActivePortalBoundaryHost;
|
|
@@ -84,6 +85,12 @@ export const PortalBoundaryHost = memo(function PortalBoundaryHost({
|
|
|
84
85
|
});
|
|
85
86
|
});
|
|
86
87
|
|
|
88
|
+
// Without `react-native-teleport` no portal ever mounts a boundary host, so
|
|
89
|
+
// this never renders — the guard just narrows the nullable animated host.
|
|
90
|
+
if (!AnimatedPortalBoundaryHost) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
87
94
|
return (
|
|
88
95
|
<AnimatedPortalBoundaryHost name={hostName} style={[style, hostStyle]} />
|
|
89
96
|
);
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { memo } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { NativePortalProvider } from "../teleport";
|
|
3
3
|
|
|
4
4
|
export const PortalProvider = memo(function PortalProvider({
|
|
5
5
|
children,
|
|
6
6
|
}: {
|
|
7
7
|
children: React.ReactNode;
|
|
8
8
|
}) {
|
|
9
|
+
if (!NativePortalProvider) {
|
|
10
|
+
return children;
|
|
11
|
+
}
|
|
12
|
+
|
|
9
13
|
return <NativePortalProvider>{children}</NativePortalProvider>;
|
|
10
14
|
});
|
|
@@ -16,7 +16,6 @@ import Animated, {
|
|
|
16
16
|
useAnimatedStyle,
|
|
17
17
|
useSharedValue,
|
|
18
18
|
} from "react-native-reanimated";
|
|
19
|
-
import { Portal as NativePortal } from "react-native-teleport";
|
|
20
19
|
import { useDescriptorsStore } from "../../../../providers/screen/descriptors";
|
|
21
20
|
import { useScreenStyles } from "../../../../providers/screen/styles";
|
|
22
21
|
import { AnimationStore } from "../../../../stores/animation.store";
|
|
@@ -33,6 +32,7 @@ import {
|
|
|
33
32
|
mountPortalBoundaryHost,
|
|
34
33
|
unmountPortalBoundaryHost,
|
|
35
34
|
} from "../stores/portal-boundary-host.store";
|
|
35
|
+
import { isTeleportAvailable, NativePortal } from "../teleport";
|
|
36
36
|
import {
|
|
37
37
|
type PortalAttachment,
|
|
38
38
|
resolvePortalAttachmentTargets,
|
|
@@ -44,15 +44,17 @@ import {
|
|
|
44
44
|
import { isTeleportEnabled } from "../utils/teleport-control";
|
|
45
45
|
|
|
46
46
|
type NullableHostNamePortalProps = Omit<
|
|
47
|
-
ComponentProps<typeof NativePortal
|
|
47
|
+
ComponentProps<NonNullable<typeof NativePortal>>,
|
|
48
48
|
"hostName"
|
|
49
49
|
> & {
|
|
50
50
|
hostName?: string | null;
|
|
51
51
|
};
|
|
52
52
|
|
|
53
|
-
const TransitionAwareTeleport =
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
const TransitionAwareTeleport = NativePortal
|
|
54
|
+
? createTransitionAwareComponent(
|
|
55
|
+
NativePortal as ComponentType<NullableHostNamePortalProps>,
|
|
56
|
+
)
|
|
57
|
+
: null;
|
|
56
58
|
|
|
57
59
|
interface PortalProps {
|
|
58
60
|
id?: string;
|
|
@@ -73,7 +75,10 @@ export const Portal = memo(function Portal({
|
|
|
73
75
|
mode = false,
|
|
74
76
|
placeholderRef,
|
|
75
77
|
}: PortalProps) {
|
|
76
|
-
|
|
78
|
+
// Teleporting requires the optional `react-native-teleport` peer. Without it,
|
|
79
|
+
// a portal-enabled boundary degrades to inline rendering (the `return
|
|
80
|
+
// children` path below).
|
|
81
|
+
const isPortalEnabled = !!mode && isTeleportAvailable;
|
|
77
82
|
const portalAttachTarget: BoundaryPortalAttachTarget =
|
|
78
83
|
!mode || mode === true
|
|
79
84
|
? "current-screen"
|
|
@@ -256,7 +261,7 @@ export const Portal = memo(function Portal({
|
|
|
256
261
|
return { width, height };
|
|
257
262
|
});
|
|
258
263
|
|
|
259
|
-
if (isPortalEnabled) {
|
|
264
|
+
if (isPortalEnabled && TransitionAwareTeleport) {
|
|
260
265
|
return (
|
|
261
266
|
<Animated.View
|
|
262
267
|
ref={placeholderRef}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ComponentType } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* `react-native-teleport` is an optional peer dependency. The require sits in a
|
|
5
|
+
* try/catch so Metro treats it as an optional dependency — an absent module no
|
|
6
|
+
* longer fails the bundle, it throws at runtime and the catch swallows it.
|
|
7
|
+
*
|
|
8
|
+
* When teleport is missing, `portal`-enabled boundaries degrade to inline
|
|
9
|
+
* rendering; everything else keeps working.
|
|
10
|
+
*/
|
|
11
|
+
let mod: any = null;
|
|
12
|
+
try {
|
|
13
|
+
mod = require("react-native-teleport");
|
|
14
|
+
} catch {}
|
|
15
|
+
|
|
16
|
+
export const isTeleportAvailable = mod !== null;
|
|
17
|
+
export const NativePortal: ComponentType<any> | null = mod?.Portal ?? null;
|
|
18
|
+
export const NativePortalProvider: ComponentType<any> | null =
|
|
19
|
+
mod?.PortalProvider ?? null;
|
|
20
|
+
export const NativePortalHost: ComponentType<any> | null =
|
|
21
|
+
mod?.PortalHost ?? null;
|
|
@@ -5,10 +5,14 @@ import {
|
|
|
5
5
|
useCallback,
|
|
6
6
|
useContext,
|
|
7
7
|
useLayoutEffect,
|
|
8
|
+
useMemo,
|
|
8
9
|
useRef,
|
|
9
10
|
useSyncExternalStore,
|
|
10
11
|
} from "react";
|
|
12
|
+
import { useDerivedValue } from "react-native-reanimated";
|
|
13
|
+
import { syncStackProgressValues } from "../../providers/screen/animation/helpers/stack-progress";
|
|
11
14
|
import type { StackCoreContextValue } from "../../providers/stack/core.provider";
|
|
15
|
+
import { AnimationStore } from "../../stores/animation.store";
|
|
12
16
|
import type { OverlayProps } from "../../types/overlay.types";
|
|
13
17
|
import type {
|
|
14
18
|
BaseStackDescriptor,
|
|
@@ -87,6 +91,30 @@ const createStackStore = (
|
|
|
87
91
|
const StackContext = createContext<StackStoreApi | null>(null);
|
|
88
92
|
StackContext.displayName = "Stack";
|
|
89
93
|
|
|
94
|
+
function StackProgressOwner({ routeKeys }: { routeKeys: string[] }) {
|
|
95
|
+
const visualProgressValues = useMemo(
|
|
96
|
+
() =>
|
|
97
|
+
routeKeys.map((routeKey) =>
|
|
98
|
+
AnimationStore.getValue(routeKey, "visualProgress"),
|
|
99
|
+
),
|
|
100
|
+
[routeKeys],
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const stackProgressValues = useMemo(
|
|
104
|
+
() =>
|
|
105
|
+
routeKeys.map((routeKey) =>
|
|
106
|
+
AnimationStore.getValue(routeKey, "stackProgress"),
|
|
107
|
+
),
|
|
108
|
+
[routeKeys],
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
useDerivedValue(() => {
|
|
112
|
+
syncStackProgressValues(visualProgressValues, stackProgressValues);
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
90
118
|
export function StackProvider({
|
|
91
119
|
children,
|
|
92
120
|
value,
|
|
@@ -116,7 +144,10 @@ export function StackProvider({
|
|
|
116
144
|
});
|
|
117
145
|
|
|
118
146
|
return (
|
|
119
|
-
<StackContext.Provider value={store}>
|
|
147
|
+
<StackContext.Provider value={store}>
|
|
148
|
+
<StackProgressOwner routeKeys={value.routeKeys} />
|
|
149
|
+
{children}
|
|
150
|
+
</StackContext.Provider>
|
|
120
151
|
);
|
|
121
152
|
}
|
|
122
153
|
|
|
@@ -11,6 +11,7 @@ import type { BaseStackRoute } from "../../../../../types/stack.types";
|
|
|
11
11
|
export type BuiltState = {
|
|
12
12
|
transitionProgress: SharedValue<number>;
|
|
13
13
|
visualProgress: SharedValue<number>;
|
|
14
|
+
stackProgress: SharedValue<number>;
|
|
14
15
|
willAnimate: SharedValue<number>;
|
|
15
16
|
closing: SharedValue<number>;
|
|
16
17
|
progressAnimating: SharedValue<number>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
1
|
import { useWindowDimensions } from "react-native";
|
|
3
2
|
import {
|
|
4
3
|
type DerivedValue,
|
|
@@ -9,7 +8,6 @@ import {
|
|
|
9
8
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
10
9
|
import { DEFAULT_SCREEN_TRANSITION_STATE } from "../../../../constants";
|
|
11
10
|
import { useStack } from "../../../../hooks/navigation/use-stack";
|
|
12
|
-
import { AnimationStore } from "../../../../stores/animation.store";
|
|
13
11
|
import type {
|
|
14
12
|
ScreenInterpolationProps,
|
|
15
13
|
ScreenStyleInterpolator,
|
|
@@ -20,7 +18,7 @@ import { updateDerivations } from "./derivations";
|
|
|
20
18
|
import { hasTransitionsEnabled } from "./has-transitions-enabled";
|
|
21
19
|
import { hydrateTransitionState } from "./hydrate-transition-state";
|
|
22
20
|
import type { SelectedInterpolatorOptions } from "./selected-interpolator-options";
|
|
23
|
-
import {
|
|
21
|
+
import { resolveStackProgress } from "./stack-progress";
|
|
24
22
|
import { useBuildTransitionState } from "./use-build-transition-state";
|
|
25
23
|
|
|
26
24
|
export type ScreenInterpolatorFrame = Omit<
|
|
@@ -61,10 +59,11 @@ const createInitialBaseInterpolatorProps = (
|
|
|
61
59
|
};
|
|
62
60
|
|
|
63
61
|
export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
64
|
-
const
|
|
62
|
+
const transitionsAlwaysOn = useStack(
|
|
63
|
+
(stack) => stack.flags.TRANSITIONS_ALWAYS_ON,
|
|
64
|
+
);
|
|
65
65
|
const dimensions = useWindowDimensions();
|
|
66
66
|
const insets = useSafeAreaInsets();
|
|
67
|
-
const transitionsAlwaysOn = flags.TRANSITIONS_ALWAYS_ON;
|
|
68
67
|
|
|
69
68
|
const {
|
|
70
69
|
current: currDescriptor,
|
|
@@ -76,14 +75,6 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
76
75
|
const nextAnimation = useBuildTransitionState(nextDescriptor);
|
|
77
76
|
const prevAnimation = useBuildTransitionState(prevDescriptor);
|
|
78
77
|
|
|
79
|
-
const currentRouteKey = currDescriptor?.route?.key;
|
|
80
|
-
const currentIndex = routeKeys.indexOf(currentRouteKey);
|
|
81
|
-
const visualProgressValues = useMemo(() => {
|
|
82
|
-
return routeKeys.map((routeKey) =>
|
|
83
|
-
AnimationStore.getValue(routeKey, "visualProgress"),
|
|
84
|
-
);
|
|
85
|
-
}, [routeKeys]);
|
|
86
|
-
|
|
87
78
|
const nextRouteKey = nextDescriptor?.route?.key;
|
|
88
79
|
const nextHasTransitions =
|
|
89
80
|
!!nextRouteKey &&
|
|
@@ -110,6 +101,11 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
110
101
|
interpolatorOptions.owner === "next" &&
|
|
111
102
|
!!nextAnimation &&
|
|
112
103
|
nextHasTransitions;
|
|
104
|
+
const previousCurrentProgress = currentAnimation?.visualProgress.get();
|
|
105
|
+
const previousNextProgress =
|
|
106
|
+
nextAnimation && nextHasTransitions
|
|
107
|
+
? nextAnimation.visualProgress.get()
|
|
108
|
+
: undefined;
|
|
113
109
|
|
|
114
110
|
frame.previous = prevAnimation
|
|
115
111
|
? hydrateTransitionState(prevAnimation, dimensions)
|
|
@@ -141,15 +137,13 @@ export function useScreenAnimationPipeline(): ScreenAnimationPipeline {
|
|
|
141
137
|
|
|
142
138
|
updateDerivations(frame);
|
|
143
139
|
|
|
144
|
-
frame.stackProgress =
|
|
145
|
-
|
|
146
|
-
visualProgressValues,
|
|
147
|
-
currentIndex,
|
|
140
|
+
frame.stackProgress = resolveStackProgress(
|
|
141
|
+
currentAnimation?.stackProgress,
|
|
148
142
|
frame.progress,
|
|
149
|
-
currentRouteKey,
|
|
150
143
|
frame.current.progress,
|
|
151
|
-
|
|
144
|
+
previousCurrentProgress,
|
|
152
145
|
frame.next?.progress,
|
|
146
|
+
previousNextProgress,
|
|
153
147
|
);
|
|
154
148
|
frame.logicallySettled = frame.active.settled;
|
|
155
149
|
|
|
@@ -1,28 +1,43 @@
|
|
|
1
1
|
import type { SharedValue } from "react-native-reanimated";
|
|
2
2
|
|
|
3
|
-
export const
|
|
4
|
-
routeKeys: string[],
|
|
3
|
+
export const syncStackProgressValues = (
|
|
5
4
|
visualProgressValues: SharedValue<number>[],
|
|
6
|
-
|
|
5
|
+
stackProgressValues: SharedValue<number>[],
|
|
6
|
+
) => {
|
|
7
|
+
"worklet";
|
|
8
|
+
let total = 0;
|
|
9
|
+
|
|
10
|
+
for (let i = visualProgressValues.length - 1; i >= 0; i--) {
|
|
11
|
+
total += visualProgressValues[i]?.get() ?? 0;
|
|
12
|
+
const stackProgress = stackProgressValues[i];
|
|
13
|
+
|
|
14
|
+
if (stackProgress && stackProgress.get() !== total) {
|
|
15
|
+
stackProgress.set(total);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const resolveStackProgress = (
|
|
21
|
+
stackProgress: SharedValue<number> | undefined,
|
|
7
22
|
fallbackProgress: number,
|
|
8
|
-
currentRouteKey: string | undefined,
|
|
9
23
|
currentProgress: number,
|
|
10
|
-
|
|
24
|
+
previousCurrentProgress: number | undefined,
|
|
11
25
|
nextProgress: number | undefined,
|
|
26
|
+
previousNextProgress: number | undefined,
|
|
12
27
|
) => {
|
|
13
28
|
"worklet";
|
|
14
|
-
if (
|
|
29
|
+
if (!stackProgress) {
|
|
30
|
+
return fallbackProgress;
|
|
31
|
+
}
|
|
15
32
|
|
|
16
|
-
let total =
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
total += visualProgressValues[i].get();
|
|
25
|
-
}
|
|
33
|
+
let total = stackProgress.get();
|
|
34
|
+
|
|
35
|
+
if (previousCurrentProgress !== undefined) {
|
|
36
|
+
total += currentProgress - previousCurrentProgress;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (nextProgress !== undefined && previousNextProgress !== undefined) {
|
|
40
|
+
total += nextProgress - previousNextProgress;
|
|
26
41
|
}
|
|
27
42
|
|
|
28
43
|
return total;
|
|
@@ -22,6 +22,7 @@ import { toPlainRoute, toPlainValue } from "./worklet";
|
|
|
22
22
|
type BuiltState = {
|
|
23
23
|
transitionProgress: SharedValue<number>;
|
|
24
24
|
visualProgress: SharedValue<number>;
|
|
25
|
+
stackProgress: SharedValue<number>;
|
|
25
26
|
willAnimate: SharedValue<number>;
|
|
26
27
|
closing: SharedValue<number>;
|
|
27
28
|
progressAnimating: SharedValue<number>;
|
|
@@ -67,6 +68,7 @@ export const useBuildTransitionState = (
|
|
|
67
68
|
return {
|
|
68
69
|
transitionProgress: AnimationStore.getValue(key, "transitionProgress"),
|
|
69
70
|
visualProgress: AnimationStore.getValue(key, "visualProgress"),
|
|
71
|
+
stackProgress: AnimationStore.getValue(key, "stackProgress"),
|
|
70
72
|
willAnimate: AnimationStore.getValue(key, "willAnimate"),
|
|
71
73
|
closing: AnimationStore.getValue(key, "closing"),
|
|
72
74
|
entering: AnimationStore.getValue(key, "entering"),
|
|
@@ -8,6 +8,7 @@ import { createStore } from "../utils/create-store";
|
|
|
8
8
|
export type AnimationStoreMap = {
|
|
9
9
|
transitionProgress: SharedValue<number>;
|
|
10
10
|
visualProgress: SharedValue<number>;
|
|
11
|
+
stackProgress: SharedValue<number>;
|
|
11
12
|
willAnimate: SharedValue<number>;
|
|
12
13
|
progressAnimating: SharedValue<number>;
|
|
13
14
|
progressSettled: SharedValue<number>;
|
|
@@ -19,6 +20,7 @@ function createAnimationBag(): AnimationStoreMap {
|
|
|
19
20
|
return {
|
|
20
21
|
transitionProgress: makeMutable(0),
|
|
21
22
|
visualProgress: makeMutable(0),
|
|
23
|
+
stackProgress: makeMutable(0),
|
|
22
24
|
willAnimate: makeMutable(0),
|
|
23
25
|
closing: makeMutable(0),
|
|
24
26
|
progressAnimating: makeMutable(0),
|
|
@@ -37,6 +39,7 @@ export const AnimationStore = createStore<AnimationStoreMap>({
|
|
|
37
39
|
disposeBag: (bag) => {
|
|
38
40
|
cancelAnimation(bag.transitionProgress);
|
|
39
41
|
cancelAnimation(bag.visualProgress);
|
|
42
|
+
cancelAnimation(bag.stackProgress);
|
|
40
43
|
cancelAnimation(bag.willAnimate);
|
|
41
44
|
cancelAnimation(bag.progressAnimating);
|
|
42
45
|
cancelAnimation(bag.progressSettled);
|