secullum-react-native-ui 4.3.6 → 4.3.8-beta.1
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.
|
@@ -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,14 @@ 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
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
},
|
|
136
|
+
container: Object.assign({ paddingHorizontal: 16, paddingVertical: 8, borderWidth: 1, borderColor: theme.borderColor1, borderRadius: 3 }, (icon
|
|
137
|
+
? {
|
|
138
|
+
flexDirection: 'row',
|
|
139
|
+
minHeight: react_native_1.Platform.OS === 'web' || react_native_1.Platform.OS === 'ios' ? 40 : 46
|
|
140
|
+
}
|
|
141
|
+
: {})),
|
|
142
142
|
label: {
|
|
143
143
|
color: theme.textColor2,
|
|
144
144
|
fontFamily: theme.fontFamily3,
|
|
@@ -148,7 +148,7 @@ class DropDown extends React.Component {
|
|
|
148
148
|
text: {
|
|
149
149
|
lineHeight: 22,
|
|
150
150
|
minHeight: 22,
|
|
151
|
-
|
|
151
|
+
textAlignVertical: 'center',
|
|
152
152
|
color: theme.textColor1,
|
|
153
153
|
fontFamily: theme.fontFamily1,
|
|
154
154
|
fontSize: 16
|
|
@@ -215,6 +215,14 @@ class DropDown extends React.Component {
|
|
|
215
215
|
paddingHorizontal: 16,
|
|
216
216
|
paddingVertical: 8,
|
|
217
217
|
fontSize: 26
|
|
218
|
+
},
|
|
219
|
+
iconOnLine: {
|
|
220
|
+
color: theme.textColor2,
|
|
221
|
+
fontSize: layout_1.isTablet() ? 21 : 19,
|
|
222
|
+
marginRight: 10,
|
|
223
|
+
minWidth: 25,
|
|
224
|
+
textAlignVertical: 'center',
|
|
225
|
+
flex: 0
|
|
218
226
|
}
|
|
219
227
|
});
|
|
220
228
|
return styles;
|
|
@@ -222,13 +230,13 @@ class DropDown extends React.Component {
|
|
|
222
230
|
}
|
|
223
231
|
render() {
|
|
224
232
|
const { modalOpen } = this.state;
|
|
225
|
-
const { label, items, value, emptyMessage, style, disabled, labelStyle, inputStyle, iconComponent, nativeID } = this.props;
|
|
233
|
+
const { label, items, value, emptyMessage, style, disabled, labelStyle, inputStyle, iconComponent, nativeID, icon } = this.props;
|
|
226
234
|
const selectedItem = items.find(x => x.value === value);
|
|
227
235
|
const styles = this.getStyles();
|
|
228
236
|
const theme = theme_1.getTheme();
|
|
229
237
|
return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: () => this.setState({ modalOpen: true }), disabled: disabled },
|
|
230
238
|
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),
|
|
239
|
+
icon ? (React.createElement(FontAwesome_1.default, { name: icon, style: styles.iconOnLine })) : (React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label)),
|
|
232
240
|
this.renderClosedDropDown(selectedItem, inputStyle),
|
|
233
241
|
React.createElement(Modal_1.Modal, { visible: modalOpen, onRequestClose: () => this.setState({ modalOpen: false }), overlayStyle: styles.modalOverlay },
|
|
234
242
|
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
|
}
|
|
@@ -58,7 +58,7 @@ export declare class TextBox extends React.Component<TextBoxProperties> {
|
|
|
58
58
|
icon: {
|
|
59
59
|
color: string;
|
|
60
60
|
fontSize: number;
|
|
61
|
-
|
|
61
|
+
marginRight: number;
|
|
62
62
|
alignSelf: "center";
|
|
63
63
|
minHeight: number;
|
|
64
64
|
};
|
|
@@ -69,6 +69,7 @@ export declare class TextBox extends React.Component<TextBoxProperties> {
|
|
|
69
69
|
lineHeight: number;
|
|
70
70
|
};
|
|
71
71
|
input: {
|
|
72
|
+
flex: number;
|
|
72
73
|
outline: string;
|
|
73
74
|
color: string;
|
|
74
75
|
fontFamily: string;
|
|
@@ -78,6 +79,7 @@ export declare class TextBox extends React.Component<TextBoxProperties> {
|
|
|
78
79
|
padding: number;
|
|
79
80
|
margin: number;
|
|
80
81
|
} | {
|
|
82
|
+
flex: number;
|
|
81
83
|
color: string;
|
|
82
84
|
fontFamily: string;
|
|
83
85
|
fontWeight: "normal";
|
|
@@ -17,7 +17,7 @@ class TextBox extends React.Component {
|
|
|
17
17
|
icon: {
|
|
18
18
|
color: theme.textColor2,
|
|
19
19
|
fontSize: layout_1.isTablet() ? 21 : 19,
|
|
20
|
-
|
|
20
|
+
marginRight: 10,
|
|
21
21
|
alignSelf: 'center',
|
|
22
22
|
minHeight: 22
|
|
23
23
|
},
|
|
@@ -27,7 +27,7 @@ class TextBox extends React.Component {
|
|
|
27
27
|
fontSize: layout_1.isTablet() ? 15 : 12,
|
|
28
28
|
lineHeight: 16
|
|
29
29
|
},
|
|
30
|
-
input: Object.assign({ color: theme.textColor1, fontFamily: this.props.value ? theme.fontFamily1 : theme.fontFamily3, fontWeight: 'normal', fontSize: 16, minHeight: 22, padding: 0, margin: 0 }, (react_native_1.Platform.OS === 'web' ? { outline: 'none' } : {})),
|
|
30
|
+
input: Object.assign({ color: theme.textColor1, fontFamily: this.props.value ? theme.fontFamily1 : theme.fontFamily3, fontWeight: 'normal', fontSize: 16, minHeight: 22, padding: 0, margin: 0 }, (react_native_1.Platform.OS === 'web' ? { outline: 'none' } : {}), { flex: 1 }),
|
|
31
31
|
readonly: {
|
|
32
32
|
backgroundColor: theme.disabledColor
|
|
33
33
|
}
|