Fix NetInfo RN 0.49 deprecation

This commit is contained in:
Chris Bianca 2017-10-03 15:54:03 +01:00
parent 459b03464d
commit c1ecf22a38
1 changed files with 2 additions and 2 deletions

View File

@ -31,7 +31,7 @@ class CoreContainer extends React.Component {
NetInfo.isConnected.fetch().then((isConnected) => {
this.handleAppStateChange('active'); // Force connect (react debugger issue)
this.props.dispatch(setNetworkState(isConnected));
NetInfo.isConnected.addEventListener('change', this.handleNetworkChange);
NetInfo.isConnected.addEventListener('connectionChange', this.handleNetworkChange);
});
}
@ -40,7 +40,7 @@ class CoreContainer extends React.Component {
*/
componentWillUnmount() {
AppState.removeEventListener('change', this.handleAppStateChange);
NetInfo.isConnected.removeEventListener('change', this.handleNetworkChange);
NetInfo.isConnected.removeEventListener('connectionChange', this.handleNetworkChange);
}
props: Props;