secullum-react-native-ui 4.3.9 → 4.3.11
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.
- package/lib/components/Card.d.ts +4 -0
- package/lib/components/Card.js +8 -0
- package/lib/components/DatePicker.d.ts +4 -0
- package/lib/components/DatePicker.js +7 -4
- package/lib/components/KeyboardAvoidingView.d.ts +1 -0
- package/lib/components/KeyboardAvoidingView.js +6 -5
- package/lib/components/Loading.js +4 -4
- package/lib/components/TextBox.d.ts +1 -0
- package/lib/components/TextBox.js +2 -4
- package/package.json +1 -1
package/lib/components/Card.d.ts
CHANGED
|
@@ -37,6 +37,9 @@ export declare class CardFooter extends React.Component<ViewProperties> {
|
|
|
37
37
|
export declare class CardSection extends React.Component<ViewProperties> {
|
|
38
38
|
render(): JSX.Element;
|
|
39
39
|
}
|
|
40
|
+
export declare class CardModal extends React.Component<ViewProperties> {
|
|
41
|
+
render(): JSX.Element;
|
|
42
|
+
}
|
|
40
43
|
export interface CardProperties extends ViewProperties {
|
|
41
44
|
children: React.ReactNode;
|
|
42
45
|
style?: StyleProp<ViewStyle>;
|
|
@@ -45,6 +48,7 @@ export declare class Card extends React.Component<CardProperties> {
|
|
|
45
48
|
static Header: typeof CardHeader;
|
|
46
49
|
static Section: typeof CardSection;
|
|
47
50
|
static Footer: typeof CardFooter;
|
|
51
|
+
static Modal: typeof CardModal;
|
|
48
52
|
getStyles: () => {
|
|
49
53
|
container: {
|
|
50
54
|
borderRadius: number;
|
package/lib/components/Card.js
CHANGED
|
@@ -67,6 +67,13 @@ class CardSection extends React.Component {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
exports.CardSection = CardSection;
|
|
70
|
+
class CardModal extends React.Component {
|
|
71
|
+
render() {
|
|
72
|
+
const _a = this.props, { children, style } = _a, otherProps = __rest(_a, ["children", "style"]);
|
|
73
|
+
return (React.createElement(react_native_1.TouchableOpacity, Object.assign({ activeOpacity: 1, style: [{ padding: 16 }, style] }, otherProps), children));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.CardModal = CardModal;
|
|
70
77
|
class Card extends React.Component {
|
|
71
78
|
constructor() {
|
|
72
79
|
super(...arguments);
|
|
@@ -104,6 +111,7 @@ class Card extends React.Component {
|
|
|
104
111
|
Card.Header = CardHeader;
|
|
105
112
|
Card.Section = CardSection;
|
|
106
113
|
Card.Footer = CardFooter;
|
|
114
|
+
Card.Modal = CardModal;
|
|
107
115
|
exports.Card = Card;
|
|
108
116
|
const cardSectionStyles = react_native_1.StyleSheet.create({
|
|
109
117
|
container: {
|
|
@@ -8,6 +8,7 @@ export interface DatePickerProperties {
|
|
|
8
8
|
onCancel?: () => void;
|
|
9
9
|
style?: StyleProp<ViewStyle>;
|
|
10
10
|
nativeID?: string;
|
|
11
|
+
disabled?: boolean;
|
|
11
12
|
}
|
|
12
13
|
export interface DatePickerState {
|
|
13
14
|
showModal: boolean;
|
|
@@ -58,6 +59,9 @@ export declare class DatePicker extends React.Component<DatePickerProperties, Da
|
|
|
58
59
|
borderWidth: number;
|
|
59
60
|
marginLeft: string;
|
|
60
61
|
};
|
|
62
|
+
readonly: {
|
|
63
|
+
backgroundColor: string;
|
|
64
|
+
};
|
|
61
65
|
};
|
|
62
66
|
render(): JSX.Element;
|
|
63
67
|
}
|
|
@@ -67,6 +67,9 @@ class DatePicker extends React.Component {
|
|
|
67
67
|
clearIcon: {
|
|
68
68
|
borderWidth: 0,
|
|
69
69
|
marginLeft: 'auto'
|
|
70
|
+
},
|
|
71
|
+
readonly: {
|
|
72
|
+
backgroundColor: theme.disabledColor
|
|
70
73
|
}
|
|
71
74
|
});
|
|
72
75
|
return styles;
|
|
@@ -81,16 +84,16 @@ class DatePicker extends React.Component {
|
|
|
81
84
|
this.appearanceSubscription.remove();
|
|
82
85
|
}
|
|
83
86
|
render() {
|
|
84
|
-
const { label, value, clearable, style, nativeID } = this.props;
|
|
87
|
+
const { label, value, clearable, style, nativeID, disabled } = this.props;
|
|
85
88
|
const { showModal, isDarkModeEnabled } = this.state;
|
|
86
89
|
const styles = this.getStyles();
|
|
87
90
|
const theme = theme_1.getTheme();
|
|
88
|
-
return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: this.handlePress },
|
|
89
|
-
React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style] },
|
|
91
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { disabled: disabled, onPress: this.handlePress },
|
|
92
|
+
React.createElement(react_native_1.View, { nativeID: nativeID, style: [styles.container, style, disabled ? styles.readonly : null] },
|
|
90
93
|
React.createElement(react_native_1.View, null,
|
|
91
94
|
React.createElement(react_native_1.Text, { style: styles.label }, label),
|
|
92
95
|
React.createElement(react_native_1.Text, { style: styles.value }, value != undefined ? format_1.formatDate(value, 'dddd, DD/MM/YYYY') : '')),
|
|
93
|
-
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 }),
|
|
96
|
+
!disabled && (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 })),
|
|
94
97
|
react_native_1.Platform.OS !== 'web' && (React.createElement(react_native_modal_datetime_picker_1.default, { date: value, isVisible: showModal, onConfirm: this.handleConfirm, onCancel: this.handleCancel, isDarkModeEnabled: isDarkModeEnabled,
|
|
95
98
|
//@ts-ignore
|
|
96
99
|
display: react_native_1.Platform.OS == 'ios' ? 'inline' : 'default' })))));
|
|
@@ -69,18 +69,19 @@ class KeyboardAvoidingView extends React.Component {
|
|
|
69
69
|
this.keyboardDidHideSubscription.remove();
|
|
70
70
|
}
|
|
71
71
|
render() {
|
|
72
|
+
const { refreshControl, scrollEnabled, onScroll, children, keyBoardShow } = this.props;
|
|
72
73
|
// Android devices with notch will report less `availableHeight` than it should
|
|
73
74
|
// That's because of this: https://github.com/facebook/react-native/issues/23693
|
|
74
75
|
// If I change it to 'screen', Android devices with virtual buttons will report more than it should
|
|
75
76
|
const availableHeight = react_native_1.Dimensions.get('window').height -
|
|
76
77
|
this.state.keyboardHeight -
|
|
77
78
|
this.props.extraWindowHeight;
|
|
78
|
-
return (React.createElement(react_native_1.View, { style: { height: availableHeight } },
|
|
79
|
-
React.createElement(react_native_1.ScrollView, { ref: this.scrollViewRef, refreshControl:
|
|
80
|
-
if (
|
|
81
|
-
|
|
79
|
+
return (React.createElement(react_native_1.View, { style: [{ height: availableHeight }, !keyBoardShow && { flex: 1 }] },
|
|
80
|
+
React.createElement(react_native_1.ScrollView, { ref: this.scrollViewRef, refreshControl: refreshControl, scrollEnabled: scrollEnabled, onScroll: (e) => {
|
|
81
|
+
if (onScroll) {
|
|
82
|
+
onScroll(e.nativeEvent);
|
|
82
83
|
}
|
|
83
|
-
} },
|
|
84
|
+
}, scrollEventThrottle: 16 }, children({ availableHeight }))));
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
KeyboardAvoidingView.defaultProps = {
|
|
@@ -14,8 +14,8 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
14
14
|
backgroundView: {
|
|
15
15
|
zIndex: 9998,
|
|
16
16
|
position: 'absolute',
|
|
17
|
-
width: '
|
|
18
|
-
height: '
|
|
17
|
+
width: react_native_1.Dimensions.get('screen').width,
|
|
18
|
+
height: react_native_1.Dimensions.get('screen').height,
|
|
19
19
|
opacity: 0.6,
|
|
20
20
|
backgroundColor: '#ccc',
|
|
21
21
|
top: 0,
|
|
@@ -26,8 +26,8 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
26
26
|
indicator: {
|
|
27
27
|
zIndex: 9999,
|
|
28
28
|
position: 'absolute',
|
|
29
|
-
width: '
|
|
30
|
-
height: '
|
|
29
|
+
width: react_native_1.Dimensions.get('screen').width,
|
|
30
|
+
height: react_native_1.Dimensions.get('screen').height,
|
|
31
31
|
justifyContent: 'space-around',
|
|
32
32
|
top: 0,
|
|
33
33
|
bottom: 0,
|
|
@@ -15,6 +15,7 @@ export interface TextBoxProperties {
|
|
|
15
15
|
renderInput?: (props: TextBoxInputProps) => JSX.Element;
|
|
16
16
|
onSubmitEditing?: () => void;
|
|
17
17
|
inputRef?: (value: TextInput) => void;
|
|
18
|
+
onPress?: () => void;
|
|
18
19
|
secureTextEntry?: boolean;
|
|
19
20
|
multiline?: boolean;
|
|
20
21
|
keyboardType?: KeyboardType;
|
|
@@ -42,7 +42,7 @@ class TextBox extends React.Component {
|
|
|
42
42
|
this.renderInput = (props) => React.createElement(react_native_1.TextInput, Object.assign({}, props));
|
|
43
43
|
}
|
|
44
44
|
render() {
|
|
45
|
-
const { label, style, labelStyle, editable, inputRef, renderInput, icon } = this.props;
|
|
45
|
+
const { label, style, labelStyle, editable, inputRef, renderInput, icon, onPress } = this.props;
|
|
46
46
|
const styles = this.getStyles();
|
|
47
47
|
const incomingProps = {
|
|
48
48
|
nativeID: this.props.nativeID,
|
|
@@ -85,9 +85,7 @@ class TextBox extends React.Component {
|
|
|
85
85
|
this.props.onKeyPress(react_native_1.Platform.OS === 'web' ? event : event.nativeEvent);
|
|
86
86
|
}
|
|
87
87
|
};
|
|
88
|
-
return (React.createElement(react_native_1.TouchableWithoutFeedback, { accessible: false, onPress: () =>
|
|
89
|
-
this.focus();
|
|
90
|
-
} },
|
|
88
|
+
return (React.createElement(react_native_1.TouchableWithoutFeedback, { accessible: false, onPress: () => (onPress ? onPress() : this.focus()) },
|
|
91
89
|
React.createElement(react_native_1.View, { style: [styles.container, style, editable ? null : styles.readonly] },
|
|
92
90
|
icon ? (React.createElement(FontAwesome_1.default, { name: icon, style: styles.icon })) : (React.createElement(react_native_1.Text, { style: [styles.label, labelStyle] }, label)),
|
|
93
91
|
renderInput
|