-
-
Notifications
You must be signed in to change notification settings - Fork 420
/
Copy pathindex.d.ts
98 lines (88 loc) · 3.62 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
declare module 'react-native-copilot' {
import { Component, ComponentProps, ComponentType, ReactElement, ReactNode } from 'react';
export type Step = {
name: string;
order: number;
visible: boolean;
target: ReactNode;
text: string;
wrapper: ReactNode;
};
export type CopilotTooltipProps = {
isFirstStep: boolean;
isLastStep: boolean;
handleNext: () => void;
handlePrev: () => void;
handleStop: () => void;
currentStep: Step;
};
export type CopilotStepNumberProps = {
currentStepNumber: number;
};
export type OverlayType = 'svg' | 'view';
/**
* Options for the copilot HOC
*/
export type CopilotOptions = {
animated?: boolean; // Use animation between steps
overlay?: OverlayType; // The overlay in react-native copilot is the component that draws the dark transparent over the root component.
tooltipComponent?: any; // You can customize the tooltip by passing a component here
stepNumberComponent?: any; // You can customize the step number by passing a component here
onBackButton: 'noop' | 'prev' | 'stop'; // specifies what to do when the back button is pressed, either no-op, move to previous step, or stop
androidStatusBarVisible?: boolean; // Whether the Android status bar should be visible
backdropColor?: string; // You can customize the mask color - default is rgba(0, 0, 0, 0.4)
verticalOffset?: number; // In order to adjust vertical position
stopOnOutsideClick?: boolean; // Whether the tutorial should stop after clicking outside the step component
};
/**
* Props received by walkthroughable components
*
* The components wrapped inside CopilotStep, will receive a copilot prop of type Object which the outermost rendered element
* of the component or the element that you want the tooltip be shown around, must extend.
*
* Example walkthroughable custom component:
*
* const CustomComponent = ({ copilot }) => <View {...copilot}><Text>Hello world!</Text></View>;
*/
export type WalkthroughableProps = {
copilot?: Object;
};
/**
* Props received by the screen component that you want to use copilot with.
* This is the component that starts the copilot and manages the step flow
*/
export type CopilotWrappedComponentProps = {
copilotEvents: any; // a function to help you with tracking of tutorial progress
currentStep: Step;
visible: boolean;
start: () => void; // Use this function in the root component in order to trigger the tutorial
} & ComponentProps<any>;
/**
* Props of the copilot step element
*/
export type CopilotStepProps = {
name: string; // A unique name for the walkthrough step
order: number; // A positive number indicating the order of the step in the entire walkthrough
text: string; // The text shown as the description for the step
active?: boolean; // If set to false the step is ignored
};
/**
* Higher order component for the screen component that you want to use copilot with
*/
export function copilot<P extends object>(
props: CopilotOptions
): (
wrappedComponent: ComponentType<P>
) => ComponentType<P & CopilotWrappedComponentProps>;
/**
* Higher order component to make walthroughable any built-in react native component
* For custom components please use WalkthroughableProps
*/
export function walkthroughable<P extends object>(
wrappedComponent: ComponentType<P>
): (props: WalkthroughableProps & ComponentProps<any>) => ReactElement;
/**
* Element that wraps a walkthroughable component (built-in or custom)
*/
export class CopilotStep extends Component<CopilotStepProps> {}
}