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.

[FlatList] FlatList rows are rendered,but it's white.

See original GitHub issue
<ScrollView
                    refreshControl={
                                <RefreshControl
                                    refreshing={this.state.isRefreshing}
                                    onRefresh={this._onRefresh.bind(this)}
                                     tintColor="#192c4d"
                                     title="  refresh......."
                                     titleColor={'red'}
                                 />}
                    onScroll={this._onScroll.bind(this)}
                    style={{ flex: 1, backgroundColor:'white',marginTop:-20}}>
                    {this.renderHeader()}
                    <View style={{ flex: 1}}>
                        < FlatList
                            key={(this.state.horizontal ? 'h' : 'v')}
                            ref={this.listRef.bind(this)}
                            style={{ flex: 1,  backgroundColor: 'white' }}
                            renderItem={this.renderItem.bind(this)}
                            itemHeight={PIC_ITEM_HEIGHT}
                            renderHeader={this.state.awardHeader&&this.state.awardHeader.isReceive==0?this.renderListHeader.bind(this):undefined}
                            numberOfRow={(this.state.horizontal ? 3 : 1)}
                    }
                            onRefresh={this.onRefresh.bind(this)}
                            onEndReached={this.onInfinite.bind(this)}
                            initialNumToRender={12}
                            removeClippedSubviews={false}
                        >
                        </FlatList>
                    </View>
                </ScrollView>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
JaxGitcommented, Feb 12, 2018

@RyanRong @gonzalezchris I ran into the same issue on Android and finally found the solution for it:

Do NOT apply style (especially with backgroundColor) to FlatList itself, apply to its wrapper instead.

If you try to apply a red backgroundColor to FlatList, after pull-to-refresh you can actually see a big red screen without any content displaying, while all the invisible contents are actually underneath and accepting tap etc.

So it might be because of a bug about zIndex after pull-to-refresh, which is working well on iOS.

BTW, it seems that styles like padding are not working so well on Android if directly applied to FlatList as well.

0reactions
ddxxtonycommented, May 16, 2018

the solution of @JaxGit works

Read more comments on GitHub >

github_iconTop Results From Across the Web

[FlatList] Sometimes FlatList rows are rendered, but not ...
Description When using FlatList, rows are not displayed though renderItem is called. ... FlatList should always display its rendered items.
Read more >
A lot of white space between items of a flat list in react native
In your FlatList just remove these properties and the space of above & below the first and last items ... You have to...
Read more >
react native flatlist infinite loop - You.com | The AI Search ...
Flatlist or VirtualizedList Scroll lags horribly after 30-40 rows . I am fetching the same data on onEndReached . Upto 30 rows its...
Read more >
react-native-timeline-flatlist - npm
React Native Timeline Flatlist. npm version Platform. Timeline component for React Native App work for Android and iOS. It's a fork of ...
Read more >
FlatList - React Native
FlatList. A performant interface for rendering basic, flat lists, supporting the most handy features: Fully cross-platform.
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