Nativebase: refreshControl in tab

Created on 16 Aug 2017  路  13Comments  路  Source: GeekyAnts/NativeBase

Hello, after add package (zo0r/react-native-push-notification or facebook/react-native-fbsdk) loading wheel hangs on the swipe
Version

"dependencies": {
        "native-base": "^2.3.1",
        "react": "16.0.0-alpha.12",
        "react-native": "0.47.1",
        "react-native-push-notification": "^3.0.0"
    }

Code page

import React, { Component } from 'react';
import { AppRegistry, RefreshControl } from 'react-native'
import { Container, Header, Content, Tab, Tabs } from 'native-base';
export default class AwesomeNativeBase extends Component {
    constructor(props) {
        super(props);
        this.state = {
            refreshing: false
        };
    }
    updateContent() {
        this.setState({refreshing:true});
        setTimeout(()=>{
            this.setState({refreshing:false});
        },2000);
    }
    render() {
        return (
            <Container>
                <Header hasTabs />
                <Tabs initialPage={1}>
                    <Tab heading="Tab1">
                        <Content refreshControl={<RefreshControl
                            refreshing={this.state.refreshing}
                            onRefresh={()=>{this.updateContent()}}/>
                        }>
                        </Content>
                    </Tab>
                    <Tab heading="Tab2">
                        <Content refreshControl={<RefreshControl
                            refreshing={this.state.refreshing}
                            onRefresh={()=>{this.updateContent()}}/>
                        }>
                        </Content>
                    </Tab>
                    <Tab heading="Tab3">
                        <Content refreshControl={<RefreshControl
                            refreshing={this.state.refreshing}
                            onRefresh={()=>{this.updateContent()}}/>
                        }>
                        </Content>
                    </Tab>
                </Tabs>
            </Container>
        );
    }
}
AppRegistry.registerComponent('AwesomeNativeBase', () => AwesomeNativeBase);

tab_bah

awaiting response

Most helpful comment

@lmichailian the only fix is using react-native-tab-view

All 13 comments

It's because you drag the tab into another tab while pulling the refresh trigger down. My workaround is to disable the sliding part or if you insist of doing the sliding refresh, you must check react-native-tab-view.

@Martin25699 As @sitompul said, you are trying to change the Tabs while the refresh is triggered of one page, and both the Tabs have their own refresh functions. You can either lock the swipe functionality or use onChangeTab prop function and page prop to detect and trigger the refresh of the changed tab on swipe

@shivrajkumar this problem does not occur if these packages are not installed (zo0r / react-native-push-notification or facebook / react-native-fbsdk), as I wrote above. Can error somewhere else?

@Martin25699 Do you have any handles of those packages being called while changing the tab?

@shivrajkumar No, these packages are only connected to the project, and made react-native link. In this example, they are not needed, but are needed on the project, where the error is repeated.

@Martin25699 tried your example without react-native-push-notification. Did not feel like the issue is with the package. You can try shivraj's suggestion. Let us know if you face any issues.

Closing the issue due to no response

Same issue. I do not have react-native-push-notification nor react-native-fbsdk packages.
It's impossible to have refreshcontrol with tabs.. Each time you try to to pull to refresh you automatically swipe :-(

@camel113 please use react-native-tab-view to handle your refreshissue

Same problem, any responses to this issue ?

@lmichailian the only fix is using react-native-tab-view

@sitompul another lib, sad ... :(

react-native-tab-view doesn't have dynamic width on each tab, but your tabs can handle that. So anyone was resolve this?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maphongba008 picture maphongba008  路  3Comments

georgemickael-b picture georgemickael-b  路  3Comments

sihemhssine picture sihemhssine  路  3Comments

Landerson352 picture Landerson352  路  3Comments

Bundas picture Bundas  路  3Comments