Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set color of refresh indicator in FlatList #13392

Closed
ragnorc opened this issue Apr 7, 2017 · 6 comments
Closed

Set color of refresh indicator in FlatList #13392

ragnorc opened this issue Apr 7, 2017 · 6 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@ragnorc
Copy link

ragnorc commented Apr 7, 2017

With RefreshControl the color of the refresh indicator and some other props could be set. Is this still possible with FlatList?

@PARAGJYOTI
Copy link

Flatlist is just a higher component based on Virtualizedlist . Look at the source code here https://github.com/facebook/react-native/blob/master/Libraries/Lists/FlatList.js

So , in order to change the refreshControl color , set the property in the source code or add your own props to it . Run react-native start again to see the changes .

@PARAGJYOTI
Copy link

Sorry , you have to pass the props into Scrollview Component in VirtualizedList class . See https://github.com/facebook/react-native/blob/master/Libraries/Lists/VirtualizedList.js

@ragnorc ragnorc closed this as completed Apr 8, 2017
@MattyK14
Copy link

MattyK14 commented Apr 17, 2017

Would be useful if this was a part of the React-Native codebase.

EDIT: @ragnorc @PARAGJYOTI Seems you can pass your own RefreshControl to the FlatList and use the props that way.

Sample:

<FlatList
  data={this.props.rooms}
  renderItem={this._renderItem}
  keyExtractor={(item) => item.id}
  //ItemSeparatorComponent={this._renderSeparator}
  // onRefresh={this.onRefreshList.bind(this)}
  // refreshing={this.state.isRefreshing}
  refreshControl={
     <RefreshControl
         refreshing={this.state.isRefreshing}
         onRefresh={this.onRefreshList.bind(this)}
         title="Pull to refresh"
         tintColor="#fff"
         titleColor="#fff"
      />
   }
/>

Documentation: https://facebook.github.io/react-native/docs/refreshcontrol.html

@Jacse
Copy link

Jacse commented Jul 25, 2017

@MattyK14 does that still work? Can't find it documented anywhere, seems like RefreshControl provided by VirtualizedList takes precedence over passed props.

@MattyK14
Copy link

@Jacse I'm not on 0.46 yet, but as of 0.45.1 it still works.

@inifaisal
Copy link

just add colors props on RefreshControl
<RefreshControl refreshing={this.state.isRefreshing} onRefresh={this.onRefreshList.bind(this)} title="Pull to refresh" tintColor="#fff" titleColor="#fff" colors={["red", "green", "blue"]} />

@facebook facebook locked as resolved and limited conversation to collaborators May 24, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

6 participants