What's the equivalent of window.reload() in react-native?

1k views Asked by At

Is there a way to completely refresh an entire scene in react-native without updating the state or forcing a re-render?

For example:

refreshButton(){
    Actions.refresh()
}

P.S: I am using react-native-router-flux as my navigator. I did try Actions.refresh({key: "page_name"}) but it did not work.

1

There are 1 answers

0
Ahmed Ali On
import { NetInfo } from 'react-native';
// component did mount
NetInfo.isConnected.addEventListener(
    'change',
    this._handleConnectivityChange
);

_handleConnectivityChange = (isConnected) => {
this.setState({
  isConnected,
});
};
// remove listener on componentWillUnmount

more info here