Expo standalone apk fetch data request not work sometimes

“sdkVersion”: “33.0.0”
“android”

application start and showing activity indicator, because isLoading = true, but when I turn off wifi and turn on fetch data works.
(this code works fine in expo client, not work on apk app)

constructor(props) {
        super(props);
        this.state = {
            isConnected: true,
            AllInstancesData: [],
            isLoading: true,
            fontLoaded: false,
            refreshing: false,
            highlightColor: '#ffffff',
        };
        this.checkNetStatus();
}

async checkNetStatus() {
        const netStatus = await NetInfo.isConnected.fetch();
        if (netStatus) {
            this.setState({
                isConnected: true,
            })
            this.getServers(); 
        } else {
            this.setState({
                isConnected: false,
            })
        }
 }

componentWillUnmount() {
        NetInfo.isConnected.removeEventListener('connectionChange', this.handleConnectivityChange);
}

handleConnectivityChange = isConnected => {
        if (isConnected) {
            this.setState({ 
                isConnected,
            });
            this.getServers();
        } else {
            this.setState({ isConnected });
        }
 }


getServers = () => {
        Backend.getInstanceData().then( (responseData) => {
            if (responseData.status) {
                this.setState({
                    isLoading: false,
                    refreshing: false,
                    AllInstancesData: responseData.__data.instances,
                })    
            } else {
                this.setState({
                    isLoading: false,
                    refreshing: false,
                })
                Alert.alert(
                    'Error',
                    responseData.message,
                    [
                      {text: 'OK',},
                    ],
                    {cancelable: false},
                );
            }
        });
    }

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.