react-crud-mobile 1.3.46 → 1.3.48
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/react-crud-mobile.cjs.development.js +86 -39
- 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 +88 -41
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/elements/core/UISelect.tsx +64 -20
package/package.json
CHANGED
|
@@ -8,12 +8,14 @@ import {
|
|
|
8
8
|
View,
|
|
9
9
|
StatusBar,
|
|
10
10
|
SafeAreaView,
|
|
11
|
+
ScrollView,
|
|
11
12
|
} from 'react-native';
|
|
12
13
|
import { Ionicons } from '@expo/vector-icons';
|
|
13
14
|
import UI from '../UI';
|
|
14
15
|
import MobileUtils from '../../utils/MobileUtils';
|
|
15
16
|
|
|
16
17
|
export default function UISelect(props: ChildType) {
|
|
18
|
+
const [modalVisible, setModalVisible] = useState(false);
|
|
17
19
|
const scope = props.scope;
|
|
18
20
|
const element = scope.original;
|
|
19
21
|
const items = Utils.nvl(scope.getOptions(), []);
|
|
@@ -21,12 +23,11 @@ export default function UISelect(props: ChildType) {
|
|
|
21
23
|
const value = scope.getDisplayValue();
|
|
22
24
|
const theme = scope.getTheme();
|
|
23
25
|
const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
|
|
24
|
-
const dlgName = scope.getName('dialog');
|
|
25
|
-
|
|
26
26
|
const handlePress = () => {
|
|
27
|
-
|
|
27
|
+
setModalVisible(!modalVisible);
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
+
const scrollRef = useRef(null);
|
|
30
31
|
const iconColor = Utils.nvl(theme.colors?.text, '#100e0e');
|
|
31
32
|
const modalColor = Utils.nvl(headerStyle.color, 'white');
|
|
32
33
|
const defaults = { color: modalColor };
|
|
@@ -40,6 +41,8 @@ export default function UISelect(props: ChildType) {
|
|
|
40
41
|
} else {
|
|
41
42
|
scope.changeValue(value);
|
|
42
43
|
}
|
|
44
|
+
|
|
45
|
+
setModalVisible(false);
|
|
43
46
|
};
|
|
44
47
|
|
|
45
48
|
const style = (part: string, extra?: any) => {
|
|
@@ -47,9 +50,19 @@ export default function UISelect(props: ChildType) {
|
|
|
47
50
|
|
|
48
51
|
return scope.getStyle(part, all);
|
|
49
52
|
};
|
|
53
|
+
|
|
54
|
+
const isModalVisible = () => {
|
|
55
|
+
return modalVisible;
|
|
56
|
+
};
|
|
57
|
+
//v4
|
|
58
|
+
|
|
59
|
+
useEffect(() => {
|
|
60
|
+
MobileUtils.syncTheme();
|
|
61
|
+
}, [modalVisible]);
|
|
62
|
+
|
|
50
63
|
return (
|
|
51
64
|
<View
|
|
52
|
-
key={scope.getName(`${scope.getPart('modal')}`)}
|
|
65
|
+
key={scope.getName(`${scope.getPart('modal')}_${modalVisible}`)}
|
|
53
66
|
style={style('selectRoot')}
|
|
54
67
|
>
|
|
55
68
|
<TouchableOpacity onPress={handlePress} style={style('selectInput')}>
|
|
@@ -63,22 +76,53 @@ export default function UISelect(props: ChildType) {
|
|
|
63
76
|
style={style('iconStyle', {})}
|
|
64
77
|
/>
|
|
65
78
|
</TouchableOpacity>
|
|
66
|
-
<
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
<Modal
|
|
80
|
+
animationType="slide"
|
|
81
|
+
transparent={true}
|
|
82
|
+
visible={isModalVisible()}
|
|
83
|
+
onRequestClose={() => setModalVisible(false)}
|
|
84
|
+
>
|
|
85
|
+
<SafeAreaView style={style('modalTop')} />
|
|
86
|
+
<SafeAreaView style={style('modalSafe')}>
|
|
87
|
+
<View style={scope.getStyle('header', headerStyle)}>
|
|
88
|
+
<TouchableOpacity
|
|
89
|
+
onPress={handlePress}
|
|
90
|
+
style={style('modalCloseButton')}
|
|
91
|
+
>
|
|
92
|
+
<Ionicons
|
|
93
|
+
name="close"
|
|
94
|
+
size={24}
|
|
95
|
+
color={modalColor}
|
|
96
|
+
style={style('modalCloseText', defaults)}
|
|
97
|
+
/>
|
|
98
|
+
</TouchableOpacity>
|
|
99
|
+
<Text style={style('modalTitle', defaults)}>{placeholder}</Text>
|
|
100
|
+
</View>
|
|
101
|
+
<ScrollView
|
|
102
|
+
contentContainerStyle={{ flexGrow: 1, paddingBottom: 50 }}
|
|
103
|
+
style={style('modalContent')}
|
|
104
|
+
nestedScrollEnabled={true}
|
|
105
|
+
ref={scrollRef}
|
|
106
|
+
>
|
|
107
|
+
<View style={{ flex: 1 }}>
|
|
108
|
+
<UI.List
|
|
109
|
+
data={items}
|
|
110
|
+
name={scope.getName('list')}
|
|
111
|
+
layout="card"
|
|
112
|
+
click={onClick}
|
|
113
|
+
rowStyle={{
|
|
114
|
+
paddingLeft: 15,
|
|
115
|
+
paddinRight: 15,
|
|
116
|
+
...scope.original?.rowStyle,
|
|
117
|
+
}}
|
|
118
|
+
{...scope.original?.listProps}
|
|
119
|
+
>
|
|
120
|
+
<UI.Value value="#{@this.label}" />
|
|
121
|
+
</UI.List>
|
|
122
|
+
</View>
|
|
123
|
+
</ScrollView>
|
|
124
|
+
</SafeAreaView>
|
|
125
|
+
</Modal>
|
|
82
126
|
</View>
|
|
83
127
|
);
|
|
84
128
|
}
|