RefreshControl offset not functioning correctly for iOS. #14056
Labels
Help Wanted
Issues ideal for external contributors.
Platform: iOS
iOS applications.
Stale
There has been a lack of activity on this issue and it may be closed soon.

Description
When using a ListView / ScrollView with a RefreshControl setting the refreshing prop to true causes the RefreshControl to open appropriately. When doing this again, however, the RefreshControl will not show until the refreshing prop is set back to false.
Reproduction Steps and Sample Code
First of all, because a good example is better than explaining this with a wall of text, here's an example:
https://github.com/YoranRoels/react-native-refresh-control-issue
Clicking on the
Refreshing 1
button will start refreshing correctly, then clicking on theRefreshing 0
button will turn off refreshing correctly. When then pressing theRefreshing 1
button AGAIN, the RefreshControl will not show until pressing theRefreshing 0
button again (it will show for a short moment).Me and my co-worker have tracked this issue down to a problem with only the iOS RefreshControl and the offset.
If you want to log the offsets in the react-native/React/Views/RCTRefreshControl.m, use this code snippet (You need to uncomment the NSLogs):
With these logs we found out that the problem is in-fact that the Y offset is not set correctly. The first time (in our case) it set the Y offset to -60 on the first refresh which shows the refresh correctly but on the second refresh it logs the Y offset as -0.5.
We actually set the Y offset to a steady 60 in the beginRefreshing function and then the issue doesn't occur. (Hard coding this is obviously not the solution, it's just to test if the RefreshControl is actually showing, and it is, the offset is just not set correctly to show it).
So if you look at my example project REALLY closely, you will see the ScrollView move just a tad bit when clicking the
Refreshing 1
button for the second time.Solution
The offset should always be set correctly when the refreshing boolean is true.
Additional Information
The text was updated successfully, but these errors were encountered: