UNPKG

43 kBTypeScriptView Raw
1import * as React from 'react';
2import {
3 ViewStyle,
4 TextStyle,
5 ImageStyle,
6 ImageSourcePropType,
7 ImageURISource,
8 TouchableWithoutFeedbackProps,
9 TouchableOpacityProps,
10 TouchableNativeFeedbackProps,
11 ViewProperties,
12 TextInputProperties,
13 TextInput,
14 TextProperties,
15 StatusBarProperties,
16 StyleProp,
17 Animated,
18 ActivityIndicatorProperties,
19 SwitchProperties,
20 StatusBarStyle,
21 ModalProps,
22 TextInputProps,
23 ImageProps as RNImageProps,
24 TouchableHighlightProps,
25 PressableProps,
26} from 'react-native';
27import { RatingProps, AirbnbRatingProps } from 'react-native-ratings';
28import {
29 IconButtonProps,
30 IconProps as VectorIconProps,
31} from 'react-native-vector-icons/Icon';
32
33export interface TouchableComponent
34 extends TouchableHighlightProps,
35 PressableProps {}
36
37/**
38 * Supports auto complete for most used types as well as any other string type.
39 */
40export type IconType =
41 | 'material'
42 | 'material-community'
43 | 'simple-line-icon'
44 | 'zocial'
45 | 'font-awesome'
46 | 'octicon'
47 | 'ionicon'
48 | 'foundation'
49 | 'evilicon'
50 | 'entypo'
51 | 'antdesign'
52 | 'font-awesome-5'
53 | string;
54
55export interface IconObject extends TouchableComponent {
56 name?: string;
57 color?: string;
58 size?: number;
59 type?: IconType;
60 style?: StyleProp<TextStyle>;
61}
62
63export interface AvatarIcon extends IconObject {
64 iconStyle?: StyleProp<TextStyle>;
65}
66
67export interface TextProps extends TextProperties {
68 /**
69 * font size 40
70 */
71 h1?: boolean;
72
73 /**
74 * font size 34
75 */
76 h2?: boolean;
77
78 /**
79 * font size 28
80 */
81 h3?: boolean;
82
83 /**
84 * font size 22
85 */
86 h4?: boolean;
87
88 /**
89 * Styling for when `h1` is set
90 */
91 h1Style?: StyleProp<TextStyle>;
92
93 /**
94 * Styling for when `h2` is set
95 */
96 h2Style?: StyleProp<TextStyle>;
97
98 /**
99 * Styling for when `h3` is set
100 */
101 h3Style?: StyleProp<TextStyle>;
102
103 /**
104 * Styling for when `h4` is set
105 */
106 h4Style?: StyleProp<TextStyle>;
107
108 /**
109 * Additional styling for Text
110 */
111 style?: StyleProp<TextStyle>;
112}
113
114/**
115 * HTML Style Headings
116 *
117 */
118export class Text extends React.Component<TextProps, any> {}
119
120export interface AvatarProps {
121 /**
122 * Component for enclosing element (eg: TouchableHighlight, View, etc)
123 *
124 * @default TouchableOpacity
125 */
126 Component?: React.ComponentClass;
127
128 /**
129 * Callback function when pressing Edit button
130 */
131 onAccessoryPress?(): void;
132
133 /**
134 * Callback function when pressing component
135 */
136 onPress?(): void;
137
138 /**
139 * Callback function when long pressing component
140 */
141 onLongPress?(): void;
142
143 /**
144 * Styling for outer container
145 */
146 containerStyle?: StyleProp<ViewStyle>;
147
148 /**
149 * Image source
150 */
151 source?: ImageSourcePropType;
152
153 /**
154 * Style for avatar image
155 */
156 avatarStyle?: ImageStyle;
157
158 /**
159 * Determines the shape of avatar
160 *
161 * @default false
162 */
163 rounded?: boolean;
164
165 /**
166 * Renders title in the avatar
167 */
168 title?: string;
169
170 /**
171 * Style for the title
172 */
173 titleStyle?: StyleProp<TextStyle>;
174
175 /**
176 * Style for the view outside image or icon
177 */
178 overlayContainerStyle?: StyleProp<ViewStyle>;
179
180 /**
181 * Opacity when pressed
182 *
183 * @default 0.2
184 */
185 activeOpacity?: number;
186
187 /**
188 * If to show the edit button or not
189 *
190 * @default false
191 */
192 showAccessory?: boolean;
193
194 /**
195 * Edit button for the avatar
196 *
197 * @default "{size: null, iconName: 'mode-edit', iconType: 'material', iconColor: '#fff', underlayColor: '#000', style: null}"
198 */
199 accessory?: Partial<IconProps> & Partial<ImageProps>;
200
201 /**
202 * Style for the placeholder
203 */
204 placeholderStyle?: StyleProp<ViewStyle>;
205
206 /**
207 * Render a content inside placeholder
208 */
209 renderPlaceholderContent?: React.ReactElement<{}>;
210
211 /**
212 * Icon for the avatar
213 */
214 icon?: AvatarIcon;
215
216 /**
217 * extra styling for icon component
218 */
219 iconStyle?: StyleProp<TextStyle>;
220
221 /**
222 * Optional properties to pass to the image if provided e.g "resizeMode"
223 */
224 imageProps?: Partial<ImageProps>;
225
226 /**
227 * Size of Avatar
228 * @default "small"
229 */
230
231 size?: 'small' | 'medium' | 'large' | 'xlarge' | number;
232
233 /**
234 * Image Component of Avatar
235 * @default React Native default Image component
236 */
237
238 ImageComponent?: React.ComponentClass;
239}
240
241/**
242 * Avatar Component
243 *
244 */
245export class Avatar extends React.Component<AvatarProps> {}
246
247export interface ButtonProps
248 extends TouchableOpacityProps,
249 TouchableNativeFeedbackProps {
250 /**
251 * Specify other touchable such as TouchableOpacity/TouchableNativeFeedback
252 *
253 * Default is TouchableOpacity on IOS and TouchableNativeFeedback on Android
254 */
255 TouchableComponent?: React.ComponentClass;
256
257 /**
258 * Specify a different component as the background for the button.
259 * Useful for if you want to make a button with a gradient background.
260 *
261 * @default View
262 */
263 ViewComponent?: React.ComponentClass<any>;
264
265 /**
266 * Additional styling for button (background) view component
267 *
268 * @default null
269 */
270 buttonStyle?: StyleProp<ViewStyle>;
271
272 /**
273 * Button title
274 */
275 title?: string;
276
277 /**
278 * If to show the icon on the right
279 *
280 * @default false
281 */
282 iconRight?: boolean;
283
284 /**
285 * Icon to show in the button
286 */
287 icon?: IconNode;
288
289 /**
290 * Style for the container around the icon
291 */
292 iconContainerStyle?: StyleProp<ViewStyle>;
293
294 /**
295 * Title styling
296 */
297 titleStyle?: StyleProp<TextStyle>;
298
299 /**
300 * Optional props for the title inside the button
301 */
302 titleProps?: TextProperties;
303
304 /**
305 * Styling for Component container
306 *
307 * @default null
308 */
309 containerStyle?: StyleProp<ViewStyle>;
310
311 /**
312 * Display a loading spinner
313 *
314 * @default false
315 */
316 loading?: boolean;
317
318 /**
319 * Additional style to applied to the ActivityIndicator
320 */
321 loadingStyle?: StyleProp<ViewStyle>;
322
323 /**
324 * Additional props to applied to the ActivityIndicator
325 */
326 loadingProps?: ActivityIndicatorProperties;
327
328 /**
329 * Object of props to be applied to the linearGradient view(ViewComponent)
330 */
331 linearGradientProps?: Object;
332
333 /**
334 * Type of button
335 *
336 * @default solid
337 */
338 type?: 'solid' | 'clear' | 'outline';
339
340 /**
341 * If the user is allowed to interact with the button
342 *
343 * @default false
344 */
345 disabled?: boolean;
346
347 /**
348 * Style of the title when the button is disabled
349 */
350 disabledTitleStyle?: StyleProp<TextStyle>;
351
352 /**
353 * Style of the button when disabled
354 */
355 disabledStyle?: StyleProp<ViewStyle>;
356
357 /**
358 * If the button has raised styling
359 *
360 * @default false
361 */
362 raised?: boolean;
363}
364
365/**
366 * Button component
367 *
368 */
369export class Button extends React.Component<ButtonProps, any> {}
370
371export interface BadgeProps {
372 /**
373 * Text value to be displayed by badge
374 *
375 * @default null
376 */
377 value?: React.ReactNode;
378
379 /**
380 * Additional styling for badge (background) view component
381 */
382 badgeStyle?: StyleProp<ViewStyle>;
383
384 /**
385 * Style for the container
386 */
387 containerStyle?: StyleProp<ViewStyle>;
388
389 /**
390 * Style for the text in the badge
391 */
392 textStyle?: StyleProp<TextStyle>;
393
394 /*
395 * Props for the text in the badge
396 */
397 textProps?: TextProperties;
398
399 /**
400 * Custom component to replace the badge component
401 *
402 * @default View (if onPress then TouchableOpacity)
403 */
404 Component?: React.ComponentClass;
405
406 /**
407 * Determines color of the indicator
408 *
409 * @default primary
410 */
411 status?: 'primary' | 'success' | 'warning' | 'error';
412
413 /**
414 * Function called when pressed on the badge
415 */
416 onPress?(): void;
417}
418
419/**
420 * Badge component
421 *
422 */
423export class Badge extends React.Component<BadgeProps> {}
424
425/**
426 * withBadge Higher-Order Component
427 *
428 * @param value
429 * @param options
430 */
431export function withBadge(
432 /**
433 * Text value to be displayed by badge
434 */
435 value?: React.ReactNode | (() => React.ReactNode),
436 /**
437 * Options to configure the badge
438 */
439 options?: {
440 bottom?: number;
441 left?: number;
442 right?: number;
443 top?: number;
444 hidden?: boolean;
445 containerStyle?: StyleProp<ViewStyle>;
446 } & BadgeProps
447): <P = {}>(WrappedComponent: React.ComponentType<P>) => React.ComponentType<P>;
448
449export interface BottomSheetProps {
450 /**
451 * To show or hide the Bottom Sheet Component
452 * @default false
453 */
454
455 isVisible: boolean;
456
457 /**
458 * props of react native modal https://reactnative.dev/docs/modal#props
459 * @default {}
460 */
461
462 modalProps: ModalProps;
463}
464
465/**
466 * Bottom Sheet component
467 *
468 */
469export class BottomSheet extends React.Component<BottomSheetProps> {}
470
471export interface CardProps {
472 /**
473 * Outer container style
474 */
475 containerStyle?: StyleProp<ViewStyle>;
476
477 /**
478 * Inner container style
479 */
480 wrapperStyle?: StyleProp<ViewStyle>;
481
482 /**
483 * Card title
484 */
485 title?: string | React.ReactElement<{}>;
486
487 /**
488 * Additional title styling (if title provided)
489 */
490 titleStyle?: StyleProp<TextStyle>;
491
492 /**
493 * Title rendered over the image
494 * (only works if image prop is present)
495 */
496 featuredTitle?: string;
497
498 /**
499 * Styling for featured title
500 */
501 featuredTitleStyle?: StyleProp<TextStyle>;
502
503 /**
504 * Subtitle rendered over the image
505 * (only works if image prop is present)
506 */
507 featuredSubtitle?: string;
508
509 /**
510 * Styling for featured subtitle
511 */
512 featuredSubtitleStyle?: StyleProp<TextStyle>;
513
514 /**
515 * Additional divider styling
516 * (if title provided)
517 */
518 dividerStyle?: StyleProp<ViewStyle>;
519
520 /**
521 * Specify image styling if image is provided
522 */
523 imageStyle?: ImageStyle;
524
525 /**
526 * Specify styling for view surrounding image
527 */
528 imageWrapperStyle?: StyleProp<ViewStyle>;
529
530 /**
531 * Add an image as the heading with the image prop
532 */
533 image?: ImageSourcePropType;
534
535 /**
536 * Optional properties to pass to the image if provided e.g "resizeMode"
537 */
538 imageProps?: Partial<ImageProps>;
539}
540
541/**
542 * Card component
543 *
544 */
545export class Card extends React.Component<CardProps> {}
546
547/**
548 * Set the buttons within a Group.
549 */
550export interface ElementObject {
551 element: React.ReactElement<{}> | React.ReactType;
552}
553
554/**
555 * Set the border styles for a component.
556 */
557export interface InnerBorderStyleProperty {
558 color?: string;
559 width?: number;
560}
561
562export interface ButtonGroupProps {
563 /**
564 * Allows the user to select multiple items
565 *
566 * @default false
567 */
568 selectMultiple?: boolean;
569
570 /**
571 * Current selected index of array of buttons
572 */
573 selectedIndex?: number | null;
574
575 /**
576 * The indexes that are selected. Used with 'selectMultiple'
577 *
578 * @default []
579 */
580 selectedIndexes?: number[];
581
582 /**
583 * Array of buttons for component, if returning a component, must be an object with { element: componentName }
584 */
585 buttons: string[] | ElementObject[];
586
587 /**
588 * Choose other button component such as TouchableOpacity
589 *
590 * @default TouchableHighlight
591 */
592 Component?: React.ComponentType<any>;
593
594 /**
595 * Specify styling for main button container
596 */
597 containerStyle?: StyleProp<ViewStyle>;
598
599 /**
600 * Specify styling for buttons container
601 */
602 buttonContainerStyle?: StyleProp<ViewStyle>;
603
604 /**
605 * inherited styling specify styling for button
606 */
607 buttonStyle?: StyleProp<ViewStyle>;
608
609 /**
610 * Specify styling selected button
611 *
612 * @default 'white'
613 */
614 selectedButtonStyle?: StyleProp<ViewStyle>;
615
616 /**
617 * Specify specific styling for text
618 */
619 textStyle?: StyleProp<TextStyle>;
620
621 /**
622 * Specify specific styling for text in the selected state
623 */
624 selectedTextStyle?: StyleProp<TextStyle>;
625
626 /**
627 * inherited styling object { width, color } update the styling of the interior border of the list of buttons
628 */
629 innerBorderStyle?: InnerBorderStyleProperty;
630
631 /**
632 * Specify underlayColor for TouchableHighlight
633 *
634 * @default 'white'
635 */
636 underlayColor?: string;
637
638 /**
639 * Determines what the opacity of the wrapped view should be when touch is active.
640 */
641 activeOpacity?: number;
642
643 /**
644 * Border radius for the container
645 */
646 containerBorderRadius?: number;
647
648 /**
649 * Controls if buttons are disabled
650 *
651 * Setting `true` makes all of them disabled, while using an array only makes those indices disabled
652 *
653 * @default false
654 */
655 disabled?: boolean | number[];
656
657 /**
658 * Styling for each button when disabled
659 */
660 disabledStyle?: StyleProp<ViewStyle>;
661
662 /**
663 * Styling for each selected button when disabled
664 */
665 disabledSelectedStyle?: StyleProp<ViewStyle>;
666
667 /**
668 * Styling for the text of each button when disabled
669 */
670 disabledTextStyle?: StyleProp<TextStyle>;
671
672 /**
673 * Styling for the text of each selected button when disabled
674 */
675 disabledSelectedTextStyle?: StyleProp<TextStyle>;
676
677 /**
678 * Display in vertical orientation
679 *
680 * @default false
681 */
682 vertical?: boolean;
683
684 /**
685 * Method to update Button Group Index
686 */
687 onPress(selectedIndex: number): void;
688
689 /**
690 *
691 * Called immediately after the underlay is hidden
692 */
693 onHideUnderlay?(): void;
694
695 /**
696 * Called immediately after the underlay is shown
697 */
698 onShowUnderlay?(): void;
699
700 /**
701 * Animate the touchable to a new opacity.
702 */
703 setOpacityTo?(value: number): void;
704}
705
706export class ButtonGroup extends React.Component<ButtonGroupProps> {}
707
708export interface CheckBoxProps {
709 /**
710 * Icon family, can be one of the following
711 * (required only if specifying an icon that is not from font-awesome)
712 */
713 iconType?: IconType;
714
715 /**
716 * Specify React Native component for main button
717 */
718 Component?: React.ComponentClass;
719
720 /**
721 * Flag for checking the icon
722 *
723 * @default false
724 */
725 checked: boolean;
726
727 /**
728 * Moves icon to right of text.
729 *
730 * @default false
731 */
732 iconRight?: boolean;
733
734 /**
735 * Aligns checkbox to right
736 *
737 * @default false
738 */
739 right?: boolean;
740
741 /**
742 * Aligns checkbox to center
743 *
744 * @default false
745 */
746 center?: boolean;
747
748 /**
749 * Title of checkbox
750 */
751 title?: string | React.ReactElement<{}>;
752
753 /**
754 * Additional props for the title
755 */
756 titleProps?: Partial<TextProperties>;
757
758 /**
759 * Style of main container
760 */
761 containerStyle?: StyleProp<ViewStyle>;
762
763 /**
764 * Style of container that wraps the check box and text
765 */
766 wrapperStyle?: StyleProp<ViewStyle>;
767
768 /**
769 * style of text
770 */
771 textStyle?: StyleProp<TextStyle>;
772
773 /**
774 * Size of the checkbox
775 *
776 * @default 24
777 */
778 size?: number;
779
780 /**
781 * onLongPress function for checkbox
782 */
783 onLongPress?(): void;
784
785 /**
786 * onLongPress function for checkbox
787 */
788 onLongIconPress?(): void;
789
790 /**
791 * onPress function for container
792 */
793 onPress?(): void;
794
795 /**
796 * onPress function for checkbox
797 */
798 onIconPress?(): void;
799
800 /**
801 * Default checked icon (Font Awesome Icon)
802 *
803 * @default 'check-square-o'
804 */
805 checkedIcon?: string | React.ReactElement<{}>;
806
807 /**
808 * Default checked icon (Font Awesome Icon)
809 *
810 * @default 'square-o'
811 */
812 uncheckedIcon?: string | React.ReactElement<{}>;
813
814 /**
815 * Default checked color
816 *
817 * @default 'green'
818 */
819 checkedColor?: string;
820
821 /**
822 * Default unchecked color
823 * @default '#bfbfbf'
824 */
825 uncheckedColor?: string;
826
827 /**
828 * Specify a custom checked message
829 */
830 checkedTitle?: string;
831
832 /**
833 * Specify different font family
834 * @default 'System font bold (iOS)'
835 * @default 'Sans Serif Bold (android)'
836 */
837 fontFamily?: string;
838}
839export class CheckBox extends React.Component<CheckBoxProps, any> {}
840
841export interface DividerProps extends ViewProperties {}
842
843export class Divider extends React.Component<DividerProps> {}
844
845export interface InputProps extends TextInputProperties {
846 /**
847 * Styling for Input Component Container (optional)
848 */
849 containerStyle?: StyleProp<ViewStyle>;
850
851 /**
852 * Disables the input field
853 */
854 disabled?: boolean;
855
856 /**
857 * Style of the input field when disabled
858 */
859 disabledInputStyle?: StyleProp<TextStyle>;
860
861 /**
862 * Styling for Input Component Container (optional)
863 */
864 inputContainerStyle?: StyleProp<ViewStyle>;
865
866 /**
867 * Displays an icon to the left (optional)
868 */
869 leftIcon?: IconNode;
870
871 /**
872 * Styling for left Icon Component container
873 */
874 leftIconContainerStyle?: StyleProp<ViewStyle>;
875
876 /**
877 * Displays an icon to the right (optional)
878 */
879 rightIcon?: IconNode;
880
881 /**
882 * Styling for the right icon container
883 */
884 rightIconContainerStyle?: StyleProp<ViewStyle>;
885
886 /**
887 * Renders component in place of the React Native `TextInput` (optional)
888 */
889 InputComponent?: React.ComponentType<any>;
890
891 /**
892 * Adds styling to input component (optional)
893 */
894 inputStyle?: StyleProp<TextStyle>;
895
896 /**
897 * Add styling to error message (optional)
898 */
899 errorStyle?: StyleProp<TextStyle>;
900
901 /**
902 * Adds error message (optional)
903 */
904 errorMessage?: string;
905
906 /**
907 * props to be passed to the React Native Text component used to display the error message (optional)
908 */
909 errorProps?: TextProps;
910
911 /**
912 * Add styling to label (optional)
913 */
914 labelStyle?: StyleProp<TextStyle>;
915
916 /**
917 * Adds label (optional)
918 */
919 label?: string | React.ReactElement<{}>;
920
921 /**
922 * props to be passed to the React Native Text component used to display the label (optional)
923 */
924 labelProps?: TextProps;
925
926 /**
927 * displays error message
928 */
929 renderErrorMessage?: boolean;
930}
931
932export class Input extends React.Component<InputProps> {
933 /**
934 * Shakes the Input
935 *
936 * eg `this.inputRef.shake()`
937 */
938 shake(): void;
939
940 /**
941 * Calls focus on the Input
942 *
943 * eg `this.inputRef.focus()`
944 */
945 focus(): void;
946
947 /**
948 * Calls isFocused() on the Input
949 *
950 * eg `let focused = this.inputRef.isFocused()`
951 */
952 isFocused(): boolean;
953
954 /**
955 * Calls blur on the Input
956 *
957 * eg `this.inputRef.blur()`
958 */
959 blur(): void;
960
961 /**
962 * Calls clear on the Input
963 *
964 * eg `this.inputRef.clear()`
965 */
966 clear(): void;
967
968 /**
969 * Calls setNativeProps on the Input
970 *
971 * eg `this.inputRef.setNativeProps({ text: 'any text' })`
972 */
973 setNativeProps(nativeProps: Partial<TextInputProps>): void;
974}
975
976export interface HeaderIcon extends IconObject {
977 icon?: string;
978 text?: string;
979 color?: string;
980 style?: StyleProp<TextStyle>;
981}
982
983/**
984 * Defines the types that can be used in a header sub component
985 */
986export type HeaderSubComponent =
987 | React.ReactElement<{}>
988 | TextProps
989 | HeaderIcon;
990
991export interface HeaderProps extends ViewProperties {
992 /**
993 * Specify a different component as the background for the button.
994 * Useful for if you want to make a button with a gradient background.
995 *
996 * @default View
997 */
998 ViewComponent?: React.ComponentClass<any>;
999
1000 /**
1001 * Object of props to be applied to the linearGradient view(ViewComponent)
1002 */
1003 linearGradientProps?: Object;
1004
1005 /**
1006 * Accepts all props for StatusBar
1007 */
1008 statusBarProps?: StatusBarProperties;
1009
1010 /**
1011 * Sets the color of the status bar text.
1012 *
1013 * @default 'default'
1014 */
1015 barStyle?: StatusBarStyle;
1016
1017 /**
1018 * Configuration object for default component (icon: string, ...props for React Native Elements Icon) or a valid React Element define your left component here
1019 */
1020 leftComponent?: HeaderSubComponent;
1021
1022 /**
1023 * Configuration object for default component (text: string, ...props for React Native Text component) valid React Element define your center component here
1024 */
1025 centerComponent?: HeaderSubComponent;
1026
1027 /**
1028 * Configuration object for default component (icon: string, ...props for React Native Elements Icon component) or a valid React Element define your right component here
1029 */
1030 rightComponent?: HeaderSubComponent;
1031
1032 /**
1033 * Sets backgroundColor of the parent component
1034 */
1035 backgroundColor?: string;
1036
1037 /**
1038 * Background image source
1039 */
1040 backgroundImage?: ImageSourcePropType;
1041
1042 /**
1043 * Styles for the background image in the container
1044 */
1045 backgroundImageStyle?: ImageStyle;
1046
1047 /**
1048 * Determines the alignment of the title
1049 *
1050 * @default 'center'
1051 */
1052 placement?: 'left' | 'center' | 'right';
1053
1054 /**
1055 * Styling for main container
1056 */
1057 containerStyle?: StyleProp<ViewStyle>;
1058
1059 /**
1060 * Styles for the container surrounding the title
1061 */
1062 centerContainerStyle?: StyleProp<ViewStyle>;
1063
1064 /**
1065 * Styling for container around the leftComponent
1066 */
1067 leftContainerStyle?: StyleProp<ViewStyle>;
1068
1069 /**
1070 * Styling for container around the rightComponent
1071 */
1072 rightContainerStyle?: StyleProp<ViewStyle>;
1073}
1074
1075/**
1076 * Header component
1077 */
1078export class Header extends React.Component<HeaderProps, any> {}
1079
1080export interface IconProps extends IconButtonProps {
1081 /**
1082 * Type (defaults to material, options are material-community, zocial, font-awesome, octicon, ionicon, foundation, evilicon, simple-line-icon, or entypo)
1083 * @default 'material'
1084 */
1085 type?: IconType;
1086
1087 /**
1088 * View if no onPress method is defined, TouchableHighlight if onPress method is defined React Native component update React Native Component
1089 */
1090 Component?: React.ComponentClass;
1091
1092 /*
1093 * Extra props supplied to Icon Component from react-native-vector-icons.
1094 */
1095 iconProps?: VectorIconProps;
1096
1097 /**
1098 * Reverses color scheme
1099 *
1100 * @default false
1101 */
1102 reverse?: boolean;
1103
1104 /**
1105 * Adds box shadow to button
1106 *
1107 * @default false
1108 */
1109 raised?: boolean;
1110
1111 /**
1112 * Add styling to container holding icon
1113 */
1114 containerStyle?: StyleProp<ViewStyle>;
1115
1116 /**
1117 * Specify reverse icon color
1118 *
1119 * @default 'white'
1120 */
1121 reverseColor?: string;
1122
1123 /**
1124 * Styles for the Icon when disabled
1125 */
1126 disabledStyle?: StyleProp<ViewStyle>;
1127
1128 /**
1129 * FontAwesome5 solid style
1130 *
1131 * @default false
1132 */
1133 solid?: boolean;
1134
1135 /**
1136 * FontAwesome5 brands icon set
1137 *
1138 * @default false
1139 */
1140 brand?: boolean;
1141}
1142
1143/**
1144 * Icon component
1145 */
1146export class Icon extends React.Component<IconProps> {}
1147
1148export interface ScaleProps extends TouchableWithoutFeedbackProps {
1149 style?: StyleProp<ViewStyle>;
1150 defaultNumber?: number;
1151 activeScale?: number;
1152 tension?: number;
1153 friction?: number;
1154 pressInTension?: number;
1155 pressInFriction?: number;
1156 pressOutTension?: number;
1157 pressOutFriction?: number;
1158 useNativeDriver?: boolean;
1159}
1160
1161export interface ListItemProps extends TouchableComponent {
1162 containerStyle?: StyleProp<ViewStyle>;
1163 contentContainerStyle?: StyleProp<ViewStyle>;
1164 rightContentContainerStyle?: StyleProp<ViewStyle>;
1165 chevron?: boolean | Partial<IconProps> | React.ReactElement<{}>;
1166 checkmark?: boolean | Partial<IconProps> | React.ReactElement<{}>;
1167 title?: string | React.ReactElement<{}>;
1168 titleStyle?: StyleProp<TextStyle>;
1169 titleProps?: TextProperties;
1170 subtitle?: string | React.ReactElement<{}>;
1171 subtitleStyle?: StyleProp<TextStyle>;
1172 subtitleProps?: TextProperties;
1173 rightTitle?: string | React.ReactElement<{}>;
1174 rightTitleStyle?: StyleProp<TextStyle>;
1175 rightTitleProps?: TextProperties;
1176 rightSubtitle?: string | React.ReactElement<{}>;
1177 rightSubtitleStyle?: StyleProp<TextStyle>;
1178 rightSubtitleProps?: TextProperties;
1179 leftIcon?: Partial<IconProps> | React.ReactElement<{}>;
1180 rightIcon?: Partial<IconProps> | React.ReactElement<{}>;
1181 leftAvatar?: Partial<AvatarProps> | React.ReactElement<{}>;
1182 rightAvatar?: Partial<AvatarProps> | React.ReactElement<{}>;
1183 leftElement?: React.ReactElement<{}>;
1184 rightElement?: React.ReactElement<{}>;
1185 switch?: SwitchProperties;
1186 input?: InputProps;
1187 buttonGroup?: ButtonGroupProps;
1188 checkBox?: CheckBoxProps;
1189 badge?: BadgeProps;
1190 disabledStyle?: StyleProp<ViewStyle>;
1191 topDivider?: boolean;
1192 bottomDivider?: boolean;
1193 scaleProps?: ScaleProps;
1194 pad?: number;
1195 Component?: React.ComponentType<{}>;
1196 ViewComponent?: React.ComponentType<{}>;
1197}
1198
1199/**
1200 * ListItem component
1201 */
1202export class ListItem extends React.Component<ListItemProps, any> {}
1203
1204export interface OverlayProps extends ModalProps {
1205 /**
1206 * Content of the overlay
1207 */
1208 children: React.ReactElement<any>;
1209
1210 /**
1211 * If true, the overlay is visible
1212 */
1213 isVisible: boolean;
1214
1215 /**
1216 * Style for the backdrop
1217 */
1218 backdropStyle?: StyleProp<ViewStyle>;
1219
1220 /**
1221 * Style of the actual overlay
1222 */
1223 overlayStyle?: StyleProp<ViewStyle>;
1224
1225 /**
1226 * If to take up full screen width and height
1227 *
1228 * @default false
1229 */
1230 fullScreen?: boolean;
1231
1232 /**
1233 * Override React Native `Modal` component (usable for web-platform)
1234 */
1235 ModalComponent?: React.ComponentClass;
1236
1237 /**
1238 * Callback when user touches the backdrop
1239 */
1240 onBackdropPress?(): void;
1241}
1242
1243export class Overlay extends React.Component<OverlayProps> {}
1244
1245export interface ButtonInformation {
1246 title: string;
1247 icon: string;
1248 buttonStyle?: StyleProp<ViewStyle>;
1249 titleStyle?: StyleProp<TextStyle>;
1250}
1251
1252export interface PricingCardProps {
1253 /**
1254 * Title
1255 */
1256 title?: string;
1257
1258 /**
1259 * Price
1260 */
1261 price: string;
1262
1263 /**
1264 * Color scheme for button & title
1265 */
1266 color?: string;
1267
1268 /**
1269 * Pricing information
1270 */
1271 info?: string[];
1272
1273 /**
1274 * {title, icon, buttonStyle}
1275 * Button information
1276 */
1277 button: ButtonInformation;
1278
1279 /**
1280 * Function to be run when button is pressed
1281 */
1282 onButtonPress?(): void;
1283
1284 /**
1285 * Outer component styling
1286 */
1287 containerStyle?: StyleProp<ViewStyle>;
1288
1289 /**
1290 * Inner wrapper component styling
1291 */
1292 wrapperStyle?: StyleProp<ViewStyle>;
1293
1294 /**
1295 * component title style
1296 */
1297 titleStyle?: StyleProp<TextStyle>;
1298
1299 /**
1300 * component pricing text style
1301 */
1302 pricingStyle?: StyleProp<TextStyle>;
1303
1304 /**
1305 * component info text style
1306 */
1307 infoStyle?: StyleProp<TextStyle>;
1308}
1309
1310/**
1311 * PricingCard component
1312 */
1313export class PricingCard extends React.Component<PricingCardProps, any> {}
1314
1315/**
1316 * Rating, AirbnbRating, RatingProps, AirbnbRatingProps
1317 */
1318export * from 'react-native-ratings';
1319
1320export type IconNode = boolean | React.ReactElement<{}> | Partial<IconProps>;
1321
1322export interface SearchBarWrapper {
1323 /**
1324 * What style of search bar to display
1325 *
1326 * @default is 'default
1327 */
1328 platform?: 'default' | 'ios' | 'android';
1329}
1330
1331export interface SearchBarBase extends InputProps {
1332 /**
1333 * Styling for the searchbar container
1334 */
1335 containerStyle?: StyleProp<ViewStyle>;
1336
1337 /**
1338 * Optional styling for the TextInput's container
1339 */
1340 inputContainerStyle?: StyleProp<ViewStyle>;
1341
1342 /**
1343 * Override the clear Icon props or use a custom component. Use null or false to hide the icon.
1344 */
1345 clearIcon?: IconNode;
1346
1347 /**
1348 * Override the search Icon props or use a custom component. Use null or false to hide the icon.
1349 */
1350 searchIcon?: IconNode;
1351
1352 /**
1353 * TextInput styling
1354 */
1355 inputStyle?: StyleProp<TextStyle>;
1356
1357 /**
1358 * Optional props to pass to the ActivityIndicator
1359 */
1360 loadingProps?: ActivityIndicatorProperties;
1361
1362 /**
1363 * If to show the loading indicator
1364 *
1365 * @default false
1366 */
1367 showLoading?: boolean;
1368
1369 /**
1370 * Container style for the left icon
1371 */
1372 leftIconContainerStyle?: StyleProp<ViewStyle>;
1373
1374 /**
1375 * Container style for the right icon
1376 */
1377 rightIconContainerStyle?: StyleProp<ViewStyle>;
1378
1379 /**
1380 * Callback fired when the clear button is pressed
1381 */
1382 onClear?(): void;
1383
1384 /**
1385 * Callback fired when the input is focused
1386 */
1387 onFocus?(): void;
1388
1389 /**
1390 * Callback fired when the input is blurred via the keyboard
1391 */
1392 onBlur?(): void;
1393
1394 /**
1395 * Method to fire when text is changed
1396 */
1397 onChangeText?(text: string): void;
1398}
1399
1400export interface TooltipProps {
1401 /**
1402 * sets backgroundColor of the tooltip and pointer.
1403 */
1404 backgroundColor?: string;
1405
1406 /**
1407 * Color to highlight the item the tooltip is surrounding.
1408 */
1409 highlightColor?: string;
1410
1411 /**
1412 * Override React Native `Modal` component (usable for web-platform)
1413 */
1414 ModalComponent?: React.ComponentClass;
1415
1416 /**
1417 * function which gets called on closing the tooltip.
1418 */
1419 onClose?(): void;
1420
1421 /**
1422 * function which gets called on opening the tooltip.
1423 */
1424 onOpen?(): void;
1425
1426 /**
1427 * Color of tooltip pointer, it defaults to the backgroundColor if none passed .
1428 */
1429 pointerColor?: string;
1430
1431 /**
1432 * Flag to determine to toggle or not the tooltip on press.
1433 */
1434 toggleOnPress?: boolean;
1435
1436 /**
1437 * To determine whether to activate tooltip by onPress or onLongPress.
1438 */
1439 toggleAction?: string;
1440
1441 /**
1442 * Component to be rendered as the display container.
1443 */
1444 popover?: React.ReactElement<{}>;
1445
1446 /**
1447 * Passes style object to tooltip container
1448 */
1449 containerStyle?: StyleProp<ViewStyle>;
1450
1451 /**
1452 * Tooltip container height. Necessary in order to render the container in the correct place. Pass height according to the size of the content rendered inside the container.
1453 * @default 40
1454 */
1455 height?: number;
1456
1457 /**
1458 * Tooltip container width. Necessary in order to render the container in the correct place. Pass height according to the size of the content rendered inside the container.
1459 * @default 150
1460 */
1461 width?: number;
1462
1463 /**
1464 * Flag to determine whether or not dislay overlay shadow when tooltip is open.
1465 *
1466 * @default true
1467 */
1468 withOverlay?: boolean;
1469
1470 /**
1471 * Color of overlay shadow when tooltip is open.
1472 *
1473 * @default 'rgba(250, 250, 250, 0.70)'
1474 */
1475 overlayColor?: string;
1476
1477 /**
1478 * Flag to determine whether or not dislay pointer.
1479 */
1480 withPointer?: boolean;
1481
1482 /**
1483 * Force skip StatusBar height when calculating yOffset of element position (usable inside Modal on Android)
1484 */
1485 skipAndroidStatusBar?: boolean;
1486
1487 /**
1488 * Disable auto hiding of tooltip when touching/scrolling anywhere inside the active tooltip popover container. Tooltip closes only when overlay backdrop is pressed (or) highlighted tooltip button is pressed
1489 */
1490 closeOnlyOnBackdropPress?: boolean;
1491}
1492
1493export class Tooltip extends React.Component<TooltipProps, any> {
1494 /**
1495 * Toggles tooltip manually.
1496 */
1497 toggleTooltip(): void;
1498}
1499
1500export interface SearchBarDefault extends SearchBarBase {
1501 /**
1502 * Change theme to light theme
1503 *
1504 * @default false
1505 */
1506 lightTheme?: boolean;
1507
1508 /**
1509 * Change TextInput styling to rounded corners
1510 *
1511 * @default false
1512 */
1513 round?: boolean;
1514}
1515
1516export interface SearchBarPlatform extends SearchBarBase {
1517 /**
1518 * Callback fired when the cancel button is pressed
1519 */
1520 onCancel?(): void;
1521}
1522
1523export interface SearchBarAndroid extends SearchBarPlatform {
1524 /**
1525 * Override the cancel Icon props or use a custom component. Use null or false to hide the icon.
1526 */
1527 cancelIcon?: IconNode;
1528}
1529
1530export interface SearchBarIOS extends SearchBarPlatform {
1531 /**
1532 * Props passed to cancel button
1533 */
1534 cancelButtonProps?: Partial<TouchableOpacityProps> & {
1535 buttonStyle?: StyleProp<ViewStyle>;
1536 buttonTextStyle?: StyleProp<TextStyle>;
1537 color?: string;
1538 buttonDisabledStyle?: StyleProp<ViewStyle>;
1539 buttonDisabledTextStyle?: StyleProp<ViewStyle>;
1540 };
1541
1542 /**
1543 * title of cancel button on iOS. Default: 'Cancel'.
1544 */
1545 cancelButtonTitle?: string;
1546
1547 /**
1548 * When `true` the cancel button will stay visible after blur events.
1549 */
1550 showCancel?: boolean;
1551}
1552
1553export type SearchBarProps = SearchBarWrapper &
1554 SearchBarBase &
1555 SearchBarPlatform &
1556 SearchBarDefault &
1557 SearchBarIOS &
1558 SearchBarAndroid;
1559
1560/**
1561 * SearchBar component
1562 */
1563export class SearchBar extends React.Component<SearchBarProps, any> {
1564 /**
1565 * Holds reference to the stored input.
1566 */
1567 input: TextInput;
1568
1569 /**
1570 * Call focus on the TextInput
1571 */
1572 focus(): void;
1573
1574 /**
1575 * Call blur on the TextInput
1576 */
1577 blur(): void;
1578
1579 /**
1580 * Call clear on the TextInput
1581 */
1582 clear(): void;
1583
1584 /**
1585 * Only available for Android and IOS
1586 * call blur on the TextInput
1587 * call cancel passed from Props
1588 */
1589 cancel?(): void;
1590}
1591
1592export interface SliderProps {
1593 /**
1594 * Initial value of the slider
1595 *
1596 * @default 0
1597 */
1598 value?: number;
1599
1600 /**
1601 * Choose the orientation
1602 *
1603 * @default horizontal
1604 */
1605 orientation?: 'horizontal' | 'vertical';
1606
1607 /**
1608 * If true the user won't be able to move the slider
1609 *
1610 * @default false
1611 */
1612 disabled?: boolean;
1613
1614 /**
1615 * Initial minimum value of the slider
1616 *
1617 * @default 0
1618 */
1619 minimumValue?: number;
1620
1621 /**
1622 * Initial maximum value of the slider
1623 *
1624 * @default 1
1625 */
1626 maximumValue?: number;
1627
1628 /**
1629 * Step value of the slider. The value should be between 0 and maximumValue - minimumValue)
1630 *
1631 * @default 0
1632 */
1633 step?: number;
1634
1635 /**
1636 * The color used for the track to the left of the button
1637 *
1638 * @default '#3f3f3f'
1639 */
1640 minimumTrackTintColor?: string;
1641
1642 /**
1643 * The color used for the track to the right of the button
1644 *
1645 * @default '#b3b3b3'
1646 */
1647 maximumTrackTintColor?: string;
1648
1649 /**
1650 * The color used for the thumb
1651 *
1652 * @default '#343434'
1653 */
1654 thumbTintColor?: string;
1655
1656 /**
1657 * The size of the touch area that allows moving the thumb. The touch area has the same center as the visible thumb.
1658 * This allows to have a visually small thumb while still allowing the user to move it easily.
1659 *
1660 * @default "{width: 40, height: 40}"
1661 */
1662 thumbTouchSize?: {
1663 width?: number;
1664 height?: number;
1665 };
1666
1667 /**
1668 * Callback continuously called while the user is dragging the slider
1669 */
1670 onValueChange?(value: number): void;
1671
1672 /**
1673 * Callback called when the user starts changing the value (e.g. when the slider is pressed)
1674 */
1675 onSlidingStart?(value: number): void;
1676
1677 /**
1678 * Callback called when the user finishes changing the value (e.g. when the slider is released)
1679 */
1680 onSlidingComplete?(value: number): void;
1681
1682 /**
1683 * The style applied to the slider container
1684 */
1685 style?: StyleProp<ViewStyle>;
1686
1687 /**
1688 * The style applied to the track
1689 */
1690 trackStyle?: StyleProp<ViewStyle>;
1691
1692 /**
1693 * Allow touch on track to move the thumb.
1694 */
1695 allowTouchTrack?: boolean;
1696
1697 /**
1698 * The style applied to the thumb
1699 */
1700 thumbStyle?: StyleProp<ViewStyle>;
1701
1702 /**
1703 * The props applied to the thumb
1704 */
1705 thumbProps?: any;
1706
1707 /**
1708 * Set this to true to visually see the thumb touch rect in green.
1709 *
1710 * @default false
1711 */
1712 debugTouchArea?: boolean;
1713
1714 /**
1715 * Set to true if you want to use the default 'spring' animation
1716 *
1717 * @default false
1718 */
1719 animateTransitions?: boolean;
1720
1721 /**
1722 * Set to 'spring' or 'timing' to use one of those two types of animations with the default animation properties.
1723 *
1724 * @default 'timing'
1725 */
1726 animationType?: 'spring' | 'timing';
1727
1728 /**
1729 * Used to configure the animation parameters. These are the same parameters in the Animated library.
1730 *
1731 * @default undefined
1732 */
1733 animationConfig?:
1734 | Animated.TimingAnimationConfig
1735 | Animated.SpringAnimationConfig;
1736}
1737
1738/**
1739 * Slider component
1740 */
1741export class Slider extends React.Component<SliderProps, any> {}
1742
1743export type SocialMediaType =
1744 | 'facebook'
1745 | 'twitter'
1746 | 'google-plus-official'
1747 | 'google'
1748 | 'pinterest'
1749 | 'linkedin'
1750 | 'youtube'
1751 | 'vimeo'
1752 | 'tumblr'
1753 | 'instagram'
1754 | 'quora'
1755 | 'flickr'
1756 | 'foursquare'
1757 | 'wordpress'
1758 | 'stumbleupon'
1759 | 'github'
1760 | 'github-alt'
1761 | 'twitch'
1762 | 'medium'
1763 | 'soundcloud'
1764 | 'gitlab'
1765 | 'angellist'
1766 | 'codepen'
1767 | 'weibo'
1768 | 'vk';
1769
1770export interface SocialIconProps {
1771 /**
1772 * Title if made into a button
1773 */
1774 title?: string;
1775
1776 /**
1777 * Social media type
1778 */
1779 type: SocialMediaType;
1780
1781 /**
1782 * Adds a drop shadow, set to false to remove
1783 *
1784 * @default true
1785 */
1786 raised?: boolean;
1787
1788 /**
1789 * Creates button
1790 *
1791 * @default false
1792 */
1793 button?: boolean;
1794
1795 /**
1796 * onPress method
1797 */
1798 onPress?(): void;
1799
1800 /**
1801 * @default none function onLongPress method
1802 */
1803 onLongPress?(): void;
1804
1805 /**
1806 * Reverses icon color scheme, setting background to white and icon to primary color
1807 *
1808 * @default false
1809 */
1810 light?: boolean;
1811
1812 /**
1813 * Extra styling for icon component
1814 */
1815 iconStyle?: StyleProp<ViewStyle>;
1816
1817 /**
1818 * Button styling
1819 */
1820 style?: StyleProp<ViewStyle>;
1821
1822 /**
1823 * Icon color
1824 */
1825 iconColor?: string;
1826
1827 /**
1828 * Icon size
1829 *
1830 * @default 24
1831 */
1832 iconSize?: number;
1833
1834 /**
1835 * Component Type of button
1836 *
1837 * @default TouchableHighlight
1838 */
1839 Component?: React.ComponentClass;
1840
1841 /**
1842 * Specify different font family
1843 *
1844 * @default System font bold (iOS), Sans Serif Black (android)
1845 */
1846 fontFamily?: string;
1847
1848 /**
1849 * Specify font weight of title if set as a button with a title
1850 *
1851 * @default bold (ios), black(android)
1852 */
1853 fontWeight?: string;
1854
1855 /**
1856 * Specify text styling
1857 */
1858 fontStyle?: StyleProp<TextStyle>;
1859
1860 /**
1861 * Disable button
1862 *
1863 * @default false
1864 */
1865 disabled?: boolean;
1866
1867 /**
1868 * Shows loading indicator
1869 *
1870 * @default false
1871 */
1872 loading?: boolean;
1873
1874 /**
1875 * Specify underlayColor for TouchableHighlight
1876 *
1877 * @default 'white' if `light` prop is true, otherwise defaults to icon color.
1878 */
1879 underlayColor?: string;
1880}
1881
1882/**
1883 * SocialIcon component
1884 */
1885export class SocialIcon extends React.Component<SocialIconProps, any> {}
1886
1887export interface TileProps {
1888 /**
1889 * Icon Component Props
1890 */
1891 icon?: IconObject;
1892
1893 /**
1894 * Styling for the outer icon container
1895 */
1896 iconContainerStyle?: StyleProp<ViewStyle>;
1897
1898 /**
1899 * Text inside the tile
1900 */
1901 title?: string;
1902
1903 /**
1904 * Styling for the title
1905 */
1906 titleStyle?: StyleProp<TextStyle>;
1907
1908 /**
1909 * Text inside the tile when tile is featured
1910 */
1911 caption?: string;
1912
1913 /**
1914 * Styling for the caption
1915 */
1916 captionStyle?: StyleProp<TextStyle>;
1917
1918 /**
1919 * Changes the look of the tile
1920 */
1921 featured?: boolean;
1922
1923 /**
1924 * @default none object (style) Styling for the outer tile container
1925 */
1926 containerStyle?: StyleProp<ViewStyle>;
1927
1928 /**
1929 * Source for the image
1930 */
1931 imageSrc: ImageURISource | string | number;
1932
1933 /**
1934 * Styling for the image
1935 */
1936 imageContainerStyle?: StyleProp<ViewStyle>;
1937 /**
1938 * Styling for overlay
1939 */
1940 overlayContainerStyle?: StyleProp<ViewStyle>;
1941 /**
1942 * @default none function (event) Function to call when tile is pressed
1943 */
1944 onPress?(): void;
1945
1946 /**
1947 * Number passed to control opacity on press
1948 *
1949 * @default 0.2
1950 */
1951 activeOpacity?: number;
1952
1953 /**
1954 * Styling for bottom container when not featured tile
1955 */
1956 contentContainerStyle?: StyleProp<ViewStyle>;
1957
1958 /**
1959 * Width for the tile
1960 *
1961 * @default Device Width
1962 */
1963 width?: number;
1964
1965 /**
1966 * Height for the tile
1967 *
1968 * @default Device Width * 0.8
1969 */
1970 height?: number;
1971
1972 /**
1973 * Specify a different component as the Image component
1974 * @default React Native BackgroundImage component
1975 */
1976 ImageComponent?: React.ComponentClass;
1977
1978 /**
1979 * Optional properties to pass to the image if provided e.g "resizeMode"
1980 */
1981 imageProps?: Partial<ImageProps>;
1982}
1983
1984/**
1985 * Tile component
1986 */
1987export class Tile extends React.Component<TileProps> {}
1988
1989export interface ImageProps extends RNImageProps {
1990 /**
1991 * Component for enclosing element (eg: TouchableHighlight, View, etc)
1992 *
1993 * @default View
1994 */
1995 Component?: React.ComponentClass;
1996
1997 /**
1998 * Callback function when pressing component
1999 */
2000 onPress?(): void;
2001
2002 /**
2003 * Callback function when long pressing component
2004 */
2005 onLongPress?(): void;
2006
2007 /**
2008 * Specify a different component as the Image component.
2009 *
2010 * @default Image
2011 */
2012 ImageComponent?: React.ComponentType<any>;
2013
2014 /**
2015 * Content to render when image is loading
2016 */
2017 PlaceholderContent?: React.ReactElement<any>;
2018
2019 /**
2020 * Additional styling for the container
2021 */
2022 containerStyle?: StyleProp<ViewStyle>;
2023
2024 /**
2025 * Additional styling for the placeholder container
2026 */
2027 placeholderStyle?: StyleProp<ViewStyle>;
2028
2029 /**
2030 * Perform fade transition on image load
2031 *
2032 * @default true
2033 */
2034 transition?: boolean;
2035}
2036
2037/**
2038 * Image component
2039 */
2040export class Image extends React.Component<ImageProps> {}
2041
2042/**
2043 * Colors
2044 */
2045
2046export interface Colors {
2047 readonly primary: string;
2048 readonly secondary: string;
2049 readonly grey0: string;
2050 readonly grey1: string;
2051 readonly grey2: string;
2052 readonly grey3: string;
2053 readonly grey4: string;
2054 readonly grey5: string;
2055 readonly greyOutline: string;
2056 readonly searchBg: string;
2057 readonly success: string;
2058 readonly warning: string;
2059 readonly error: string;
2060 readonly disabled: string;
2061 readonly divider: string;
2062 readonly platform: {
2063 ios: {
2064 primary: string;
2065 secondary: string;
2066 success: string;
2067 error: string;
2068 warning: string;
2069 };
2070 android: {
2071 primary: string;
2072 secondary: string;
2073 success: string;
2074 error: string;
2075 warning: string;
2076 };
2077 };
2078}
2079
2080export const colors: Colors;
2081
2082/* Utility Functions */
2083
2084/**
2085 * TODO make the Icon Type an export of the react-native-vector-icons type definitions.
2086 */
2087export function getIconType(type: IconType): any;
2088
2089/**
2090 * Method to normalize size of fonts across devices
2091 */
2092export function normalize(size: number): number;
2093
2094/**
2095 * Registers custom icons
2096 */
2097export function registerCustomIconType(id: string, font: any): void;
2098
2099type RecursivePartial<T> = { [P in keyof T]?: RecursivePartial<T[P]> };
2100
2101export interface FullTheme {
2102 Avatar: Partial<AvatarProps>;
2103 Accessory: Partial<IconProps> & Partial<ImageProps>;
2104 Badge: Partial<BadgeProps>;
2105 BottomSheet: Partial<BottomSheetProps>;
2106 Button: Partial<ButtonProps>;
2107 ButtonGroup: Partial<ButtonGroupProps>;
2108 Card: Partial<CardProps>;
2109 CheckBox: Partial<CheckBoxProps>;
2110 Divider: Partial<DividerProps>;
2111 Header: Partial<HeaderProps>;
2112 Icon: Partial<IconProps>;
2113 Image: Partial<ImageProps>;
2114 Input: Partial<InputProps>;
2115 ListItem: Partial<ListItemProps>;
2116 Overlay: Partial<OverlayProps>;
2117 PricingCard: Partial<PricingCardProps>;
2118 Rating: Partial<RatingProps>;
2119 AirbnbRating: Partial<AirbnbRatingProps>;
2120 SearchBar: Partial<SearchBarProps>;
2121 Slider: Partial<SliderProps>;
2122 SocialIcon: Partial<SocialIconProps>;
2123 Text: Partial<TextProps>;
2124 Tile: Partial<TileProps>;
2125 Tooltip: Partial<TooltipProps>;
2126 colors: RecursivePartial<Colors>;
2127}
2128
2129export type Theme<T = {}> = Partial<FullTheme> & T;
2130
2131export type UpdateTheme = (updates: RecursivePartial<FullTheme>) => void;
2132
2133export type ReplaceTheme = (updates: RecursivePartial<FullTheme>) => void;
2134
2135export interface ThemeProps<T> {
2136 theme: Theme<T>;
2137 updateTheme: UpdateTheme;
2138 replaceTheme: ReplaceTheme;
2139}
2140
2141/**
2142 * ThemeProvider
2143 */
2144export interface ThemeProviderProps<T> {
2145 theme?: Theme<T>;
2146 children: React.ReactNode;
2147 useDark?: boolean;
2148}
2149
2150export class ThemeProvider<T> extends React.Component<ThemeProviderProps<T>> {
2151 updateTheme: UpdateTheme;
2152 replaceTheme: ReplaceTheme;
2153
2154 getTheme(): Theme<T>;
2155}
2156
2157export interface ThemeConsumerProps<T> {
2158 children(props: ThemeProps<T>): React.ReactNode;
2159}
2160
2161export class ThemeConsumer<T> extends React.Component<ThemeConsumerProps<T>> {}
2162
2163export const ThemeContext: React.Context<ThemeProps<{}>>;
2164
2165export function withTheme<P = {}, T = {}>(
2166 component: React.ComponentType<P & ThemeProps<T>>,
2167 themeKey?: string
2168): React.ComponentClass<Omit<P, keyof ThemeProps<T>>>;