react-crud-mobile 1.3.183 → 1.3.185

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.183",
3
+ "version": "1.3.185",
4
4
  "license": "MIT",
5
5
  "description": "Uma biblioteca de componentes para React Native",
6
6
  "main": "dist/index.js",
@@ -8,6 +8,7 @@ import DraggableFlatList, {
8
8
  } from 'react-native-draggable-flatlist';
9
9
  import { GestureHandlerRootView } from 'react-native-gesture-handler';
10
10
  import UIHeader from './UIHeader';
11
+ import UIChildren from '../UIChildren';
11
12
 
12
13
  export default function UIOrder(props: ChildType) {
13
14
  const scope = props.scope;
@@ -60,26 +61,62 @@ export default function UIOrder(props: ChildType) {
60
61
 
61
62
  //v2
62
63
 
63
- const renderItem = ({ item, drag, isActive }) => {
64
- let state = { ...scope.getStyle('row') };
64
+ const renderItem = ({ item, drag, isActive, getIndex }) => {
65
+ const index = getIndex();
66
+ const name = `${scope.key('row', index, '')}`;
67
+ const [row] = useState(
68
+ ScopeUtils.create({
69
+ ...original,
70
+ parent: scope,
71
+ name,
72
+ crud: scope.crud,
73
+ index,
74
+ type: 'row',
75
+ data: item,
76
+ })
77
+ );
78
+
79
+ let css = { ...scope.getStyle('row') };
80
+
81
+ if (isActive) {
82
+ css = { ...css, ...scope.getStyle('active') };
83
+ }
65
84
 
66
85
  if (isActive) {
67
- state = { ...state, ...scope.getStyle('active') };
86
+ css = { ...css, ...row.getStyle('rowSelected', {}) };
87
+ } else {
88
+ css = { ...css, ...row.getStyle('rowUnSelected', {}) };
68
89
  }
90
+ const Child = () => {
91
+ if (Utils.isEmpty(props.children)) {
92
+ return (
93
+ <>
94
+ <MaterialCommunityIcons name="drag" size={24} color="black" />
95
+ <Text style={styles.text}>{scope.getItemLabel(item)}</Text>
96
+ </>
97
+ );
98
+ }
69
99
 
100
+ return (
101
+ <>
102
+ <UIChildren transient scope={row} crud={row.crud}>
103
+ {props.children}
104
+ </UIChildren>
105
+ </>
106
+ );
107
+ };
70
108
  return (
71
109
  <ScaleDecorator>
72
110
  <TouchableOpacity
73
111
  style={[
74
112
  styles.row,
75
113
  { backgroundColor: isActive ? 'lightblue' : 'white' },
76
- { ...state },
114
+ { ...css },
77
115
  ]}
78
116
  delayLongPress={100}
79
117
  onLongPress={drag} // Initiate drag on long press
80
118
  >
81
- <MaterialCommunityIcons name="drag" size={24} color="black" />
82
- <Text style={styles.text}>{scope.getItemLabel(item)}</Text>
119
+ <Child />
83
120
  </TouchableOpacity>
84
121
  </ScaleDecorator>
85
122
  );
@@ -103,7 +140,7 @@ export default function UIOrder(props: ChildType) {
103
140
  };
104
141
 
105
142
  const Header = ({ pos }) => {
106
- const hPos = Utils.nvl(original.headerPos, 'inner');
143
+ const hPos = Utils.nvl(original.headerPos, 'outer');
107
144
 
108
145
  if (hPos !== pos) return <></>;
109
146