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

How to detect an application in the kill app on react native?

$
0
0

I want to change the state data from the API when the application is killed by the user.

I have tried using the componentWillUnmount to change data when the application closes, I also use the AppState

  _handleAppStateChange = (nextAppState) => {
    if (
      this.state.appState.match(/inactive|background/) &&
      nextAppState === 'active'
    ) {
      console.log('App has come to the foreground!')
    }
    this.setState({ appState: nextAppState })
  }


I want that when the application is killed by the user, it can change the state automatically.


Viewing all articles
Browse latest Browse all 29438

Trending Articles



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