UNPKG

@nghinv/react-native-app-tour

Version:
118 lines (117 loc) 3.29 kB
/** * Created by nghinv on Wed Jun 23 2021 * Copyright (c) 2021 nghinv@lumi.biz */ import type React from 'react'; import type { TextStyle, TouchableOpacity, View } from 'react-native'; import type Animated from 'react-native-reanimated'; export declare type ButtonComponentProps = React.ElementType & (typeof TouchableOpacity | typeof View); export declare type MaskType = 'circle' | 'rect'; export declare type LayoutType = { x: number; y: number; width: number; height: number; }; export declare type TargetType = { x: Animated.SharedValue<number>; y: Animated.SharedValue<number>; width: Animated.SharedValue<number>; height: Animated.SharedValue<number>; }; export declare type Vector = { x: Animated.SharedValue<number>; y: Animated.SharedValue<number>; }; export declare type NodeType = { id: string; title: string; describe: string; maskType?: MaskType; onPress?: () => void; target: TargetType; }; export declare type NodesType = Array<NodeType>; export declare type AppTourStep = { id: string; title: string; describe: string; maskType?: MaskType; }; export declare type ScrollToXY = { x: number; y: number; }; export declare type AppTourStepType = { children: React.ReactElement; scrollTo?: Animated.SharedValue<ScrollToXY>; } & AppTourStep; export declare type OptionType = { nativeModal?: boolean; buttonTitle?: { skip?: string; prev?: string; next?: string; finish?: string; }; buttonTitleColor?: { skip?: string; prev?: string; next?: string; finish?: string; }; backdropOpacity?: number; backgroundColor?: string; borderRadius?: number; titleShow?: boolean; titleStyle?: TextStyle; describeStyle?: TextStyle; stepShow?: boolean; stepTitleColor?: string; stepBackgroundColor?: string; pathAnimated?: boolean; stepHeight?: number; triangleHeight?: number; colorNodeOnPress?: string; backAndroidToSkip?: boolean; debug?: boolean; }; export declare type SceneDetailType = { id: string; nextDelay?: number; prevDelay?: number; pressToNext?: boolean; enablePressNode?: boolean; nextDisable?: boolean; prevDisable?: boolean; }; export declare type SceneType = Array<SceneDetailType>; export declare type ScenesType = Array<SceneType>; export declare type AppTourContextType = { nodes: Animated.SharedValue<NodesType>; sceneIndex: number; setSceneIndex: React.Dispatch<React.SetStateAction<number>>; scenes: ScenesType; options?: OptionType; }; interface AppTourView { nextStep: () => void; preStep: () => void; start: (step?: number) => void; stop: (cb?: () => void) => void; currentStep: (step?: number) => void; } export declare type AppTourType = AppTourView; declare type EventName = 'onStart' | 'onStop' | 'onFinish' | 'onSkip' | 'onNext' | 'onPrevious' | 'onPressNode'; export declare type EventData = { name: EventName; step: number; node?: NodeType; scene?: SceneDetailType; }; export declare type EventType = { name: string; callback: (data: EventData) => void; }; export declare type EventsType = Record<string, EventType>; export {};