react-crud-mobile 1.3.145 → 1.3.147

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,6 +1,6 @@
1
1
  {
2
2
  "name": "react-crud-mobile",
3
- "version": "1.3.145",
3
+ "version": "1.3.147",
4
4
  "license": "MIT",
5
5
  "description": "Uma biblioteca de componentes para React Native",
6
6
  "main": "dist/index.js",
@@ -16,6 +16,7 @@ import UIElement from './UIElement';
16
16
 
17
17
  import UIInclude from './core/UIInclude';
18
18
  import SafeView from './core/SafeView';
19
+ import GestureView from './core/GestureView';
19
20
 
20
21
  const UI = {
21
22
  Order: (props: ListType) => <UIElement {...props} type="order" />,
@@ -70,5 +71,6 @@ const UI = {
70
71
  Quantity: (props: ListInputType) => <UIElement {...props} type="quantity" />,
71
72
  Slider: (props: SliderType) => <UIElement {...props} type="slider" />,
72
73
  SafeView: SafeView,
74
+ GestureView: GestureView,
73
75
  };
74
76
  export default UI;
@@ -0,0 +1,16 @@
1
+ import { StyleProp, ViewStyle } from 'react-native';
2
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
3
+
4
+ interface SafeViewType {
5
+ safeStyle?: StyleProp<ViewStyle> | any;
6
+ viewStyle?: StyleProp<ViewStyle> | any;
7
+ children?: any;
8
+ }
9
+
10
+ export default function GestureView(props: SafeViewType) {
11
+ return (
12
+ <GestureHandlerRootView style={{ flex: 1 }}>
13
+ {props.children}
14
+ </GestureHandlerRootView>
15
+ );
16
+ }
@@ -34,7 +34,7 @@ export default function UIModal({
34
34
  }: UIModalType) {
35
35
  let [modalVisible, setModalVisible] = useState(open === true);
36
36
  let [index, setIndex] = useState(0);
37
- //v8
37
+ //v6
38
38
 
39
39
  const label = scope.getLabel();
40
40
  const theme = scope.getTheme();
@@ -100,8 +100,6 @@ export default function UIModal({
100
100
  let disableScroll = scope.getPart('disableScroll', false);
101
101
  let disableContent = scope.getPart('disableContent', false);
102
102
 
103
- console.log(scope.original);
104
-
105
103
  if (disableContent) {
106
104
  return <>{children}</>;
107
105
  }
@@ -125,8 +123,24 @@ export default function UIModal({
125
123
  );
126
124
  };
127
125
 
126
+ const ModalView = ({ children }) => {
127
+ const original = scope.original;
128
+
129
+ if (original.gesture) {
130
+ return (
131
+ <GestureHandlerRootView
132
+ style={{
133
+ flex: 1,
134
+ }}
135
+ >
136
+ {children}
137
+ </GestureHandlerRootView>
138
+ );
139
+ }
140
+ return <>{children}</>;
141
+ };
128
142
  return (
129
- <GestureHandlerRootView style={{ flex: 1 }}>
143
+ <ModalView>
130
144
  <Modal
131
145
  key={key}
132
146
  animationType="slide"
@@ -172,7 +186,7 @@ export default function UIModal({
172
186
  </SafeAreaView>
173
187
  <UIToast />
174
188
  </Modal>
175
- </GestureHandlerRootView>
189
+ </ModalView>
176
190
  );
177
191
  }
178
192
 
@@ -1,10 +1,12 @@
1
1
  import React, { useState } from 'react';
2
- import { ChildType, Utils } from 'react-crud-utils';
3
- import { StyleSheet, Text, TouchableOpacity } from 'react-native';
4
- import { MaterialCommunityIcons } from '@expo/vector-icons';
2
+ import { ChildType, ComponentUtils, ScopeUtils, Utils } from 'react-crud-utils';
3
+ import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
4
+ import UI from '../UI';
5
+ import { Ionicons, MaterialCommunityIcons } from '@expo/vector-icons';
5
6
  import DraggableFlatList, {
6
7
  ScaleDecorator,
7
8
  } from 'react-native-draggable-flatlist';
9
+ import { GestureHandlerRootView } from 'react-native-gesture-handler';
8
10
  import UIHeader from './UIHeader';
9
11
 
10
12
  export default function UIOrder(props: ChildType) {
@@ -84,9 +86,25 @@ export default function UIOrder(props: ChildType) {
84
86
  };
85
87
 
86
88
  const [data, setData] = useState(items);
89
+ const OrderView = ({ children }) => {
90
+ if (original.gesture !== false) {
91
+ return (
92
+ <GestureHandlerRootView
93
+ style={{
94
+ flex: 1,
95
+ width: '100%',
96
+ ...scope.getStyle('order', { justifyContent: 'flex-start' }),
97
+ }}
98
+ >
99
+ {children}
100
+ </GestureHandlerRootView>
101
+ );
102
+ }
103
+ return <>{children}</>;
104
+ };
87
105
 
88
106
  return (
89
- <>
107
+ <OrderView>
90
108
  <UIHeader scope={scope} />
91
109
  <DraggableFlatList
92
110
  data={data}
@@ -104,7 +122,7 @@ export default function UIOrder(props: ChildType) {
104
122
  scope.changeValue(data);
105
123
  }}
106
124
  />
107
- </>
125
+ </OrderView>
108
126
  );
109
127
  }
110
128