react-crud-mobile 1.0.621 → 1.0.622

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.
@@ -29,12 +29,6 @@ export default function UIListRow(props: UIListRowType) {
29
29
  })
30
30
  );
31
31
 
32
- let [updateIndex, setUpdateIndex] = useState(0);
33
-
34
- row.update = () => {
35
- setUpdateIndex(++updateIndex);
36
- };
37
-
38
32
  const getRowStyle = () => {
39
33
  let css = row.getStyle('row', { ...styles.row });
40
34
 
@@ -49,30 +43,40 @@ export default function UIListRow(props: UIListRowType) {
49
43
  row.call('click', { value: item, item, edit: true });
50
44
  };
51
45
 
52
- if (!original.click) {
46
+ const ListItem = () => {
47
+ let [updateIndex, setUpdateIndex] = useState(0);
48
+
49
+ row.update = () => {
50
+ setUpdateIndex(++updateIndex);
51
+ };
52
+
53
+ if (!original.click) {
54
+ return (
55
+ <View key={`k-${index}`} style={getRowStyle()}>
56
+ <UIChildren scope={row} crud={row.crud}>
57
+ {props.children}
58
+ </UIChildren>
59
+ </View>
60
+ );
61
+ }
53
62
  return (
54
- <View key={`k-${index}`} style={getRowStyle()}>
63
+ <TouchableHighlight
64
+ key={`k-${index}`}
65
+ style={getRowStyle()}
66
+ underlayColor={'transparent'}
67
+ onPress={e => {
68
+ e.stopPropagation();
69
+ onClick(item);
70
+ }}
71
+ >
55
72
  <UIChildren scope={row} crud={row.crud}>
56
73
  {props.children}
57
74
  </UIChildren>
58
- </View>
75
+ </TouchableHighlight>
59
76
  );
60
- }
61
- return (
62
- <TouchableHighlight
63
- key={`k-${index}`}
64
- style={getRowStyle()}
65
- underlayColor={'transparent'}
66
- onPress={e => {
67
- e.stopPropagation();
68
- onClick(item);
69
- }}
70
- >
71
- <UIChildren scope={row} crud={row.crud}>
72
- {props.children}
73
- </UIChildren>
74
- </TouchableHighlight>
75
- );
77
+ };
78
+
79
+ return <ListItem />;
76
80
  }
77
81
 
78
82
  const stylesList = StyleSheet.create({