有没有办法在react-native中完全刷新整个场景而不更新状态或强制重新渲染?
例如:
refreshButton(){
Actions.refresh()
}
P.S:我使用react-native-router-flux作为我的导航器。我确实尝试了Actions.refresh({key: "page_name"})
,但它没有用。
答案 0 :(得分:0)
import { NetInfo } from 'react-native';
// component did mount
NetInfo.isConnected.addEventListener(
'change',
this._handleConnectivityChange
);
_handleConnectivityChange = (isConnected) => {
this.setState({
isConnected,
});
};
// remove listener on componentWillUnmount
更多信息here