React native React Native Scrollview没有滚动结束选项

React native React Native Scrollview没有滚动结束选项,react-native,React Native,你好,我是react native的初学者。 我在scrollview中遇到了一些问题(我想用scrollview加载更多功能) 我已经用react native编写了设计代码。 现在我看到react native scroll view没有滚动结束事件,但他们建议使用FlatList。 如果我使用FlatList,我的设计将无法顺利工作。 请帮帮我。 非常感谢。导入React,{useRef}来自'React'; import React, { useRef } from 'react'; i

你好,我是react native的初学者。 我在scrollview中遇到了一些问题(我想用scrollview加载更多功能) 我已经用react native编写了设计代码。 现在我看到react native scroll view没有滚动结束事件,但他们建议使用FlatList。 如果我使用FlatList,我的设计将无法顺利工作。 请帮帮我。 非常感谢。

导入React,{useRef}来自'React';
import React, { useRef } from 'react';
import { ScrollView } from 'react-native';

const ScreenComponent = (props) => {
  const scrollViewRef = useRef();
  return (
    <ScrollView
      ref={scrollViewRef}
      onContentSizeChange={() => scrollViewRef.current.scrollToEnd({ animated: true })}
    />
  );
};
从“react native”导入{ScrollView}; 常量屏幕组件=(道具)=>{ const scrollViewRef=useRef(); 返回( scrollViewRef.current.scrollToEnd({animated:true})} /> ); };

使用scrollViewRef,您可以转到scrollview的末尾。

可能是出现了一些错误,您读到了“scrollview没有scrollToIndex。改用FlatList。”?