secullum-react-native-ui 4.3.5 → 4.3.8-beta.0
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.
|
@@ -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;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { IconProps } from 'react-native-vector-icons/Icon';
|
|
3
3
|
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
4
4
|
export interface DropDownProperties {
|
|
5
|
-
label
|
|
5
|
+
label?: string;
|
|
6
6
|
items: Array<{
|
|
7
7
|
label: string;
|
|
8
8
|
value: any;
|
|
@@ -18,6 +18,7 @@ export interface DropDownProperties {
|
|
|
18
18
|
inputStyle?: StyleProp<TextStyle>;
|
|
19
19
|
iconComponent?: React.ComponentClass<IconProps>;
|
|
20
20
|
nativeID?: string;
|
|
21
|
+
icon?: string | undefined;
|
|
21
22
|
}
|
|
22
23
|
export interface DropDownState {
|
|
23
24
|
modalOpen: boolean;
|
|
@@ -131,14 +131,11 @@ class DropDown extends React.Component {
|
|
|
131
131
|
};
|
|
132
132
|
this.getStyles = () => {
|
|
133
133
|
const theme = theme_1.getTheme();
|
|
134
|
+
const { icon } = this.props;
|
|
134
135
|
const styles = react_native_1.StyleSheet.create({
|
|
135
|
-
container: {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
borderWidth: 1,
|
|
139
|
-
borderColor: theme.borderColor1,
|
|
140
|
-
borderRadius: 3
|
|
141
|
-
},
|
|
136
|
+
container: Object.assign({ paddingHorizontal: 16, paddingVertical: 8, borderWidth: 1, borderColor: theme.borderColor1, borderRadius: 3 }, (icon ? { flexDirection: 'row' } : {}), (icon && react_native_1.Platform.OS === 'web'
|
|
137
|
+
? { minHeight: 40 }
|
|
138
|
+
: { minHeight: 48 })),
|
|
142
139
|
label: {
|
|
143
140
|
color: theme.textColor2,
|
|
144
141
|
fontFamily: theme.fontFamily3,
|
|
@@ -148,7 +145,7 @@ class DropDown extends React.Component {
|
|
|
148
145
|
text: {
|
|
149
146
|
lineHeight: 22,
|
|
150
147
|
minHeight: 22,
|
|
151
|
-
|
|
148
|
+
textAlignVertical: 'center',
|
|
152
149
|
color: theme.textColor1,
|
|
153
150
|
fontFamily: theme.fontFamily1,
|
|
154
151
|
fontSize: 16
|
|
@@ -215,6 +212,14 @@ class DropDown extends React.Component {
|
|
|
215
212
|
paddingHorizontal: 16,
|
|
216
213
|
paddingVertical: 8,
|
|
217
214
|
fontSize: 26
|
|
215
|
+
},
|
|
216
|
+
icone: {
|
|
217
|
+
color: theme.textColor2,
|
|
218
|
+
fontSize: layout_1.isTablet() ? 21 : 19,
|
|
219
|
+
marginRight: 10,
|
|
220
|
+
minWidth: 25,
|
|
221
|
+
textAlignVertical: 'center',
|
|
222
|
+
flex: 0
|
|
218
223
|
}
|
|
219
224
|
});
|
|
220
225
|
return styles;
|
|
@@ -222,13 +227,13 @@ class DropDown extends React.Component {
|
|
|
222
227
|
}
|
|
223
228
|
render() {
|
|
224
229
|
const { modalOpen } = this.state;
|
|
225
|
-
const { label, items, value, emptyMessage, style, disabled, labelStyle, inputStyle, iconComponent, nativeID } = this.props;
|
|
230
|
+
const { label, items, value, emptyMessage, style, disabled, labelStyle, inputStyle, iconComponent, nativeID, icon } = this.props;
|
|
226
231
|
const selectedItem = items.find(x => x.value === value);
|
|
227
232
|
const styles = this.getStyles();
|
|
228
233
|
const theme = theme_1.getTheme();
|
|
229
234
|
return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: () => this.setState({ modalOpen: true }), disabled: disabled },
|
|
230
235
|
React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style, disabled ? styles.readonly : null] },
|
|
231
|
-
React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label),
|
|
236
|
+
icon ? (React.createElement(FontAwesome_1.default, { name: icon, style: styles.icone })) : (React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label)),
|
|
232
237
|
this.renderClosedDropDown(selectedItem, inputStyle),
|
|
233
238
|
React.createElement(Modal_1.Modal, { visible: modalOpen, onRequestClose: () => this.setState({ modalOpen: false }), overlayStyle: styles.modalOverlay },
|
|
234
239
|
React.createElement(react_native_1.TouchableWithoutFeedback, null,
|
package/lib/components/Modal.js
CHANGED
|
@@ -6,7 +6,7 @@ const react_native_1 = require("react-native");
|
|
|
6
6
|
class Modal extends React.Component {
|
|
7
7
|
render() {
|
|
8
8
|
const { children, visible, overlayStyle, onRequestClose } = this.props;
|
|
9
|
-
return (React.createElement(react_native_web_modal_1.default, { animationType: "fade", transparent: true, visible: visible, onRequestClose: onRequestClose },
|
|
9
|
+
return (React.createElement(react_native_web_modal_1.default, { animationType: "fade", transparent: true, visible: visible, supportedOrientations: ['landscape', 'portrait'], onRequestClose: onRequestClose },
|
|
10
10
|
React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: onRequestClose },
|
|
11
11
|
React.createElement(react_native_1.View, { style: [styles.overlay, overlayStyle] }, children))));
|
|
12
12
|
}
|
|
@@ -7,6 +7,7 @@ const FontAwesome_1 = require("react-native-vector-icons/FontAwesome");
|
|
|
7
7
|
const format_1 = require("../modules/format");
|
|
8
8
|
const layout_1 = require("../modules/layout");
|
|
9
9
|
const theme_1 = require("../modules/theme");
|
|
10
|
+
const Delay_1 = require("./Delay");
|
|
10
11
|
const react_native_1 = require("react-native");
|
|
11
12
|
class RangeDatePicker extends React.Component {
|
|
12
13
|
constructor() {
|
|
@@ -113,13 +114,13 @@ class RangeDatePicker extends React.Component {
|
|
|
113
114
|
React.createElement(react_native_1.Text, { style: styles.label }, label),
|
|
114
115
|
React.createElement(react_native_1.Text, { style: styles.value }, displayText)),
|
|
115
116
|
React.createElement(FontAwesome_1.default, { name: "calendar", style: styles.icon }),
|
|
116
|
-
react_native_1.Platform.OS !== 'web' &&
|
|
117
|
-
React.createElement(react_native_modal_datetime_picker_1.default, { date: startDate, isVisible:
|
|
117
|
+
react_native_1.Platform.OS !== 'web' &&
|
|
118
|
+
(showStartDateModal ? (React.createElement(react_native_modal_datetime_picker_1.default, { date: startDate, isVisible: true, onConfirm: this.handleStartDateConfirm, onCancel: this.handleStartDateCancel, isDarkModeEnabled: isDarkModeEnabled,
|
|
118
119
|
//@ts-ignore
|
|
119
|
-
display: react_native_1.Platform.OS == 'ios' ? 'inline' : 'default' }),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
120
|
+
display: react_native_1.Platform.OS == 'ios' ? 'inline' : 'default' })) : showEndDateModal ? (React.createElement(Delay_1.Delay, { wait: 5 },
|
|
121
|
+
React.createElement(react_native_modal_datetime_picker_1.default, { date: endDate, isVisible: true, onConfirm: this.handleEndDateConfirm, onCancel: this.handleEndDateCancel, isDarkModeEnabled: isDarkModeEnabled,
|
|
122
|
+
//@ts-ignore
|
|
123
|
+
display: react_native_1.Platform.OS == 'ios' ? 'inline' : 'default' }))) : null))));
|
|
123
124
|
}
|
|
124
125
|
}
|
|
125
126
|
exports.RangeDatePicker = RangeDatePicker;
|