RefreshControl jumping in ListView [iOS]
In my application I am the ListView component like in the code below. Everything works like charm except of one tiny ugly bug. When I start pulling the list view down it goes down smoothly and increases the number of strokes of the loading spinner. But in the moment the spinner graphic completes and starts spinning I am observing an ugly jump.
This is exactly the same behavior as described in this stackoverflow post
<ListView
onEndReached={this._loadMore.bind(this)}
onEndReachedThreshold={0}
refreshControl={
<RefreshControl
refreshing={this.state.isRefreshing}
onRefresh={this._refresh.bind(this)}
/>
}
renderFooter={() => {
return <Image style={styles.loadingIndicator} source={require('../../images/loading.gif')}/>
}}
dataSource={this.state.dataSource.cloneWithRows(preparedItems)}
loadData={this._refresh.bind(this)}
scrollRenderAheadDistance={1600}
pageSize={6}
removeClippedSubviews={true}
initialListSize={20}
renderRow={this._renderRow.bind(this)}
/>
Hey seb0zz, thanks for reporting this issue!
React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
- If you don't know how to do something or something is not working as you expect but not sure it's a bug, please ask on StackOverflow with the tag
react-nativeor for more real time interactions, ask on Discord in the #react-native channel. - If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
- We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!
Hi, on what device/simulator does this happens and what version of iOS? Also can you show me the content of your _refresh function?
I can reproduce this bug in every simulator, on my iPhone 6 and also on my iPhone 6s device. My current iOS version is 9.2.
This is my _refresh function:
_refresh() {
this.setState({isRefreshing: true, skip: 0}, () => {
this.loadItems(this.state.limit, this.state.skip)
})
}
Ok I see what you mean, the ScrollView content scrolls down by like 30px when it starts refreshing. I checked if I could find what caused this but I didn't.
@nicklockwood @tadeuzagallo @sahrens Any idea why this happens?
I had the same problem a couple of months ago trying to implement a UIRefreshControl on a UIWebView.
UIScrollView is slowing down the tracking of the pan gesture when you pull past the edge of the scrollview. However, UIScrollView is not accounting for changes to contentInset during tracking. UIRefreshControl changes contentInset when it activates, and this change is causing the jump. UITableView accounts for this by NOT slowing down tracking until you pull PAST the refresh control. However, I don't see a way that this behavior is exposed.
Although I never solved it for the scrollview embedded in the webview, I believe this solution was the best I came across at that time.
I encounter the same werid problem.
However, I find this only happen if there is few rows in the ListView. If there is many rows, everything is OK. It seems if all the rows exceed the listview's contentSize, it's OK. Else the jumping appears.
having the same issue. Anybody got this working?
NSLog(@"contentOffset: %f", contentOffset.y);
...
2016-07-19 14:55:34.341 Archy[398:63453] contentOffset: -104.500000
2016-07-19 14:55:34.357 Archy[398:63453] contentOffset: -106.000000
2016-07-19 14:55:34.373 Archy[398:63453] contentOffset: -108.500000
2016-07-19 14:55:34.390 Archy[398:63453] contentOffset: -111.000000
2016-07-19 14:55:34.394 Archy[398:63453] contentOffset: -60.000000
2016-07-19 14:55:34.395 Archy[398:63453] contentOffset: -111.000000
2016-07-19 14:55:34.407 Archy[398:63453] contentOffset: -151.500000
2016-07-19 14:55:34.423 Archy[398:63453] contentOffset: -153.500000
2016-07-19 14:55:34.440 Archy[398:63453] contentOffset: -156.000000
Thanks to @axelander, this answer from StackOverflow http://stackoverflow.com/questions/19483511/uirefreshcontrol-with-uicollectionview-in-ios7/19926917#19926917 fixed the issue for me.
Hi there! This issue is being closed because it has been inactive for a while.
But don't worry, it will live on with ProductPains! Check out its new home: https://productpains.com/post/react-native/refreshcontrol-jumping-in-listview-ios
Product Pains has been very useful in highlighting the top bugs and feature requests: https://productpains.com/product/react-native?tab=top
Also, if this issue is a bug, please consider sending a pull request with a fix.