react-crud-mobile 1.0.340 → 1.0.341
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/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.341",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"description": "Uma biblioteca de componentes para React Native",
|
|
5
5
|
"main": "dist/index.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@types/react-native": "^0.72.0",
|
|
51
51
|
"babel-plugin-module-resolver": "^5.0.0",
|
|
52
52
|
"react": "^18.3.1",
|
|
53
|
-
"react-crud-utils": "^0.1.
|
|
53
|
+
"react-crud-utils": "^0.1.93",
|
|
54
54
|
"react-dom": "^18.3.1",
|
|
55
55
|
"react-native": "0.76.9",
|
|
56
56
|
"react-native-screens": "^4.10.0",
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { ChildType, MethodType, useTheme, Utils } from 'react-crud-utils';
|
|
3
|
+
import {
|
|
4
|
+
Text,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Modal,
|
|
8
|
+
View,
|
|
9
|
+
StatusBar,
|
|
10
|
+
SafeAreaView,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import UIChildren from '../UIChildren';
|
|
13
|
+
|
|
14
|
+
export default function UIModal(props: ChildType) {
|
|
15
|
+
const [modalVisible, setModalVisible] = useState(false);
|
|
16
|
+
const scope = props.scope;
|
|
17
|
+
const label = scope.getLabel();
|
|
18
|
+
const theme = useTheme();
|
|
19
|
+
|
|
20
|
+
const handlePress = () => {
|
|
21
|
+
setModalVisible(!modalVisible);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const onClick = ({ crud, value }: MethodType) => {
|
|
25
|
+
scope.changeValue(value);
|
|
26
|
+
handlePress();
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const style = (part: string, extra?: any) => {
|
|
30
|
+
return { ...styles[part], ...scope.getStyle(part), ...extra };
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Modal
|
|
35
|
+
animationType="slide"
|
|
36
|
+
transparent={true}
|
|
37
|
+
visible={modalVisible}
|
|
38
|
+
onRequestClose={() => setModalVisible(false)}
|
|
39
|
+
>
|
|
40
|
+
<StatusBar
|
|
41
|
+
barStyle="dark-content"
|
|
42
|
+
backgroundColor={theme.colors.primary}
|
|
43
|
+
/>
|
|
44
|
+
<SafeAreaView style={style('modalSafe')}>
|
|
45
|
+
<View style={style('modalHeader')}>
|
|
46
|
+
<TouchableOpacity
|
|
47
|
+
onPress={() => setModalVisible(false)}
|
|
48
|
+
style={style('modalCloseButton')}
|
|
49
|
+
>
|
|
50
|
+
<Text style={style('modalCloseText')}>X</Text>
|
|
51
|
+
</TouchableOpacity>
|
|
52
|
+
<Text style={style('modalTitle')}>{label}</Text>
|
|
53
|
+
</View>
|
|
54
|
+
<View style={style('modalContent')}>
|
|
55
|
+
<UIChildren scope={scope}>{props.children}</UIChildren>
|
|
56
|
+
</View>
|
|
57
|
+
</SafeAreaView>
|
|
58
|
+
</Modal>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const styles = StyleSheet.create({
|
|
63
|
+
modalSafe: {
|
|
64
|
+
flex: 1,
|
|
65
|
+
backgroundColor: '#f5f5f5',
|
|
66
|
+
paddingTop: StatusBar.currentHeight || 0, // Considera a altura da barra de status no Android
|
|
67
|
+
},
|
|
68
|
+
modalHeader: {
|
|
69
|
+
flexDirection: 'row',
|
|
70
|
+
alignItems: 'center',
|
|
71
|
+
padding: 15,
|
|
72
|
+
backgroundColor: '#6200ea',
|
|
73
|
+
},
|
|
74
|
+
modalCloseButton: {
|
|
75
|
+
padding: 10,
|
|
76
|
+
},
|
|
77
|
+
modalCloseText: {
|
|
78
|
+
fontSize: 18,
|
|
79
|
+
color: 'white',
|
|
80
|
+
},
|
|
81
|
+
modalTitle: {
|
|
82
|
+
fontSize: 18,
|
|
83
|
+
color: 'white',
|
|
84
|
+
fontWeight: 'bold',
|
|
85
|
+
marginLeft: 10,
|
|
86
|
+
},
|
|
87
|
+
modalContent: {
|
|
88
|
+
flex: 1,
|
|
89
|
+
width: '100%',
|
|
90
|
+
alignSelf: 'flex-start',
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
flexWrap: 'wrap',
|
|
93
|
+
padding: 20,
|
|
94
|
+
},
|
|
95
|
+
});
|