mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-04 21:06:45 +08:00
fix(shared-transition): race condition with interactive updates (#10312)
This commit is contained in:
@ -526,7 +526,8 @@ export class SharedTransitionHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static interactiveUpdate(state: SharedTransitionState, interactiveState: PlatformTransitionInteractiveState, type: TransitionNavigationType, percent: number) {
|
static interactiveUpdate(state: SharedTransitionState, interactiveState: PlatformTransitionInteractiveState, type: TransitionNavigationType, percent: number) {
|
||||||
if (!interactiveState?.added) {
|
if (interactiveState) {
|
||||||
|
if (!interactiveState.added) {
|
||||||
interactiveState.added = true;
|
interactiveState.added = true;
|
||||||
for (const p of state.instance.sharedElements.presented) {
|
for (const p of state.instance.sharedElements.presented) {
|
||||||
p.view.opacity = 0;
|
p.view.opacity = 0;
|
||||||
@ -550,6 +551,7 @@ export class SharedTransitionHelper {
|
|||||||
state.instance.presented.view.frame = CGRectMake(startFrame.x, startFrame.y, state.instance.presented.view.bounds.size.width, state.instance.presented.view.bounds.size.height);
|
state.instance.presented.view.frame = CGRectMake(startFrame.x, startFrame.y, state.instance.presented.view.bounds.size.width, state.instance.presented.view.bounds.size.height);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
interactiveState.propertyAnimator.fractionComplete = percent;
|
interactiveState.propertyAnimator.fractionComplete = percent;
|
||||||
SharedTransition.notifyEvent(SharedTransition.interactiveUpdateEvent, {
|
SharedTransition.notifyEvent(SharedTransition.interactiveUpdateEvent, {
|
||||||
id: state?.instance?.id,
|
id: state?.instance?.id,
|
||||||
@ -557,6 +559,7 @@ export class SharedTransitionHelper {
|
|||||||
percent,
|
percent,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static interactiveCancel(state: SharedTransitionState, interactiveState: PlatformTransitionInteractiveState, type: TransitionNavigationType) {
|
static interactiveCancel(state: SharedTransitionState, interactiveState: PlatformTransitionInteractiveState, type: TransitionNavigationType) {
|
||||||
if (state?.instance && interactiveState?.added && interactiveState?.propertyAnimator) {
|
if (state?.instance && interactiveState?.added && interactiveState?.propertyAnimator) {
|
||||||
|
|||||||
Reference in New Issue
Block a user