react-crud-mobile 1.0.640 → 1.0.642
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 +28 -9
- 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 +30 -11
- package/dist/react-crud-mobile.esm.js.map +1 -1
- package/package.json +2 -1
- package/src/elements/core/UIListRow.tsx +46 -9
|
@@ -705,6 +705,20 @@ function UIListRow(props) {
|
|
|
705
705
|
updateIndex = _useState2[0],
|
|
706
706
|
setUpdateIndex = _useState2[1];
|
|
707
707
|
var key = scope.key('item');
|
|
708
|
+
var viewRef = React.useRef(null);
|
|
709
|
+
var _useState3 = React.useState(false),
|
|
710
|
+
visible = _useState3[0],
|
|
711
|
+
setVisible = _useState3[1];
|
|
712
|
+
var windowHeight = reactNative.Dimensions.get('window').height;
|
|
713
|
+
var checkIfVisible = function checkIfVisible() {
|
|
714
|
+
var nodeHandle = reactNative.findNodeHandle(viewRef.current);
|
|
715
|
+
if (nodeHandle) {
|
|
716
|
+
reactNative.UIManager.measure(nodeHandle, function (x, y, width, height, pageX, pageY) {
|
|
717
|
+
var isVisible = pageY >= 0 && pageY + height <= windowHeight;
|
|
718
|
+
setVisible(isVisible);
|
|
719
|
+
});
|
|
720
|
+
}
|
|
721
|
+
};
|
|
708
722
|
var getRowStyle = function getRowStyle() {
|
|
709
723
|
var css = row.getStyle('row', _extends({}, styles.row));
|
|
710
724
|
if (cols > 0) {
|
|
@@ -716,28 +730,33 @@ function UIListRow(props) {
|
|
|
716
730
|
scope.updateIndex = scope.updateIndex + 1;
|
|
717
731
|
setUpdateIndex(++updateIndex);
|
|
718
732
|
};
|
|
719
|
-
|
|
720
|
-
return /*#__PURE__*/jsxRuntime.jsx(
|
|
721
|
-
|
|
722
|
-
children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
|
|
733
|
+
var Child = function Child() {
|
|
734
|
+
return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
735
|
+
children: visible && /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
|
|
723
736
|
scope: row,
|
|
724
737
|
crud: row.crud,
|
|
725
738
|
children: props.children
|
|
726
739
|
})
|
|
740
|
+
});
|
|
741
|
+
};
|
|
742
|
+
if (!original.click) {
|
|
743
|
+
return /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
|
|
744
|
+
style: getRowStyle(),
|
|
745
|
+
onLayout: checkIfVisible,
|
|
746
|
+
ref: viewRef,
|
|
747
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Child, {})
|
|
727
748
|
}, key);
|
|
728
749
|
}
|
|
729
750
|
return /*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableHighlight, {
|
|
730
751
|
style: getRowStyle(),
|
|
752
|
+
ref: viewRef,
|
|
731
753
|
underlayColor: 'transparent',
|
|
754
|
+
onLayout: checkIfVisible,
|
|
732
755
|
onPress: function onPress(e) {
|
|
733
756
|
e.stopPropagation();
|
|
734
757
|
onClick(item);
|
|
735
758
|
},
|
|
736
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
737
|
-
scope: row,
|
|
738
|
-
crud: row.crud,
|
|
739
|
-
children: props.children
|
|
740
|
-
})
|
|
759
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Child, {})
|
|
741
760
|
}, key);
|
|
742
761
|
};
|
|
743
762
|
return /*#__PURE__*/jsxRuntime.jsx(ListItem, {});
|