react-crud-mobile 1.0.643 → 1.0.645
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/dist/react-crud-mobile.cjs.development.js +9 -28
- package/dist/react-crud-mobile.cjs.development.js.map +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js +1 -1
- package/dist/react-crud-mobile.cjs.production.min.js.map +1 -1
- package/dist/react-crud-mobile.esm.js +11 -30
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +1 -2
- package/src/elements/core/UIListRow.tsx +9 -47
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.645",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"description": "Uma biblioteca de componentes para React Native",
|
|
5
5
|
"main": "dist/index.js",
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
"react-dom": "19.0.0",
|
|
49
49
|
"react-native": "0.79.2",
|
|
50
50
|
"react-native-gesture-handler": "~2.24.0",
|
|
51
|
-
"react-native-intersection-observer": "^0.2.1",
|
|
52
51
|
"react-native-reanimated": "~3.17.4",
|
|
53
52
|
"react-native-safe-area-context": "5.4.0",
|
|
54
53
|
"react-native-screens": "~4.10.0",
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
2
|
import { ChildType, ScopeUtils, Utils } from 'react-crud-utils';
|
|
3
3
|
import UIChildren from '../UIChildren';
|
|
4
|
-
import {
|
|
5
|
-
StyleSheet,
|
|
6
|
-
TouchableHighlight,
|
|
7
|
-
ScrollView,
|
|
8
|
-
View,
|
|
9
|
-
Text,
|
|
10
|
-
Dimensions,
|
|
11
|
-
findNodeHandle,
|
|
12
|
-
UIManager,
|
|
13
|
-
} from 'react-native';
|
|
4
|
+
import { StyleSheet, TouchableHighlight, View } from 'react-native';
|
|
14
5
|
|
|
15
6
|
interface UIListRowType extends ChildType {
|
|
16
7
|
item: any;
|
|
@@ -45,19 +36,6 @@ export default function UIListRow(props: UIListRowType) {
|
|
|
45
36
|
const ListItem = () => {
|
|
46
37
|
let [updateIndex, setUpdateIndex] = useState(0);
|
|
47
38
|
let key = scope.key('item');
|
|
48
|
-
const viewRef = useRef(null);
|
|
49
|
-
const [visible, setVisible] = useState(false);
|
|
50
|
-
const windowHeight = Dimensions.get('window').height;
|
|
51
|
-
const checkIfVisible = () => {
|
|
52
|
-
const nodeHandle = findNodeHandle(viewRef.current);
|
|
53
|
-
|
|
54
|
-
if (nodeHandle && !visible) {
|
|
55
|
-
UIManager.measure(nodeHandle, (x, y, width, height, pageX, pageY) => {
|
|
56
|
-
const isVisible = pageY >= 0 && pageY + height <= windowHeight;
|
|
57
|
-
setVisible(isVisible);
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
39
|
|
|
62
40
|
const getRowStyle = () => {
|
|
63
41
|
let css = row.getStyle('row', { ...styles.row });
|
|
@@ -75,44 +53,28 @@ export default function UIListRow(props: UIListRowType) {
|
|
|
75
53
|
setUpdateIndex(++updateIndex);
|
|
76
54
|
};
|
|
77
55
|
|
|
78
|
-
const Child = () => {
|
|
79
|
-
return (
|
|
80
|
-
<>
|
|
81
|
-
{visible && (
|
|
82
|
-
<UIChildren scope={row} crud={row.crud}>
|
|
83
|
-
{props.children}
|
|
84
|
-
</UIChildren>
|
|
85
|
-
)}
|
|
86
|
-
</>
|
|
87
|
-
);
|
|
88
|
-
};
|
|
89
|
-
|
|
90
56
|
if (!original.click) {
|
|
91
57
|
return (
|
|
92
|
-
<View
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
ref={viewRef}
|
|
97
|
-
>
|
|
98
|
-
<Child />
|
|
58
|
+
<View key={key} style={getRowStyle()}>
|
|
59
|
+
<UIChildren scope={row} crud={row.crud}>
|
|
60
|
+
{props.children}
|
|
61
|
+
</UIChildren>
|
|
99
62
|
</View>
|
|
100
63
|
);
|
|
101
64
|
}
|
|
102
|
-
|
|
103
65
|
return (
|
|
104
66
|
<TouchableHighlight
|
|
105
67
|
key={key}
|
|
106
68
|
style={getRowStyle()}
|
|
107
|
-
ref={viewRef}
|
|
108
69
|
underlayColor={'transparent'}
|
|
109
|
-
onLayout={checkIfVisible}
|
|
110
70
|
onPress={e => {
|
|
111
71
|
e.stopPropagation();
|
|
112
72
|
onClick(item);
|
|
113
73
|
}}
|
|
114
74
|
>
|
|
115
|
-
<
|
|
75
|
+
<UIChildren scope={row} crud={row.crud}>
|
|
76
|
+
{props.children}
|
|
77
|
+
</UIChildren>
|
|
116
78
|
</TouchableHighlight>
|
|
117
79
|
);
|
|
118
80
|
};
|