1 | import React from 'react';
|
2 | import { Modal, View, ViewStyle, FlexStyle, StyleProp, ColorValue } from 'react-native';
|
3 | import { ThemeProps } from '../config';
|
4 | export declare type TooltipProps = {
|
5 | withPointer?: boolean;
|
6 | popover?: React.ReactElement<{}>;
|
7 | toggleOnPress?: boolean;
|
8 | toggleAction?: string | 'onPress' | 'onLongPress';
|
9 | height?: FlexStyle['height'];
|
10 | width?: FlexStyle['width'];
|
11 | containerStyle?: StyleProp<ViewStyle>;
|
12 | pointerColor?: ColorValue;
|
13 | onClose?(): void;
|
14 | onOpen?(): void;
|
15 | overlayColor?: ColorValue;
|
16 | withOverlay?: boolean;
|
17 | backgroundColor?: ColorValue;
|
18 | highlightColor?: ColorValue;
|
19 | skipAndroidStatusBar?: boolean;
|
20 | ModalComponent?: typeof React.Component;
|
21 | closeOnlyOnBackdropPress?: boolean;
|
22 | } & typeof defaultProps;
|
23 | declare const defaultProps: {
|
24 | withOverlay: boolean;
|
25 | overlayColor: string;
|
26 | highlightColor: string;
|
27 | withPointer: boolean;
|
28 | toggleOnPress: boolean;
|
29 | toggleAction: string;
|
30 | height: number;
|
31 | width: number;
|
32 | containerStyle: {};
|
33 | backgroundColor: string;
|
34 | onClose: () => void;
|
35 | onOpen: () => void;
|
36 | skipAndroidStatusBar: boolean;
|
37 | ModalComponent: typeof Modal;
|
38 | closeOnlyOnBackdropPress: boolean;
|
39 | };
|
40 | declare type TooltipState = {
|
41 | isVisible: boolean;
|
42 | yOffset: number;
|
43 | xOffset: number;
|
44 | elementWidth: number;
|
45 | elementHeight: number;
|
46 | };
|
47 | declare class Tooltip extends React.Component<TooltipProps & Partial<ThemeProps<TooltipProps>>, TooltipState> {
|
48 | static defaultProps: {
|
49 | withOverlay: boolean;
|
50 | overlayColor: string;
|
51 | highlightColor: string;
|
52 | withPointer: boolean;
|
53 | toggleOnPress: boolean;
|
54 | toggleAction: string;
|
55 | height: number;
|
56 | width: number;
|
57 | containerStyle: {};
|
58 | backgroundColor: string;
|
59 | onClose: () => void;
|
60 | onOpen: () => void;
|
61 | skipAndroidStatusBar: boolean;
|
62 | ModalComponent: typeof Modal;
|
63 | closeOnlyOnBackdropPress: boolean;
|
64 | };
|
65 | _isMounted: boolean;
|
66 | state: {
|
67 | isVisible: boolean;
|
68 | yOffset: number;
|
69 | xOffset: number;
|
70 | elementWidth: number;
|
71 | elementHeight: number;
|
72 | };
|
73 | renderedElement?: View | null;
|
74 | toggleTooltip: () => void;
|
75 | wrapWithPress: (toggleOnPress: TooltipProps['toggleOnPress'], toggleAction: TooltipProps['toggleAction'], children: React.ReactNode) => React.ReactNode;
|
76 | containerStyle: (withOverlay: boolean, overlayColor: string) => ViewStyle;
|
77 | getTooltipStyle: () => ViewStyle | (false & {}) | {
|
78 | [x: string]: string | number;
|
79 | position: string;
|
80 | top: number;
|
81 | width: number;
|
82 | height: number;
|
83 | backgroundColor: string;
|
84 | display: string;
|
85 | alignItems: string;
|
86 | justifyContent: string;
|
87 | flex: number;
|
88 | borderRadius: number;
|
89 | padding: number;
|
90 | };
|
91 | renderPointer: (tooltipY: FlexStyle['top']) => JSX.Element;
|
92 | getTooltipHighlightedButtonStyle: () => ViewStyle;
|
93 | renderTouchableHighlightedButton: () => JSX.Element;
|
94 | renderStaticHighlightedButton: () => JSX.Element;
|
95 | renderHighlightedButton: () => JSX.Element;
|
96 | renderContent: (withTooltip: boolean) => React.ReactNode;
|
97 | componentDidMount(): void;
|
98 | componentWillUnmount(): void;
|
99 | getElementPosition: () => void;
|
100 | renderStaticModalContent: () => JSX.Element;
|
101 | renderTogglingModalContent: () => JSX.Element;
|
102 | renderModalContent: () => JSX.Element;
|
103 | render(): JSX.Element;
|
104 | }
|
105 | export { Tooltip };
|
106 | declare const _default: React.FunctionComponent<Omit<{
|
107 | withPointer?: boolean;
|
108 | popover?: React.ReactElement<{}, string | React.JSXElementConstructor<any>>;
|
109 | toggleOnPress?: boolean;
|
110 | toggleAction?: string;
|
111 | height?: string | number;
|
112 | width?: string | number;
|
113 | containerStyle?: StyleProp<ViewStyle>;
|
114 | pointerColor?: ColorValue;
|
115 | onClose?(): void;
|
116 | onOpen?(): void;
|
117 | overlayColor?: ColorValue;
|
118 | withOverlay?: boolean;
|
119 | backgroundColor?: ColorValue;
|
120 | highlightColor?: ColorValue;
|
121 | skipAndroidStatusBar?: boolean;
|
122 | ModalComponent?: typeof React.Component;
|
123 | closeOnlyOnBackdropPress?: boolean;
|
124 | } & {
|
125 | withOverlay: boolean;
|
126 | overlayColor: string;
|
127 | highlightColor: string;
|
128 | withPointer: boolean;
|
129 | toggleOnPress: boolean;
|
130 | toggleAction: string;
|
131 | height: number;
|
132 | width: number;
|
133 | containerStyle: {};
|
134 | backgroundColor: string;
|
135 | onClose: () => void;
|
136 | onOpen: () => void;
|
137 | skipAndroidStatusBar: boolean;
|
138 | ModalComponent: typeof Modal;
|
139 | closeOnlyOnBackdropPress: boolean;
|
140 | } & Partial<ThemeProps<TooltipProps>>, keyof ThemeProps<T>>> | React.ForwardRefExoticComponent<{
|
141 | withPointer?: boolean;
|
142 | popover?: React.ReactElement<{}, string | React.JSXElementConstructor<any>>;
|
143 | toggleOnPress?: boolean;
|
144 | toggleAction?: string;
|
145 | height?: string | number;
|
146 | width?: string | number;
|
147 | containerStyle?: StyleProp<ViewStyle>;
|
148 | pointerColor?: ColorValue;
|
149 | onClose?(): void;
|
150 | onOpen?(): void;
|
151 | overlayColor?: ColorValue;
|
152 | withOverlay?: boolean;
|
153 | backgroundColor?: ColorValue;
|
154 | highlightColor?: ColorValue;
|
155 | skipAndroidStatusBar?: boolean;
|
156 | ModalComponent?: typeof React.Component;
|
157 | closeOnlyOnBackdropPress?: boolean;
|
158 | } & {
|
159 | withOverlay: boolean;
|
160 | overlayColor: string;
|
161 | highlightColor: string;
|
162 | withPointer: boolean;
|
163 | toggleOnPress: boolean;
|
164 | toggleAction: string;
|
165 | height: number;
|
166 | width: number;
|
167 | containerStyle: {};
|
168 | backgroundColor: string;
|
169 | onClose: () => void;
|
170 | onOpen: () => void;
|
171 | skipAndroidStatusBar: boolean;
|
172 | ModalComponent: typeof Modal;
|
173 | closeOnlyOnBackdropPress: boolean;
|
174 | } & Partial<ThemeProps<TooltipProps>>>;
|
175 | export default _default;
|