首页 > 解决方案 > 如何在 React Native 0.63 中滚动到滚动视图的底部?

问题描述

如何使用 React Native 0.63 中的钩子滚动到任何列表的底部?当我做

const scrollviewref = useRef(ScrollView);

<ScrollView
        ref={scrollviewref}
        onContentSizeChange={scrollviewref
          .getNode()
          .scrollTo({ animated: true }, 0)}
      >

它说 scrollviewref.getNode 不是函数或

<ScrollView
        ref={scrollviewref}
        onContentSizeChange={scrollviewref
          .scrollTo({ animated: true }, 0)}
      >

它说 scrollviewref.scrollTo 不是一个函数

我已经添加了

scrollviewref.current.scrollToEnd({ animated: true });

在 useEffect 但滚动没有立即发生,有什么建议吗?

有人可以帮我吗?任何线索都会很棒。

标签: react-nativereact-native-androidscrollviewreact-native-ios

解决方案


推荐阅读