最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - React Native ScrollViewListView RefreshControl intitially ugly on top right - Stack Overflow

programmeradmin5浏览0评论

I'm having a RefreshControl attached to a ScrollView. It all works as expected but initially (when I didn't start scrolling), there's always showing a RefreshControl on the top right. When I start scrolling, it disappears.

Any idea how to get rid of that?

Code is nothing special, if you want, i'll give it here:

// ...
export default class SomeList extends React.Component
{
    // ...
    render() {
        return <View style={{flex: 1}}>
            <CustomNavbar />
            <ScrollView 
                style={{marginTop: 35}}
                refreshControl={
                    <RefreshControl
                        tintColor={$.config.colors.style}
                        onRefresh={() => this._refreshList()}
                        refreshing={this.state.listRefreshing}
                    />
                }
            >
                {this._renderItems()}
            </ScrollView>
        </View>
    }
}

I'm having a RefreshControl attached to a ScrollView. It all works as expected but initially (when I didn't start scrolling), there's always showing a RefreshControl on the top right. When I start scrolling, it disappears.

Any idea how to get rid of that?

Code is nothing special, if you want, i'll give it here:

// ...
export default class SomeList extends React.Component
{
    // ...
    render() {
        return <View style={{flex: 1}}>
            <CustomNavbar />
            <ScrollView 
                style={{marginTop: 35}}
                refreshControl={
                    <RefreshControl
                        tintColor={$.config.colors.style}
                        onRefresh={() => this._refreshList()}
                        refreshing={this.state.listRefreshing}
                    />
                }
            >
                {this._renderItems()}
            </ScrollView>
        </View>
    }
}

Share Improve this question edited Oct 7, 2019 at 11:33 Glorfindel 22.7k13 gold badges90 silver badges119 bronze badges asked Oct 28, 2016 at 14:44 DennisDennis 9361 gold badge10 silver badges22 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

This is a bug in react-native which was introduced in version 0.31 or so. It was fixed in version 0.34.1 (see this mit), so I guess you're using a previous version.

If you do not wish to upgrade, you can temporarily solve it by settings the background color of the refresh control to transparent: <RefreshControl style={{backgroundColor: 'transparent'}}/>

发布评论

评论列表(0)

  1. 暂无评论