react-crud-mobile 1.3.83 → 1.3.85

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.83",
2
+ "version": "1.3.85",
3
3
  "license": "MIT",
4
4
  "description": "Uma biblioteca de componentes para React Native",
5
5
  "main": "dist/index.js",
@@ -534,7 +534,13 @@ export default function UIElement(props: ElementType) {
534
534
  )}
535
535
 
536
536
  {dialog && (
537
- <UIModal {...props} scope={scope} crud={dialog.crud} open>
537
+ <UIModal
538
+ {...props}
539
+ scope={scope}
540
+ crud={dialog.crud}
541
+ open
542
+ dialog={dialog}
543
+ >
538
544
  {dialog.component}
539
545
  </UIModal>
540
546
  )}
@@ -22,15 +22,20 @@ import UIToast from './UIToast';
22
22
 
23
23
  interface UIModalType extends ChildType {
24
24
  open?: boolean;
25
+ dialog?: any;
25
26
  }
26
27
 
27
- export default function UIModal(props: UIModalType) {
28
- let [modalVisible, setModalVisible] = useState(props.open === true);
28
+ export default function UIModal({
29
+ scope,
30
+ open,
31
+ dialog,
32
+ ...props
33
+ }: UIModalType) {
34
+ let [modalVisible, setModalVisible] = useState(open === true);
29
35
  let [index, setIndex] = useState(0);
30
36
  let main = ViewUtils.getCrud('view');
31
- //v3
37
+ //v4
32
38
 
33
- const scope = props.scope;
34
39
  const label = scope.getLabel();
35
40
  const theme = scope.getTheme();
36
41
  const headerStyle = Utils.nvl(theme.styles?.defaults?.header, {});
@@ -128,6 +133,19 @@ export default function UIModal(props: UIModalType) {
128
133
  let defaults = { color };
129
134
  let key = `${scope.currentDialog.name}-${index}`;
130
135
 
136
+ let Content = () => {
137
+ if (dialog?.component) {
138
+ let Aux = dialog?.component;
139
+
140
+ return <Aux crud={scope.currentDialog} />;
141
+ }
142
+ return (
143
+ <UIChildren scope={scope} crud={scope.currentDialog}>
144
+ {props.children}
145
+ </UIChildren>
146
+ );
147
+ };
148
+
131
149
  return (
132
150
  <Modal
133
151
  key={key}
@@ -169,9 +187,7 @@ export default function UIModal(props: UIModalType) {
169
187
  paddingBottom: 10,
170
188
  }}
171
189
  >
172
- <UIChildren scope={scope} crud={scope.currentDialog}>
173
- {props.children}
174
- </UIChildren>
190
+ <Content />
175
191
  </View>
176
192
  </ScrollView>
177
193
  {bottom}