secullum-react-native-ui 4.15.2-beta.1 → 4.15.2-beta.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/Header.d.ts +1 -0
- package/lib/components/Header.js +2 -1
- package/lib/components/KeyboardAvoidingView.js +16 -5
- package/lib/components/MenuMobile.d.ts +2 -0
- package/lib/components/MenuMobile.js +11 -3
- package/lib/components/Modal.d.ts +7 -0
- package/lib/components/Modal.js +17 -2
- package/lib/components/RangeDatePicker.js +2 -2
- package/package.json +1 -1
package/lib/components/Header.js
CHANGED
|
@@ -24,7 +24,8 @@ class Header extends React.Component {
|
|
|
24
24
|
color: theme.textColor4,
|
|
25
25
|
fontFamily: theme.fontFamily1,
|
|
26
26
|
fontSize: (0, layout_1.isTablet)() ? 22 : 18,
|
|
27
|
-
marginHorizontal:
|
|
27
|
+
marginHorizontal: 10,
|
|
28
|
+
flexShrink: 1
|
|
28
29
|
},
|
|
29
30
|
button: {
|
|
30
31
|
padding: (0, layout_1.isTablet)() ? 14 : 10
|
|
@@ -70,15 +70,26 @@ class KeyboardAvoidingView extends React.Component {
|
|
|
70
70
|
this.keyboardDidHideSubscription.remove();
|
|
71
71
|
}
|
|
72
72
|
render() {
|
|
73
|
-
const { refreshControl, scrollEnabled, onScroll, children, keyBoardShow } = this.props;
|
|
73
|
+
const { refreshControl, scrollEnabled, onScroll, children, keyBoardShow, extraWindowHeight } = this.props;
|
|
74
|
+
const { keyboardHeight } = this.state;
|
|
74
75
|
// Android devices with notch will report less `availableHeight` than it should
|
|
75
76
|
// That's because of this: https://github.com/facebook/react-native/issues/23693
|
|
76
77
|
// If I change it to 'screen', Android devices with virtual buttons will report more than it should
|
|
77
|
-
const availableHeight = react_native_1.Dimensions.get('window').height -
|
|
78
|
-
this.state.keyboardHeight -
|
|
79
|
-
this.props.extraWindowHeight;
|
|
78
|
+
const availableHeight = react_native_1.Dimensions.get('window').height - keyboardHeight - extraWindowHeight;
|
|
80
79
|
return (React.createElement(react_native_1.View, { style: [{ height: availableHeight }, !keyBoardShow && { flex: 1 }] },
|
|
81
|
-
React.createElement(react_native_1.ScrollView
|
|
80
|
+
React.createElement(react_native_1.ScrollView
|
|
81
|
+
// On Android 15 (API 35) devices, when the keyboard appears,
|
|
82
|
+
// the ScrollView does not resize correctly and may hide focused input fields.
|
|
83
|
+
// Related issue on GitLab: 11635
|
|
84
|
+
, {
|
|
85
|
+
// On Android 15 (API 35) devices, when the keyboard appears,
|
|
86
|
+
// the ScrollView does not resize correctly and may hide focused input fields.
|
|
87
|
+
// Related issue on GitLab: 11635
|
|
88
|
+
contentContainerStyle: react_native_1.Platform.OS === 'android' &&
|
|
89
|
+
react_native_1.Platform.Version === 35 &&
|
|
90
|
+
keyboardHeight > 0
|
|
91
|
+
? { paddingBottom: keyboardHeight }
|
|
92
|
+
: undefined, ref: this.scrollViewRef,
|
|
82
93
|
// @ts-ignore: O react-native não tem auto, mas o react-native-web aceita
|
|
83
94
|
refreshControl: refreshControl, scrollEnabled: scrollEnabled, onScroll: (e) => {
|
|
84
95
|
if (onScroll) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { NativeEventSubscription } from 'react-native';
|
|
2
3
|
import DrawerLayout from 'react-native-drawer-layout';
|
|
3
4
|
import { MenuProperties } from './Menu';
|
|
4
5
|
export declare type MenuMobileProperties = MenuProperties & {
|
|
@@ -12,6 +13,7 @@ export interface MenuMobileState {
|
|
|
12
13
|
}
|
|
13
14
|
export declare class MenuMobile extends React.Component<MenuMobileProperties, MenuMobileState> {
|
|
14
15
|
state: MenuMobileState;
|
|
16
|
+
backButtonHandlerSubscription: NativeEventSubscription | null;
|
|
15
17
|
drawer: DrawerLayout | null;
|
|
16
18
|
componentDidMount(): void;
|
|
17
19
|
componentWillUnmount(): void;
|
|
@@ -13,6 +13,7 @@ class MenuMobile extends React.Component {
|
|
|
13
13
|
this.state = {
|
|
14
14
|
opened: false
|
|
15
15
|
};
|
|
16
|
+
this.backButtonHandlerSubscription = null;
|
|
16
17
|
this.drawer = null;
|
|
17
18
|
this.handleBackButton = () => {
|
|
18
19
|
if (this.state.opened) {
|
|
@@ -73,14 +74,21 @@ class MenuMobile extends React.Component {
|
|
|
73
74
|
};
|
|
74
75
|
}
|
|
75
76
|
componentDidMount() {
|
|
76
|
-
react_native_1.BackHandler.addEventListener('hardwareBackPress', this.handleBackButton);
|
|
77
|
+
this.backButtonHandlerSubscription = react_native_1.BackHandler.addEventListener('hardwareBackPress', this.handleBackButton);
|
|
77
78
|
}
|
|
78
79
|
componentWillUnmount() {
|
|
79
|
-
|
|
80
|
+
if (this.backButtonHandlerSubscription) {
|
|
81
|
+
this.backButtonHandlerSubscription.remove();
|
|
82
|
+
}
|
|
80
83
|
}
|
|
81
84
|
render() {
|
|
82
85
|
const theme = (0, theme_1.getTheme)();
|
|
83
|
-
return (React.createElement(react_native_drawer_layout_1.default, { ref: drawer => (this.drawer = drawer), drawerLockMode: this.props.drawerLockMode, drawerBackgroundColor: theme.backgroundColor1, drawerWidth: (0, layout_1.isTablet)() ? 450 : 300, drawerPosition: react_native_drawer_layout_1.default.positions.Left, renderNavigationView: this.renderNavigationView, onDrawerOpen: () => this.setState({ opened: true }),
|
|
86
|
+
return (React.createElement(react_native_drawer_layout_1.default, { ref: drawer => (this.drawer = drawer), drawerLockMode: this.props.drawerLockMode, drawerBackgroundColor: theme.backgroundColor1, drawerWidth: (0, layout_1.isTablet)() ? 450 : 300, drawerPosition: react_native_drawer_layout_1.default.positions.Left, renderNavigationView: this.renderNavigationView, onDrawerOpen: () => this.setState({ opened: true }),
|
|
87
|
+
// When closing the app, we encountered the error 'useInsertionEffect must not schedule updates',
|
|
88
|
+
// because we were trying to update the state during the component render cycle. To avoid this,
|
|
89
|
+
// a setTimeout was introduced with a small delay (enough time to complete the render) before executing other functions.
|
|
90
|
+
// Related issue on GitLab: 11635
|
|
91
|
+
onDrawerClose: () => setTimeout(() => this.setState({ opened: false }), 1) }, this.props.children));
|
|
84
92
|
}
|
|
85
93
|
}
|
|
86
94
|
exports.MenuMobile = MenuMobile;
|
|
@@ -6,6 +6,13 @@ export interface ModalProperties {
|
|
|
6
6
|
overlayStyle?: StyleProp<ViewStyle>;
|
|
7
7
|
onRequestClose?: () => void;
|
|
8
8
|
}
|
|
9
|
+
interface ModalState {
|
|
10
|
+
isMounted: boolean;
|
|
11
|
+
}
|
|
9
12
|
export declare class Modal extends React.Component<ModalProperties> {
|
|
13
|
+
state: ModalState;
|
|
14
|
+
componentDidUpdate(prevProps: ModalProperties): void;
|
|
15
|
+
handleShow: () => void;
|
|
10
16
|
render(): JSX.Element;
|
|
11
17
|
}
|
|
18
|
+
export {};
|
package/lib/components/Modal.js
CHANGED
|
@@ -4,11 +4,26 @@ exports.Modal = void 0;
|
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const react_native_1 = require("react-native");
|
|
6
6
|
class Modal extends React.Component {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments);
|
|
9
|
+
this.state = {
|
|
10
|
+
isMounted: false
|
|
11
|
+
};
|
|
12
|
+
this.handleShow = () => {
|
|
13
|
+
this.setState({ isMounted: true });
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
componentDidUpdate(prevProps) {
|
|
17
|
+
if (prevProps.visible && !this.props.visible) {
|
|
18
|
+
this.setState({ isMounted: false });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
7
21
|
render() {
|
|
8
22
|
const { children, visible, overlayStyle, onRequestClose } = this.props;
|
|
9
|
-
|
|
23
|
+
const { isMounted } = this.state;
|
|
24
|
+
return (React.createElement(react_native_1.Modal, { animationType: "fade", transparent: true, visible: visible, supportedOrientations: ['landscape', 'portrait'], onRequestClose: onRequestClose, onShow: this.handleShow },
|
|
10
25
|
React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: onRequestClose },
|
|
11
|
-
React.createElement(react_native_1.View, { style: [styles.overlay, overlayStyle] }, children))));
|
|
26
|
+
React.createElement(react_native_1.View, { style: [styles.overlay, overlayStyle] }, isMounted ? children : React.createElement(react_native_1.View, null)))));
|
|
12
27
|
}
|
|
13
28
|
}
|
|
14
29
|
exports.Modal = Modal;
|
|
@@ -111,9 +111,9 @@ class RangeDatePicker extends React.Component {
|
|
|
111
111
|
const styles = this.getStyles();
|
|
112
112
|
return (React.createElement(react_native_1.TouchableWithoutFeedback, { onPress: this.handleDatePickerPress },
|
|
113
113
|
React.createElement(react_native_1.View, { nativeID: nativeID, testID: (0, test_1.getTestID)(nativeID), style: [styles.container, style] },
|
|
114
|
-
React.createElement(react_native_1.View,
|
|
114
|
+
React.createElement(react_native_1.View, { style: { flex: 1 } },
|
|
115
115
|
React.createElement(react_native_1.Text, { style: styles.label }, label),
|
|
116
|
-
React.createElement(react_native_1.Text, { style: styles.value }, displayText)),
|
|
116
|
+
React.createElement(react_native_1.Text, { numberOfLines: 1, style: styles.value }, displayText)),
|
|
117
117
|
React.createElement(FontAwesome_1.default, { name: "calendar", style: styles.icon }),
|
|
118
118
|
react_native_1.Platform.OS !== 'web' &&
|
|
119
119
|
(showStartDateModal ? (React.createElement(react_native_modal_datetime_picker_1.default, { date: startDate, isVisible: true, onConfirm: this.handleStartDateConfirm, onCancel: this.handleStartDateCancel, isDarkModeEnabled: isDarkModeEnabled,
|