首页 > 解决方案 > React Native 中的偏移 RefreshControl

问题描述

编辑: React Native 中似乎有一个错误。我在 GitHub 上创建了一个错误。对于每个寻求解决方案的人:目前似乎没有。

https://github.com/facebook/react-native/issues/23988

––––</p>

我使用的是半透明标题,这就是为什么我用ScrollViewapaddingTop来抵消内容。当我下拉刷新时,微调器仍在顶部。

我曾尝试使用contentInset={{ top: 80 }}来抵消一切,但在 iOS 上存在一个问题,有时无法正确拾取并设置为0.

还有其他方法可以让 RefreshControl 开始降低吗?

在此处输入图像描述

这是我的组件:

  <Animated.ScrollView
    scrollEventThrottle={1}
    onScroll={Animated.event(
      [{ nativeEvent: { contentOffset: { y: this.state.scrollY } } }],
      { useNativeDriver: true },
    )}
    contentInset={{ top: headerHeight() + 10 }}
  >

标签: javascriptreact-nativescrollview

解决方案


style您是否为或设置了填充contentContainerStyle

您能否提供一些代码片段,您的 ScrollView 具有哪些属性以及包装的内容?


推荐阅读