UNPKG

@react-motion-router/core

Version:

Declarative routing library for ReactJS ⚛ with animations baked in ⏮

60 lines (59 loc) 2.49 kB
import { Component } from 'react'; import { SwipeEndEvent, SwipeEvent, SwipeStartEvent } from 'web-gesture-events'; import Navigation from './NavigationBase'; import { ScreenChild } from './index'; import { AnimationLayerDataContext } from './AnimationLayerData'; import { SwipeDirection } from './common/types'; export declare const Motion: import("react").Context<number>; interface AnimationLayerProps { children: ScreenChild | ScreenChild[]; currentPath: string; lastPath: string | null; navigation: Navigation; backNavigating: boolean; onGestureNavigationEnd: Function; onGestureNavigationStart: Function; onDocumentTitleChange(title: string | null): void; swipeDirection: SwipeDirection; hysteresis: number; minFlingVelocity: number; swipeAreaWidth: number; disableDiscovery: boolean; disableBrowserRouting: boolean; dispatchEvent: ((event: Event) => Promise<boolean>) | null; } interface AnimationLayerState { currentPath: string | null; children: ScreenChild | ScreenChild[]; progress: number; shouldPlay: boolean; gestureNavigating: boolean; shouldAnimate: boolean; startX: number; startY: number; paths: (string | undefined)[]; swipeDirection: SwipeDirection; swipeAreaWidth: number; minFlingVelocity: number; hysteresis: number; disableDiscovery: boolean; } export default class AnimationLayer extends Component<AnimationLayerProps, AnimationLayerState> { private onSwipeStartListener; private onSwipeListener; private onSwipeEndListener; private ref; static contextType: import("react").Context<import("./AnimationLayerData").default>; context: React.ContextType<typeof AnimationLayerDataContext>; state: AnimationLayerState; static getDerivedStateFromProps(nextProps: AnimationLayerProps, state: AnimationLayerState): Partial<AnimationLayerState> | null; componentDidMount(): void; componentDidUpdate(prevProps: AnimationLayerProps, prevState: AnimationLayerState): void; onGestureSuccess(state: Pick<AnimationLayerState, 'swipeAreaWidth' | 'swipeDirection' | 'hysteresis' | 'disableDiscovery' | 'minFlingVelocity'>, name: string | null): void; onSwipeStart(ev: SwipeStartEvent): void; onSwipe(ev: SwipeEvent): void; onSwipeEnd(ev: SwipeEndEvent): void; setRef: (ref: HTMLDivElement | null) => void; render(): JSX.Element; } export {};