Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16554

React native - When i lock the screen while API call loading, App process stopped

$
0
0

I am trying to show a large list in react native - Expo. When i lock the screen while data loading via API. App State changed from "Active" to "Inactive". When i return to active state, no data has been loaded. The App processes are stopped. ListEmptyComponent renders the ActivityIndicator. It is loading indefinitely. It occurs only in android build.

I tried to recall the API by AppState.

  const handleAppStateChange = nextAppState => {
    console.log(nextAppState);   
    if (nextAppState === 'active') {
      console.log(JSON.stringify(Store.apiCall));
      // "Store.apiCall" has data about last API Call and its status.
      if (Store.apiCall.status === codes.PENDING || Store.apiCall.status === codes.ERROR) {
        api(Store.apiCall.payload);
      }
    }
    setAppState(nextAppState);
  };

Still it doesn't works..


Viewing all articles
Browse latest Browse all 16554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>