gpt4 book ai didi

ios - RefreshControl 仅出现在水平 ScrollView (iOS)中的第一个子项之上

转载 作者:可可西里 更新时间:2023-11-01 03:58:52 24 4
gpt4 key购买 nike

我有一个用例,我想水平列出卡片。我用水平 ScrollView 实现了它.

然后,我想为每张卡片实现下拉刷新模式,以便更新卡片中显示的数据。因此我使用了 RefreshControl组件作为 ScrollView 的一个属性。

问题是,在 iOS 上,当我切换到第一张卡以外的另一张卡时,我看不到 RefreshControl 组件(请参见下面的 gif)。

horizontal scroll with refresh control iOS

代码

<ScrollView
contentContainerStyle={styles.container}
horizontal
pagingEnabled
showsHorizontalScrollIndicator={false}
directionalLockEnabled
contentInset={{top: 1}}
refreshControl={
<RefreshControl
refreshing={this.state.isRefreshing}
onRefresh={this._onRefresh.bind(this)}
/>
}
>
<Text style={styles.card}>First child</Text>
<Text style={styles.card}>Second child</Text>
</ScrollView>

下面演示中的完整代码

演示 https://rnplay.org/apps/sRXpEw

编辑

它看起来与这部分代码相关:Libraries/Components/ScrollView/ScrollView.js#L523-L529

最佳答案

据我所知,这是 refreshControl 的预期行为 - 应该只有一个。

这对您的应用有用吗?

<ScrollView
contentContainerStyle={styles.container}
horizontal
pagingEnabled
showsHorizontalScrollIndicator={false}
directionalLockEnabled
contentInset={{top: 1}}
>
<ScrollView
refreshControl={
<RefreshControl
refreshing={this.state.isRefreshing}
onRefresh={this._onRefresh.bind(this)}
/>
}><Text style={styles.card}>First child</Text></ScrollView>
<ScrollView
refreshControl={
<RefreshControl
refreshing={this.state.isRefreshing}
onRefresh={this._onRefresh.bind(this)}
/>
}><Text style={styles.card}>Second child</Text></ScrollView>
</ScrollView>

关于ios - RefreshControl 仅出现在水平 ScrollView (iOS)中的第一个子项之上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40493187/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com