如何在 Native Base <Content> 组件中 "Scroll To Top"?

How to "Scroll To Top" in Native Base <Content> Component?

我正在使用 Expo 并在其上实施 Native Base,我正在尝试 "Scroll to Top" 每当 "MainTabNavigator" 图标 <Ionicons/>

句柄应该在 <Content><Ionicons/> 中(在 MainTabNavigator 中)实现吗?

您可以检查 react-native-keyboard-aware-scroll-view 的 API 和方法,因为这是 <Content>

的替换元素

https://github.com/APSL/react-native-keyboard-aware-scroll-view

试试这个

 <Container>
    <Content ref={c => (this.component = c)}>
      <Text style={styles.text}>test</Text>
      <Text style={styles.text}>test</Text>
      <Text style={styles.text}>test</Text>
      ...
      ...
      ...
      ...

      <Button onPress={() => this.component._root.scrollToPosition(0, 0)}>
        <Text>Back to top</Text>
      </Button>
    </Content>
  </Container>