react-crud-mobile 1.3.44 → 1.3.46

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.3.44",
2
+ "version": "1.3.46",
3
3
  "license": "MIT",
4
4
  "description": "Uma biblioteca de componentes para React Native",
5
5
  "main": "dist/index.js",
@@ -1,10 +1,9 @@
1
- import { useEffect, useRef, useState } from 'react';
1
+ import { useRef, useState } from 'react';
2
2
  import {
3
3
  ChildType,
4
4
  ComponentUtils,
5
5
  CrudUtils,
6
6
  MethodType,
7
- useTheme,
8
7
  Utils,
9
8
  ViewUtils,
10
9
  } from 'react-crud-utils';
@@ -14,14 +13,12 @@ import {
14
13
  StyleSheet,
15
14
  Modal,
16
15
  View,
17
- StatusBar,
18
16
  SafeAreaView,
19
17
  ScrollView,
20
18
  } from 'react-native';
21
19
  import UIChildren from '../UIChildren';
22
20
  import Ionicons from '@expo/vector-icons/Ionicons';
23
21
  import UIToast from './UIToast';
24
- import MobileUtils from '../../utils/MobileUtils';
25
22
 
26
23
  export default function UIModal(props: ChildType) {
27
24
  let [modalVisible, setModalVisible] = useState(false);
@@ -105,10 +102,6 @@ export default function UIModal(props: ChildType) {
105
102
  scope.update();
106
103
  };
107
104
 
108
- useEffect(() => {
109
- MobileUtils.syncTheme();
110
- }, [modalVisible]);
111
-
112
105
  let curr = scope.currentDialog;
113
106
 
114
107
  if (!curr) {
@@ -14,17 +14,17 @@ import UI from '../UI';
14
14
  import MobileUtils from '../../utils/MobileUtils';
15
15
 
16
16
  export default function UISelect(props: ChildType) {
17
- const [modalVisible, setModalVisible] = useState(false);
18
17
  const scope = props.scope;
19
18
  const element = scope.original;
20
19
  const items = Utils.nvl(scope.getOptions(), []);
21
20
  const placeholder = scope.attr('placeholder', 'Selecione...');
22
21
  const value = scope.getDisplayValue();
23
- const main = ViewUtils.getCrud('view');
24
22
  const theme = scope.getTheme();
25
23
  const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
24
+ const dlgName = scope.getName('dialog');
25
+
26
26
  const handlePress = () => {
27
- setModalVisible(!modalVisible);
27
+ scope.call('click', { click: { action: 'dialog', dialog: dlgName } });
28
28
  };
29
29
 
30
30
  const iconColor = Utils.nvl(theme.colors?.text, '#100e0e');
@@ -40,8 +40,6 @@ export default function UISelect(props: ChildType) {
40
40
  } else {
41
41
  scope.changeValue(value);
42
42
  }
43
-
44
- setModalVisible(false);
45
43
  };
46
44
 
47
45
  const style = (part: string, extra?: any) => {
@@ -49,20 +47,9 @@ export default function UISelect(props: ChildType) {
49
47
 
50
48
  return scope.getStyle(part, all);
51
49
  };
52
-
53
- const isModalVisible = () => {
54
- return modalVisible;
55
- };
56
- //v4
57
-
58
- useEffect(() => {
59
- MobileUtils.syncTheme();
60
- }, [modalVisible]);
61
-
62
- console.log(scope.original);
63
50
  return (
64
51
  <View
65
- key={scope.getName(`${scope.getPart('modal')}_${modalVisible}`)}
52
+ key={scope.getName(`${scope.getPart('modal')}`)}
66
53
  style={style('selectRoot')}
67
54
  >
68
55
  <TouchableOpacity onPress={handlePress} style={style('selectInput')}>
@@ -76,46 +63,22 @@ export default function UISelect(props: ChildType) {
76
63
  style={style('iconStyle', {})}
77
64
  />
78
65
  </TouchableOpacity>
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={() => setModalVisible(false)}
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')}>{placeholder}</Text>
100
- </View>
101
- <View style={style('modalContent')}>
102
- <UI.List
103
- data={items}
104
- name={scope.getName('list')}
105
- layout="card"
106
- click={onClick}
107
- rowStyle={{
108
- paddingLeft: 15,
109
- paddinRight: 15,
110
- ...scope.original?.rowStyle,
111
- }}
112
- {...scope.original?.listProps}
113
- >
114
- <UI.Value value="#{@this.label}" />
115
- </UI.List>
116
- </View>
117
- </SafeAreaView>
118
- </Modal>
66
+ <UI.Dialog name={dlgName} label="Selecione">
67
+ <UI.List
68
+ data={items}
69
+ name={scope.getName('list')}
70
+ layout="card"
71
+ click={onClick}
72
+ rowStyle={{
73
+ paddingLeft: 15,
74
+ paddinRight: 15,
75
+ ...scope.original?.rowStyle,
76
+ }}
77
+ {...scope.original?.listProps}
78
+ >
79
+ <UI.Value value="#{@this.label}" />
80
+ </UI.List>
81
+ </UI.Dialog>
119
82
  </View>
120
83
  );
121
84
  }