📌  相关文章
📜  如何在本机反应中检测滚动视图的单端范围 - Javascript代码示例

📅  最后修改于: 2022-03-11 15:01:32.929000             🧑  作者: Mango

代码示例1
import React from 'react';
import {ScrollView, Text} from 'react-native';

const isCloseToBottom = ({layoutMeasurement, contentOffset, contentSize}) => {
  const paddingToBottom = 20;
  return layoutMeasurement.height + contentOffset.y >=
    contentSize.height - paddingToBottom;
};

const MyCoolScrollViewComponent = ({enableSomeButton}) => (
   {
      if (isCloseToBottom(nativeEvent)) {
        enableSomeButton();
      }
    }}
    scrollEventThrottle={400}
  >
    Here is very long lorem ipsum or something...
  
);

export default MyCoolScrollViewComponent;