secullum-react-native-ui 4.3.8-beta.2 → 4.3.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/lib/components/AppShell.d.ts +24 -0
  2. package/lib/components/AppShell.js +79 -0
  3. package/lib/components/Button.d.ts +47 -0
  4. package/lib/components/Button.js +65 -0
  5. package/lib/components/Card.d.ts +65 -0
  6. package/lib/components/Card.js +125 -0
  7. package/lib/components/CheckBox.d.ts +34 -0
  8. package/lib/components/CheckBox.js +46 -0
  9. package/lib/components/DatePicker.d.ts +67 -0
  10. package/lib/components/DatePicker.js +105 -0
  11. package/lib/components/DatePicker.web.d.ts +64 -0
  12. package/lib/components/DatePicker.web.js +105 -0
  13. package/lib/components/Delay.d.ts +12 -0
  14. package/lib/components/Delay.js +21 -0
  15. package/lib/components/Details.d.ts +66 -0
  16. package/lib/components/Details.js +94 -0
  17. package/lib/components/DetailsHeader.d.ts +37 -0
  18. package/lib/components/DetailsHeader.js +63 -0
  19. package/lib/components/DimensionsMonitor.d.ts +21 -0
  20. package/lib/components/DimensionsMonitor.js +35 -0
  21. package/lib/components/DropDown.d.ts +35 -0
  22. package/lib/components/DropDown.js +263 -0
  23. package/lib/components/ErrorMessage.d.ts +16 -0
  24. package/lib/components/ErrorMessage.js +29 -0
  25. package/lib/components/FilePicker.d.ts +28 -0
  26. package/lib/components/FilePicker.js +44 -0
  27. package/lib/components/Header.d.ts +56 -0
  28. package/lib/components/Header.js +89 -0
  29. package/lib/components/HeaderDesktop.d.ts +59 -0
  30. package/lib/components/HeaderDesktop.js +80 -0
  31. package/lib/components/ImageButton.d.ts +14 -0
  32. package/lib/components/ImageButton.js +32 -0
  33. package/lib/components/KeyboardAvoidingView.d.ts +34 -0
  34. package/lib/components/KeyboardAvoidingView.js +92 -0
  35. package/lib/components/Link.d.ts +17 -0
  36. package/lib/components/Link.js +28 -0
  37. package/lib/components/Loading.d.ts +4 -0
  38. package/lib/components/Loading.js +37 -0
  39. package/lib/components/Menu.d.ts +42 -0
  40. package/lib/components/Menu.js +112 -0
  41. package/lib/components/MenuDesktop.d.ts +24 -0
  42. package/lib/components/MenuDesktop.js +38 -0
  43. package/lib/components/MenuMobile.d.ts +47 -0
  44. package/lib/components/MenuMobile.js +85 -0
  45. package/lib/components/Message.d.ts +37 -0
  46. package/lib/components/Message.js +50 -0
  47. package/lib/components/Modal.d.ts +11 -0
  48. package/lib/components/Modal.js +20 -0
  49. package/lib/components/MultiSelect.d.ts +51 -0
  50. package/lib/components/MultiSelect.js +376 -0
  51. package/lib/components/NoRecordMessage.d.ts +23 -0
  52. package/lib/components/NoRecordMessage.js +35 -0
  53. package/lib/components/Question.d.ts +57 -0
  54. package/lib/components/Question.js +72 -0
  55. package/lib/components/RadioButton.d.ts +42 -0
  56. package/lib/components/RadioButton.js +53 -0
  57. package/lib/components/RadioGroup.d.ts +44 -0
  58. package/lib/components/RadioGroup.js +64 -0
  59. package/lib/components/RangeDatePicker.d.ts +57 -0
  60. package/lib/components/RangeDatePicker.js +126 -0
  61. package/lib/components/RangeDatePicker.web.d.ts +61 -0
  62. package/lib/components/RangeDatePicker.web.js +119 -0
  63. package/lib/components/Space.d.ts +11 -0
  64. package/lib/components/Space.js +14 -0
  65. package/lib/components/StatusBar.d.ts +11 -0
  66. package/lib/components/StatusBar.js +27 -0
  67. package/lib/components/Switch.d.ts +34 -0
  68. package/lib/components/Switch.js +49 -0
  69. package/lib/components/Table.d.ts +28 -0
  70. package/lib/components/Table.js +62 -0
  71. package/lib/components/Table.web.d.ts +18 -0
  72. package/lib/components/Table.web.js +108 -0
  73. package/lib/components/Text.d.ts +28 -0
  74. package/lib/components/Text.js +36 -0
  75. package/lib/components/TextBox.d.ts +115 -0
  76. package/lib/components/TextBox.js +103 -0
  77. package/lib/components/TextBoxMask.d.ts +12 -0
  78. package/lib/components/TextBoxMask.js +29 -0
  79. package/lib/components/TimePicker.d.ts +63 -0
  80. package/lib/components/TimePicker.js +111 -0
  81. package/lib/components/TimePicker.web.d.ts +48 -0
  82. package/lib/components/TimePicker.web.js +82 -0
  83. package/lib/index.d.ts +39 -0
  84. package/lib/index.js +44 -0
  85. package/lib/modules/browser.d.ts +2 -0
  86. package/lib/modules/browser.js +50 -0
  87. package/lib/modules/format.d.ts +6 -0
  88. package/lib/modules/format.js +99 -0
  89. package/lib/modules/layout.d.ts +1 -0
  90. package/lib/modules/layout.js +10 -0
  91. package/lib/modules/theme.d.ts +41 -0
  92. package/lib/modules/theme.js +49 -0
  93. package/lib/modules/validation.d.ts +3 -0
  94. package/lib/modules/validation.js +12 -0
  95. package/package.json +1 -1
@@ -0,0 +1,64 @@
1
+ import * as React from 'react';
2
+ import { StyleProp, ViewStyle } from 'react-native';
3
+ import 'react-date-range/dist/styles.css';
4
+ import '../../styles/RangeDatePicker.css';
5
+ export interface DatePickerProperties {
6
+ label: string;
7
+ value?: Date;
8
+ clearable?: boolean;
9
+ onChange: (value?: Date) => void;
10
+ style?: StyleProp<ViewStyle>;
11
+ dateFormat: string;
12
+ nativeID?: string;
13
+ }
14
+ export interface DatePickerState {
15
+ showModal: boolean;
16
+ }
17
+ export declare class DatePicker extends React.Component<DatePickerProperties, DatePickerState> {
18
+ static defaultProps: {
19
+ clearable: boolean;
20
+ dateFormat: string;
21
+ };
22
+ state: DatePickerState;
23
+ private calendarRef;
24
+ componentWillMount(): void;
25
+ componentWillUnmount(): void;
26
+ handleClick: (event: MouseEvent) => void;
27
+ handlePress: () => void;
28
+ handleClear: () => void;
29
+ handleConfirm: (value: any) => void;
30
+ getStyles: () => {
31
+ container: {
32
+ paddingLeft: number;
33
+ paddingRight: number;
34
+ paddingVertical: number;
35
+ borderWidth: number;
36
+ borderColor: string;
37
+ borderRadius: number;
38
+ flexDirection: "row";
39
+ alignItems: "center";
40
+ };
41
+ modalOverlay: {
42
+ justifyContent: "center";
43
+ alignItems: "center";
44
+ };
45
+ label: {
46
+ color: string;
47
+ fontFamily: string;
48
+ fontSize: number;
49
+ lineHeight: number;
50
+ };
51
+ value: {
52
+ color: string;
53
+ fontFamily: string;
54
+ fontSize: number;
55
+ lineHeight: number;
56
+ minHeight: number;
57
+ };
58
+ clearIcon: {
59
+ borderWidth: number;
60
+ marginLeft: string;
61
+ };
62
+ };
63
+ render(): JSX.Element;
64
+ }
@@ -0,0 +1,105 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const theme_1 = require("../modules/theme");
5
+ const layout_1 = require("../modules/layout");
6
+ const format_1 = require("../modules/format");
7
+ const ImageButton_1 = require("./ImageButton");
8
+ const Modal_1 = require("./Modal");
9
+ const react_date_range_1 = require("react-date-range");
10
+ const react_native_1 = require("react-native");
11
+ require("react-date-range/dist/styles.css");
12
+ require("../../styles/RangeDatePicker.css");
13
+ class DatePicker extends React.Component {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.state = {
17
+ showModal: false
18
+ };
19
+ this.calendarRef = React.createRef();
20
+ this.handleClick = (event) => {
21
+ if (this.calendarRef.current &&
22
+ !this.calendarRef.current.contains(event.target)) {
23
+ this.setState({ showModal: false });
24
+ }
25
+ };
26
+ this.handlePress = () => {
27
+ this.setState({ showModal: true });
28
+ };
29
+ this.handleClear = () => {
30
+ this.props.onChange(undefined);
31
+ };
32
+ this.handleConfirm = (value) => {
33
+ this.props.onChange(value);
34
+ this.setState({ showModal: false });
35
+ };
36
+ this.getStyles = () => {
37
+ const theme = theme_1.getTheme();
38
+ const styles = react_native_1.StyleSheet.create({
39
+ container: {
40
+ paddingLeft: 16,
41
+ paddingRight: 4,
42
+ paddingVertical: 8,
43
+ borderWidth: 1,
44
+ borderColor: theme.borderColor1,
45
+ borderRadius: 3,
46
+ flexDirection: 'row',
47
+ alignItems: 'center'
48
+ },
49
+ modalOverlay: {
50
+ justifyContent: 'center',
51
+ alignItems: 'center'
52
+ },
53
+ label: {
54
+ color: theme.textColor2,
55
+ fontFamily: theme.fontFamily3,
56
+ fontSize: layout_1.isTablet() ? 15 : 12,
57
+ lineHeight: 16
58
+ },
59
+ value: {
60
+ color: theme.textColor1,
61
+ fontFamily: theme.fontFamily1,
62
+ fontSize: 16,
63
+ lineHeight: 22,
64
+ minHeight: 22
65
+ },
66
+ clearIcon: {
67
+ borderWidth: 0,
68
+ marginLeft: 'auto'
69
+ }
70
+ });
71
+ return styles;
72
+ };
73
+ }
74
+ componentWillMount() {
75
+ document.addEventListener('mousedown', this.handleClick, false);
76
+ }
77
+ componentWillUnmount() {
78
+ document.removeEventListener('mousedown', this.handleClick, false);
79
+ }
80
+ render() {
81
+ const { label, value, clearable, style, dateFormat, nativeID } = this.props;
82
+ const styles = this.getStyles();
83
+ const theme = theme_1.getTheme();
84
+ return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: this.handlePress },
85
+ React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style] },
86
+ React.createElement(react_native_1.View, { ref: ref => ref && ref.setNativeProps({ id: 'date-picker' }) },
87
+ React.createElement(react_native_1.Text, { style: styles.label }, label),
88
+ React.createElement(react_native_1.Text, { style: styles.value }, value != undefined ? format_1.formatDate(value, dateFormat) : '')),
89
+ React.createElement(ImageButton_1.ImageButton, { icon: value && clearable ? 'times' : 'calendar', style: styles.clearIcon, iconColor: value && clearable ? theme.textColor1 : theme.textColor2, onPress: value && clearable ? this.handleClear : this.handlePress, hitBoxSize: 30 }),
90
+ React.createElement(Modal_1.Modal, { visible: this.state.showModal, overlayStyle: styles.modalOverlay },
91
+ React.createElement("div", { ref: this.calendarRef, style: {
92
+ borderRadius: '5px',
93
+ position: 'absolute',
94
+ top: '50%',
95
+ marginTop: '-150px',
96
+ fontFamily: theme.fontFamily1
97
+ } },
98
+ React.createElement(react_date_range_1.Calendar, { locale: format_1.getDateFnsLocale(), date: value, onChange: this.handleConfirm }))))));
99
+ }
100
+ }
101
+ DatePicker.defaultProps = {
102
+ clearable: true,
103
+ dateFormat: 'dddd, DD/MM/YYYY'
104
+ };
105
+ exports.DatePicker = DatePicker;
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ export interface DelayProperties {
3
+ wait: number;
4
+ }
5
+ export interface DelayState {
6
+ hidden: boolean;
7
+ }
8
+ export declare class Delay extends React.Component<DelayProperties, DelayState> {
9
+ state: DelayState;
10
+ componentDidMount(): void;
11
+ render(): {} | null | undefined;
12
+ }
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ class Delay extends React.Component {
5
+ constructor() {
6
+ super(...arguments);
7
+ this.state = {
8
+ hidden: true
9
+ };
10
+ }
11
+ componentDidMount() {
12
+ const { wait } = this.props;
13
+ setTimeout(() => {
14
+ this.setState({ hidden: false });
15
+ }, wait);
16
+ }
17
+ render() {
18
+ return this.state.hidden ? null : this.props.children;
19
+ }
20
+ }
21
+ exports.Delay = Delay;
@@ -0,0 +1,66 @@
1
+ import * as React from 'react';
2
+ import { StyleProp, TextStyle } from 'react-native';
3
+ export interface DetailsIcon {
4
+ name: string;
5
+ color: string;
6
+ size: number;
7
+ onPress?: () => void;
8
+ }
9
+ export interface DetailsLine {
10
+ title?: string;
11
+ value?: string;
12
+ icons?: Array<DetailsIcon>;
13
+ render?: () => React.ReactNode;
14
+ }
15
+ export interface DetailsProperties {
16
+ title: string;
17
+ lines: Array<DetailsLine>;
18
+ lineTitleStyle?: StyleProp<TextStyle>;
19
+ lineValueStyle?: StyleProp<TextStyle>;
20
+ }
21
+ export declare class Details extends React.Component<DetailsProperties> {
22
+ getStyles: () => {
23
+ title: {
24
+ fontFamily: string;
25
+ fontSize: number;
26
+ color: string;
27
+ };
28
+ lineSection: {
29
+ paddingVertical: number;
30
+ flexDirection: "row";
31
+ justifyContent: "space-between";
32
+ alignItems: "center";
33
+ minHeight: number;
34
+ };
35
+ lineSectionCustomRender: {
36
+ padding: number;
37
+ };
38
+ lineText: {
39
+ fontFamily: string;
40
+ fontSize: number;
41
+ color: string;
42
+ minWidth: number;
43
+ };
44
+ lineValue: {
45
+ textAlign: "center";
46
+ };
47
+ lineTitle: {
48
+ textAlign: "left";
49
+ flexShrink: number;
50
+ };
51
+ lineValueContainer: {
52
+ flexDirection: "row";
53
+ flexGrow: number;
54
+ flexShrink: number;
55
+ alignItems: "center";
56
+ justifyContent: "flex-end";
57
+ };
58
+ lineValueIcon: {
59
+ width: number;
60
+ textAlign: "center";
61
+ };
62
+ };
63
+ renderIcon: (icon: DetailsIcon, index: number) => JSX.Element;
64
+ renderLine: (line: DetailsLine, index: number) => JSX.Element;
65
+ render(): JSX.Element;
66
+ }
@@ -0,0 +1,94 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const react_native_1 = require("react-native");
5
+ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
+ const Card_1 = require("./Card");
7
+ const Space_1 = require("./Space");
8
+ const theme_1 = require("../modules/theme");
9
+ const layout_1 = require("../modules/layout");
10
+ class Details extends React.Component {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.getStyles = () => {
14
+ const theme = theme_1.getTheme();
15
+ const styles = react_native_1.StyleSheet.create({
16
+ title: {
17
+ fontFamily: theme.fontFamily1,
18
+ fontSize: layout_1.isTablet() ? 22 : 18,
19
+ color: theme.textColor1
20
+ },
21
+ lineSection: {
22
+ paddingVertical: 10,
23
+ flexDirection: 'row',
24
+ justifyContent: 'space-between',
25
+ alignItems: 'center',
26
+ minHeight: 45
27
+ },
28
+ lineSectionCustomRender: {
29
+ padding: 0
30
+ },
31
+ lineText: {
32
+ fontFamily: theme.fontFamily2,
33
+ fontSize: layout_1.isTablet() ? 18 : 14,
34
+ color: theme.textColor1,
35
+ minWidth: 40
36
+ },
37
+ lineValue: {
38
+ textAlign: 'center'
39
+ },
40
+ lineTitle: {
41
+ textAlign: 'left',
42
+ flexShrink: 0
43
+ },
44
+ lineValueContainer: {
45
+ flexDirection: 'row',
46
+ flexGrow: 1,
47
+ flexShrink: 1,
48
+ alignItems: 'center',
49
+ justifyContent: 'flex-end'
50
+ },
51
+ lineValueIcon: {
52
+ width: 25,
53
+ textAlign: 'center'
54
+ }
55
+ });
56
+ return styles;
57
+ };
58
+ this.renderIcon = (icon, index) => {
59
+ const styles = this.getStyles();
60
+ const fa = (React.createElement(FontAwesome_1.default, { key: index, testID: icon.name, name: icon.name, color: icon.color, size: icon.size, style: styles.lineValueIcon }));
61
+ if (icon.onPress) {
62
+ return (React.createElement(react_native_1.TouchableOpacity, { key: index, onPress: icon.onPress }, fa));
63
+ }
64
+ return fa;
65
+ };
66
+ this.renderLine = (line, index) => {
67
+ const styles = this.getStyles();
68
+ const { lineTitleStyle, lineValueStyle } = this.props;
69
+ const { title, value, icons, render } = line;
70
+ const sectionStyle = render
71
+ ? styles.lineSectionCustomRender
72
+ : styles.lineSection;
73
+ const children = render ? (render()) : (React.createElement(React.Fragment, null,
74
+ React.createElement(react_native_1.Text, { style: [styles.lineText, styles.lineTitle, lineTitleStyle] }, title),
75
+ React.createElement(react_native_1.View, { style: styles.lineValueContainer },
76
+ icons && icons.map(this.renderIcon),
77
+ React.createElement(react_native_1.Text, { style: [styles.lineText, styles.lineValue, lineValueStyle] }, value))));
78
+ return (React.createElement(React.Fragment, { key: index },
79
+ React.createElement(Space_1.Space, { height: 3 }),
80
+ React.createElement(Card_1.Card, null,
81
+ React.createElement(Card_1.Card.Section, { style: sectionStyle }, children))));
82
+ };
83
+ }
84
+ render() {
85
+ const { title, lines } = this.props;
86
+ const styles = this.getStyles();
87
+ return (React.createElement(React.Fragment, null,
88
+ React.createElement(Card_1.Card, null,
89
+ React.createElement(Card_1.Card.Section, null,
90
+ React.createElement(react_native_1.Text, { style: styles.title }, title))),
91
+ lines.map(this.renderLine)));
92
+ }
93
+ }
94
+ exports.Details = Details;
@@ -0,0 +1,37 @@
1
+ import * as React from 'react';
2
+ export interface DetailsHeaderProperties {
3
+ text: string;
4
+ onLeftPress?: () => void;
5
+ onRightPress?: () => void;
6
+ }
7
+ export declare class DetailsHeader extends React.Component<DetailsHeaderProperties> {
8
+ getStyles: () => {
9
+ container: {
10
+ flexDirection: "row";
11
+ alignItems: "center";
12
+ justifyContent: "space-between";
13
+ };
14
+ text: {
15
+ fontFamily: string;
16
+ fontSize: number;
17
+ color: string;
18
+ width: string;
19
+ textAlign: "center";
20
+ };
21
+ button: {
22
+ height: number;
23
+ width: number;
24
+ alignItems: "center";
25
+ justifyContent: "center";
26
+ borderColor: string;
27
+ borderWidth: number;
28
+ borderRadius: number;
29
+ };
30
+ buttonPlaceholder: {
31
+ height: number;
32
+ width: number;
33
+ };
34
+ };
35
+ renderButton: (type: "left" | "right", onPress: (() => void) | undefined) => JSX.Element;
36
+ render(): JSX.Element;
37
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const react_native_1 = require("react-native");
5
+ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
6
+ const Card_1 = require("./Card");
7
+ const theme_1 = require("../modules/theme");
8
+ const layout_1 = require("../modules/layout");
9
+ class DetailsHeader extends React.Component {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.getStyles = () => {
13
+ const theme = theme_1.getTheme();
14
+ const styles = react_native_1.StyleSheet.create({
15
+ container: {
16
+ flexDirection: 'row',
17
+ alignItems: 'center',
18
+ justifyContent: 'space-between'
19
+ },
20
+ text: {
21
+ fontFamily: theme.fontFamily1,
22
+ fontSize: layout_1.isTablet() ? 22 : 18,
23
+ color: theme.textColor1,
24
+ width: '80%',
25
+ textAlign: 'center'
26
+ },
27
+ button: {
28
+ height: layout_1.isTablet() ? 28 : 24,
29
+ width: layout_1.isTablet() ? 28 : 24,
30
+ alignItems: 'center',
31
+ justifyContent: 'center',
32
+ borderColor: theme.borderColor1,
33
+ borderWidth: 1,
34
+ borderRadius: 24
35
+ },
36
+ buttonPlaceholder: {
37
+ height: layout_1.isTablet() ? 28 : 24,
38
+ width: layout_1.isTablet() ? 28 : 24
39
+ }
40
+ });
41
+ return styles;
42
+ };
43
+ this.renderButton = (type, onPress) => {
44
+ const styles = this.getStyles();
45
+ const theme = theme_1.getTheme();
46
+ if (onPress) {
47
+ return (React.createElement(react_native_1.TouchableOpacity, { style: styles.button, onPress: onPress },
48
+ React.createElement(FontAwesome_1.default, { name: type === 'left' ? 'angle-left' : 'angle-right', color: theme.textColor3, size: 14 })));
49
+ }
50
+ return React.createElement(react_native_1.View, { style: styles.buttonPlaceholder });
51
+ };
52
+ }
53
+ render() {
54
+ const { text, onLeftPress, onRightPress } = this.props;
55
+ const styles = this.getStyles();
56
+ return (React.createElement(Card_1.Card, null,
57
+ React.createElement(Card_1.Card.Section, { style: styles.container },
58
+ this.renderButton('left', onLeftPress),
59
+ React.createElement(react_native_1.Text, { style: styles.text }, text),
60
+ this.renderButton('right', onRightPress))));
61
+ }
62
+ }
63
+ exports.DetailsHeader = DetailsHeader;
@@ -0,0 +1,21 @@
1
+ import * as React from 'react';
2
+ import { ScaledSize } from 'react-native';
3
+ export interface DimensionsMonitorProperties {
4
+ children?: (dimensionsInfo: {
5
+ isDesktop: boolean;
6
+ }) => React.ReactNode;
7
+ onDimensionChange?: (isDesktop: boolean) => void;
8
+ }
9
+ export interface DimensionsMonitorState {
10
+ isDesktop: boolean;
11
+ }
12
+ export declare class DimensionsMonitor extends React.Component<DimensionsMonitorProperties, DimensionsMonitorState> {
13
+ constructor(props: DimensionsMonitorProperties);
14
+ componentDidMount(): void;
15
+ componentWillUnmount(): void;
16
+ handleDimensionsChange: ({ window }: {
17
+ window: ScaledSize;
18
+ }) => void;
19
+ isDesktop: (size: ScaledSize) => boolean;
20
+ render(): {} | null | undefined;
21
+ }
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const React = require("react");
4
+ const react_native_1 = require("react-native");
5
+ class DimensionsMonitor extends React.Component {
6
+ constructor(props) {
7
+ super(props);
8
+ this.handleDimensionsChange = ({ window }) => {
9
+ const isDesktop = this.isDesktop(window);
10
+ this.setState({ isDesktop });
11
+ if (this.props.onDimensionChange && isDesktop !== this.state.isDesktop) {
12
+ this.props.onDimensionChange(isDesktop);
13
+ }
14
+ };
15
+ this.isDesktop = (size) => {
16
+ return size.width >= 1024;
17
+ };
18
+ this.state = {
19
+ isDesktop: this.isDesktop(react_native_1.Dimensions.get('window'))
20
+ };
21
+ }
22
+ componentDidMount() {
23
+ react_native_1.Dimensions.addEventListener('change', this.handleDimensionsChange);
24
+ }
25
+ componentWillUnmount() {
26
+ react_native_1.Dimensions.removeEventListener('change', this.handleDimensionsChange);
27
+ }
28
+ render() {
29
+ if (!this.props.children) {
30
+ return null;
31
+ }
32
+ return this.props.children({ isDesktop: this.state.isDesktop });
33
+ }
34
+ }
35
+ exports.DimensionsMonitor = DimensionsMonitor;
@@ -0,0 +1,35 @@
1
+ import * as React from 'react';
2
+ import { IconProps } from 'react-native-vector-icons/Icon';
3
+ import { StyleProp, ViewStyle, TextStyle } from 'react-native';
4
+ export interface DropDownProperties {
5
+ label?: string;
6
+ items: Array<{
7
+ label: string;
8
+ value: any;
9
+ icon?: string;
10
+ nativeID?: string;
11
+ }>;
12
+ value: any | null;
13
+ onChange: (value: any) => void;
14
+ emptyMessage?: string;
15
+ disabled?: boolean;
16
+ style?: StyleProp<ViewStyle>;
17
+ labelStyle?: StyleProp<TextStyle>;
18
+ inputStyle?: StyleProp<TextStyle>;
19
+ iconComponent?: React.ComponentClass<IconProps>;
20
+ nativeID?: string;
21
+ icon?: string | undefined;
22
+ }
23
+ export interface DropDownState {
24
+ modalOpen: boolean;
25
+ }
26
+ export declare class DropDown extends React.Component<DropDownProperties, DropDownState> {
27
+ static defaultProps: {
28
+ emptyMessage: string;
29
+ };
30
+ state: DropDownState;
31
+ handleItemPress: (value: any) => void;
32
+ renderClosedDropDown: (item: any, inputStyle: any) => JSX.Element | null;
33
+ getStyles: () => any;
34
+ render(): JSX.Element;
35
+ }