react-crud-mobile 1.0.641 → 1.0.643

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.
@@ -11,7 +11,6 @@ var reactNative = require('react-native');
11
11
  var jsxRuntime = require('react/jsx-runtime');
12
12
  var Ionicons = _interopDefault(require('@expo/vector-icons/Ionicons'));
13
13
  var vectorIcons = require('@expo/vector-icons');
14
- var reactNativeIntersectionObserver = require('react-native-intersection-observer');
15
14
  var reactNativeSafeAreaContext = require('react-native-safe-area-context');
16
15
 
17
16
  function _extends() {
@@ -706,6 +705,20 @@ function UIListRow(props) {
706
705
  updateIndex = _useState2[0],
707
706
  setUpdateIndex = _useState2[1];
708
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 && !visible) {
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
+ };
709
722
  var getRowStyle = function getRowStyle() {
710
723
  var css = row.getStyle('row', _extends({}, styles.row));
711
724
  if (cols > 0) {
@@ -717,31 +730,34 @@ function UIListRow(props) {
717
730
  scope.updateIndex = scope.updateIndex + 1;
718
731
  setUpdateIndex(++updateIndex);
719
732
  };
720
- if (!original.click) {
721
- return /*#__PURE__*/jsxRuntime.jsx(reactNative.View, {
722
- style: getRowStyle(),
723
- children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
733
+ var Child = function Child() {
734
+ return /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
735
+ children: visible && /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
724
736
  scope: row,
725
737
  crud: row.crud,
726
738
  children: props.children
727
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, {})
728
748
  }, key);
729
749
  }
730
- return /*#__PURE__*/jsxRuntime.jsx(reactNativeIntersectionObserver.InView, {
731
- children: /*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableHighlight, {
732
- style: getRowStyle(),
733
- underlayColor: 'transparent',
734
- onPress: function onPress(e) {
735
- e.stopPropagation();
736
- onClick(item);
737
- },
738
- children: /*#__PURE__*/jsxRuntime.jsx(UIChildren, {
739
- scope: row,
740
- crud: row.crud,
741
- children: props.children
742
- })
743
- }, key)
744
- });
750
+ return /*#__PURE__*/jsxRuntime.jsx(reactNative.TouchableHighlight, {
751
+ style: getRowStyle(),
752
+ ref: viewRef,
753
+ underlayColor: 'transparent',
754
+ onLayout: checkIfVisible,
755
+ onPress: function onPress(e) {
756
+ e.stopPropagation();
757
+ onClick(item);
758
+ },
759
+ children: /*#__PURE__*/jsxRuntime.jsx(Child, {})
760
+ }, key);
745
761
  };
746
762
  return /*#__PURE__*/jsxRuntime.jsx(ListItem, {});
747
763
  }