question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pull to Refresh does not work when FlatList nested inside <Content>

See original GitHub issue

I am on react-native 0.53.3 and native-base 2.3.9.

I am using FlatList from react-native because some of the features which are not readily available in native-base’s List component. And there is this one issue I am not able to solve.

The FlatList api of react-native provides native pull to refresh ability. While it works perfectly when FlatList is embedded inside <View>, it doesn’t work if I nest it inside <Content>, pulling would simply do nothing.

I suspect this has something to do with margin and other styling elements because if you simply nest FlatList inside <Content>, the top and bottom margin won’t fit perfect and you will have to use padding/margin styling to make the FlatList not go out of the view port.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

48reactions
kstoltecommented, Apr 30, 2018

I also ran into this. Resolved it on my side by making the

import { StyleSheet, RefreshControl } from 'react-native';

...
render(
  <Content refreshControl={<RefreshControl refreshing={this.state.refreshing} onRefresh={this._onRefresh.bind(this)} />}>
       <List .../>
      </Content>
...
)
7reactions
Aabir1commented, May 18, 2019

I have the same problem and I fixed it By <Content padder contentContainerStyle={{ flex: 1 }}>

Read more comments on GitHub >

github_iconTop Results From Across the Web

React-Native: FlatList onRefresh not called on pull up.
Current Behavior: I'm trying to update a list gotten from a server by pulling up on the view. When I do the onRefresh...
Read more >
Displaying a List in React Native: Map Method or FlatList ...
In this article, I'll walk you through using two methods of listing data in a React Native app: displaying the list with map...
Read more >
Optimizing Flatlist Configuration - React Native
Use basic components​. The more complex your components are, the slower they will render. Try to avoid a lot of logic and nesting...
Read more >
SectionList - React Native
SectionList. A performant interface for rendering sectioned lists, supporting the most handy features: Fully cross-platform.
Read more >
FlatList - React Native
flatlist-selectable · Internal state is not preserved when content scrolls out of the render window. · This is a PureComponent which means that...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found