你好,我是React Native的初学者。 我在使用scrollview时遇到了一些问题(我想在scrollview中加载更多功能) 我已经用react native编码了设计。 现在,我阅读了react本机滚动视图,没有滚动结束事件,但他们推荐FlatList。 如果我使用FlatList,则我的设计无法正常工作。 请帮我。 非常感谢。
答案 0 :(得分:0)
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 })}
/>
);
};
使用scrollViewRef,您可以转到scrollview的末尾。