react-crud-mobile 1.3.379 → 1.3.381

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.379",
3
+ "version": "1.3.381",
4
4
  "license": "MIT",
5
5
  "description": "Uma biblioteca de componentes para React Native v1",
6
6
  "main": "dist/index.js",
@@ -54,10 +54,16 @@ export default function UIOrder(props: ChildType) {
54
54
  }, [items]);
55
55
 
56
56
  const onChange = (updated: any[]) => {
57
- let array: any[] = [];
57
+ const array: any[] = [];
58
+ const items = scope.getItems();
59
+
60
+ items.splice(0);
58
61
 
59
62
  Utils.each(updated, o => {
60
- array.push(o.object);
63
+ const v = o.object;
64
+
65
+ array.push(v);
66
+ items.push(v);
61
67
  });
62
68
 
63
69
  scope.changeValue(array);
@@ -193,20 +199,33 @@ export default function UIOrder(props: ChildType) {
193
199
  });
194
200
  };
195
201
 
202
+ const Empty = () => {
203
+ if (Utils.isEmpty(items)) {
204
+ let empty = scope.part('empty', 'Sem registro');
205
+
206
+ if (empty !== false) return <>{empty}</>;
207
+ }
208
+
209
+ return <></>;
210
+ };
211
+
196
212
  return (
197
213
  <View style={styles.container}>
214
+ <Empty />
198
215
  <View style={{ height: items.length * ITEM_HEIGHT, width: '100%' }}>
199
216
  {items.map(item => {
200
217
  const y = positions[item.value];
201
218
  if (!y) return null;
202
219
 
203
220
  const isDragging = draggingId === item.value;
221
+ const itemStyle = scope.getStyle('row', { ...styles.item });
222
+
204
223
  return (
205
224
  <Animated.View
206
225
  key={item.value}
207
226
  {...(panRespondersRef.current[item.value]?.panHandlers ?? {})}
208
227
  style={[
209
- styles.item,
228
+ itemStyle,
210
229
  {
211
230
  position: 'absolute',
212
231
  left: 0,