@nativescript/core
Version:
A JavaScript library providing an easy to use api for interacting with iOS and Android platform APIs.
51 lines (50 loc) • 2.99 kB
TypeScript
import type { TransitionInteractiveState, TransitionNavigationType } from '.';
import { SharedTransitionState } from './shared-transition';
interface PlatformTransitionInteractiveState extends TransitionInteractiveState {
transitionContext?: UIViewControllerContextTransitioning;
propertyAnimator?: UIViewPropertyAnimator;
}
/**
* Apply a drop shadow behind the destination view during an interactive
* dismiss so it looks elevated above the source (Apple Music–style).
*
* Shadow + rounded corners can't coexist on the same CALayer on iOS — both
* `masksToBounds = true` and `layer.mask` clip the shadow as part of the
* compositing pipeline. So the shadow lives on a SIBLING CALayer inserted
* below the modal's layer in its superlayer (the same pattern NS uses for
* box-shadow via `outerShadowContainerLayer`). The modal keeps its own
* `cornerRadius` + `masksToBounds` so subviews still clip to the rounded
* shape.
*
* Because the shadow layer is a sibling (not a child), it doesn't inherit
* the modal's transform automatically — `syncInteractiveDismissShadow`
* mirrors transform/position/bounds during the drag.
*
* Falsy `shadowConfig` is a no-op.
*/
export declare function applyInteractiveDismissShadow(presentedView: any, shadowConfig: any): void;
/**
* Mirror the modal layer's geometry onto the sibling shadow layer so the
* shadow tracks the interactive drag. Called from the gesture handlers
* after the modal's state has been updated (either via direct transform
* in morph mode, or via `interactiveController.updateInteractiveTransition`
* for the non-morph modal/page case driven by UIViewPropertyAnimator).
*
* Reads the layer's **presentation** values when an animation is in flight
* — model values would point at the animation's end state and snap the
* shadow there. Falls back to model values when no animation is running.
*/
export declare function syncInteractiveDismissShadow(presentedView: any): void;
/**
* Remove the sibling shadow layer. Safe to call repeatedly / when no
* shadow was applied.
*/
export declare function removeInteractiveDismissShadow(presentedView: any): void;
export declare class SharedTransitionHelper {
static animate(state: SharedTransitionState, transitionContext: UIViewControllerContextTransitioning, type: TransitionNavigationType): void;
static interactiveStart(state: SharedTransitionState, interactiveState: PlatformTransitionInteractiveState, type: TransitionNavigationType): void;
static interactiveUpdate(state: SharedTransitionState, interactiveState: PlatformTransitionInteractiveState, type: TransitionNavigationType, percent: number): void;
static interactiveCancel(state: SharedTransitionState, interactiveState: PlatformTransitionInteractiveState, type: TransitionNavigationType): void;
static interactiveFinish(state: SharedTransitionState, interactiveState: PlatformTransitionInteractiveState, type: TransitionNavigationType): void;
}
export {};