RCTRefreshControl
RCTRefreshControl copied to clipboard
Can a refresh be triggered with code?
I'd like my list view to refresh on initial render to update stale cache. Is that possible?
Yes.
Sent from my iPhone
On Jun 19, 2015, at 5:45 PM, Sammy [email protected] wrote:
I'd like my list view to refresh on initial render to update stale cache. Is that possible?
— Reply to this email directly or view it on GitHub.
I tried
var nodeHandle = React.findNodeHandle(this.refs.list);
NativeRCTRefreshControl.beginRefreshing(nodeHandle);
but it didn't work. Can you help me out?
@syousif94 could you get it working? beginRefreshing
is not exported in js, so you need first to change the source adding to RCTRefreshControl.ios.js
:
beginRefreshing: function(node) {
var nodeHandle = React.findNodeHandle(node);
RefreshControl.beginRefreshing(nodeHandle);
}
this way you can make the RefreshControl appear behind the ScrollView. Now, the problem is how to make the ScrollView showing it without manual scrolling. I tried to scrollTo
the ScrollView, but it didn't work.