react-crud-mobile 1.3.182 → 1.3.184

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.182",
3
+ "version": "1.3.184",
4
4
  "license": "MIT",
5
5
  "description": "Uma biblioteca de componentes para React Native",
6
6
  "main": "dist/index.js",
@@ -60,20 +60,39 @@ export default function UIOrder(props: ChildType) {
60
60
 
61
61
  //v2
62
62
 
63
- const renderItem = ({ item, drag, isActive }) => {
64
- let state = { ...scope.getStyle('row') };
63
+ const renderItem = ({ item, drag, isActive, getIndex }) => {
64
+ const index = getIndex();
65
+ const name = `${scope.key('row', index, '')}`;
66
+ const [row] = useState(
67
+ ScopeUtils.create({
68
+ ...original,
69
+ parent: scope,
70
+ name,
71
+ crud: scope.crud,
72
+ index,
73
+ type: 'row',
74
+ data: item,
75
+ })
76
+ );
77
+
78
+ let css = { ...scope.getStyle('row') };
65
79
 
66
80
  if (isActive) {
67
- state = { ...state, ...scope.getStyle('active') };
81
+ css = { ...css, ...scope.getStyle('active') };
68
82
  }
69
83
 
84
+ if (isActive) {
85
+ css = { ...css, ...row.getStyle('rowSelected', {}) };
86
+ } else {
87
+ css = { ...css, ...row.getStyle('rowUnSelected', {}) };
88
+ }
70
89
  return (
71
90
  <ScaleDecorator>
72
91
  <TouchableOpacity
73
92
  style={[
74
93
  styles.row,
75
94
  { backgroundColor: isActive ? 'lightblue' : 'white' },
76
- { ...state },
95
+ { ...css },
77
96
  ]}
78
97
  delayLongPress={100}
79
98
  onLongPress={drag} // Initiate drag on long press
@@ -102,13 +121,21 @@ export default function UIOrder(props: ChildType) {
102
121
  return <>{children}</>;
103
122
  };
104
123
 
124
+ const Header = ({ pos }) => {
125
+ const hPos = Utils.nvl(original.headerPos, 'outer');
126
+
127
+ if (hPos !== pos) return <></>;
128
+
129
+ return <UIHeader scope={scope} />;
130
+ };
131
+
105
132
  let OrderData = () => {
106
133
  const [data, setData] = useState(items);
107
134
 
108
135
  return (
109
136
  <DraggableFlatList
110
137
  data={data}
111
- ListHeaderComponent={<UIHeader scope={scope} />}
138
+ ListHeaderComponent={<Header pos="inner" />}
112
139
  ListFooterComponent={<>{scope.getPart('footer')}</>}
113
140
  renderItem={renderItem}
114
141
  containerStyle={{ ...scope.getStyle('list') }}
@@ -129,6 +156,7 @@ export default function UIOrder(props: ChildType) {
129
156
  };
130
157
  return (
131
158
  <OrderView>
159
+ <Header pos="outer" />
132
160
  <OrderData />
133
161
  </OrderView>
134
162
  );