Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to offset the RefreshControl

I'm using the RefreshControl component in a list that scroll underneath a semi-transparent app-header-bar.

My only problem is that the RefreshControl appears underneath the semi-transparent header. What I really want is to be able to offset the y position of the RefreshControl so that it reveals directly below the app-header-bar.

I've tried using various style properties (marginTop, paddingTop, translateY), but nothing seems to do the job.

enter image description here

like image 918
wilsonpage Avatar asked May 25 '16 10:05

wilsonpage


People also ask

Which prop is used to set whether RefreshControl is refreshing or not?

RefreshControl Props onRefresh: This is a function that gets executed when refresh starts. This function should usually set refreshing to true when it starts and false once it completes. progressViewOffset: the top offset of the progress view. color [Android Only]: controls the color of the refresh indicator.

How do I automatically refresh a page in react native?

Fast Refresh is a React Native feature that allows you to get near-instant feedback for changes in your React components. Fast Refresh is enabled by default, and you can toggle "Enable Fast Refresh" in the React Native developer menu. With Fast Refresh enabled, most edits should be visible within a second or two.


1 Answers

According to this in IOS,

If you set a contentInset top to a scrollview, RefreshControl starts from that point.

In android you can use parameter 'progressViewOffset' to a value to achieve the same.

 <RefreshControl
        refreshing={this.state.isRefreshing}
        onRefresh={this._onRefresh}
        progressViewOffset={offset}
      />

This feature will be released in react-native version 0.27. Here is the commit which added support in android.

like image 55
Jickson Avatar answered Oct 19 '22 17:10

Jickson