react-crud-mobile 1.0.511 → 1.0.513
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/dist/elements/UI.d.ts +2 -0
- package/dist/elements/core/SafeView.d.ts +9 -0
- package/dist/react-crud-mobile.cjs.development.js +40 -29
- package/dist/react-crud-mobile.cjs.development.js.map +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
- package/dist/react-crud-mobile.esm.js +41 -30
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/elements/UI.tsx +2 -0
- package/src/elements/core/SafeView.tsx +45 -0
- package/src/elements/core/UIButton.tsx +1 -1
- package/src/elements/core/UIView.tsx +12 -42
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Keyboard,
|
|
3
|
+
KeyboardAvoidingView,
|
|
4
|
+
Platform,
|
|
5
|
+
StyleProp,
|
|
6
|
+
ViewStyle,
|
|
7
|
+
} from 'react-native';
|
|
8
|
+
import {
|
|
9
|
+
SafeAreaProvider,
|
|
10
|
+
SafeAreaView as SafeAreaContextView,
|
|
11
|
+
} from 'react-native-safe-area-context';
|
|
12
|
+
|
|
13
|
+
import { StatusBar } from 'react-native';
|
|
14
|
+
import { useTheme } from 'react-crud-utils';
|
|
15
|
+
|
|
16
|
+
interface SafeViewType {
|
|
17
|
+
safeStyle?: StyleProp<ViewStyle> | any;
|
|
18
|
+
viewStyle?: StyleProp<ViewStyle> | any;
|
|
19
|
+
children?: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export default function SafeView(props: SafeViewType) {
|
|
23
|
+
const theme = useTheme();
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<SafeAreaProvider style={props.safeStyle}>
|
|
27
|
+
<SafeAreaContextView
|
|
28
|
+
style={{ backgroundColor: theme.colors?.primary, ...props.viewStyle }}
|
|
29
|
+
>
|
|
30
|
+
<StatusBar barStyle="light-content" />
|
|
31
|
+
|
|
32
|
+
<KeyboardAvoidingView
|
|
33
|
+
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
|
|
34
|
+
style={{
|
|
35
|
+
flex: 1, // 🔹 Ocupa 100% da tela
|
|
36
|
+
width: '100%',
|
|
37
|
+
justifyContent: 'center',
|
|
38
|
+
}}
|
|
39
|
+
>
|
|
40
|
+
{props.children}
|
|
41
|
+
</KeyboardAvoidingView>
|
|
42
|
+
</SafeAreaContextView>
|
|
43
|
+
</SafeAreaProvider>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
@@ -1,16 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Keyboard,
|
|
3
|
-
KeyboardAvoidingView,
|
|
4
|
-
Platform,
|
|
5
|
-
ScrollView,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
TouchableWithoutFeedback,
|
|
8
|
-
View,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
import {
|
|
11
|
-
SafeAreaProvider,
|
|
12
|
-
SafeAreaView as SafeAreaContextView,
|
|
13
|
-
} from 'react-native-safe-area-context';
|
|
1
|
+
import { ScrollView, StyleSheet, View } from 'react-native';
|
|
14
2
|
|
|
15
3
|
import UIChildren from '../UIChildren';
|
|
16
4
|
import { ChildType, useTheme } from 'react-crud-utils';
|
|
@@ -20,42 +8,24 @@ import { StatusBar } from 'react-native';
|
|
|
20
8
|
export default function UIView({ scope, children }: ChildType) {
|
|
21
9
|
const theme = useTheme();
|
|
22
10
|
const header = scope.getPart('header', null, []);
|
|
23
|
-
const dismissKeyboard = () => {
|
|
24
|
-
if (Platform.OS !== 'web') {
|
|
25
|
-
Keyboard.dismiss();
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
11
|
|
|
29
12
|
useEffect(() => {
|
|
30
13
|
StatusBar.setBarStyle('light-content');
|
|
31
14
|
StatusBar.setBackgroundColor?.(theme.colors.primary);
|
|
32
15
|
}, []);
|
|
33
16
|
return (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
style={
|
|
41
|
-
flex: 1, // 🔹 Ocupa 100% da tela
|
|
42
|
-
width: '100%',
|
|
43
|
-
justifyContent: 'center',
|
|
44
|
-
}}
|
|
17
|
+
<>
|
|
18
|
+
{header}
|
|
19
|
+
<View style={scope.getStyle('container', styles.container)}>
|
|
20
|
+
<ScrollView
|
|
21
|
+
keyboardShouldPersistTaps="handled"
|
|
22
|
+
contentContainerStyle={scope.getStyle('contentContainer', {})}
|
|
23
|
+
style={scope.getStyle('scroll', styles.scroll)}
|
|
45
24
|
>
|
|
46
|
-
{
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
contentContainerStyle={scope.getStyle('contentContainer', {})}
|
|
51
|
-
style={scope.getStyle('scroll', styles.scroll)}
|
|
52
|
-
>
|
|
53
|
-
<UIChildren scope={scope}>{children}</UIChildren>
|
|
54
|
-
</ScrollView>
|
|
55
|
-
</View>
|
|
56
|
-
</KeyboardAvoidingView>
|
|
57
|
-
</SafeAreaContextView>
|
|
58
|
-
</SafeAreaProvider>
|
|
25
|
+
<UIChildren scope={scope}>{children}</UIChildren>
|
|
26
|
+
</ScrollView>
|
|
27
|
+
</View>
|
|
28
|
+
</>
|
|
59
29
|
);
|
|
60
30
|
}
|
|
61
31
|
|