@@ -9,12 +9,14 @@ import { View, StyleSheet } from 'react-native';
99import { observer } from 'mobx-react' ;
1010import { NavigationEvents } from 'react-navigation' ;
1111import NetInfo from '@react-native-community/netinfo' ;
12+ import type { ConnectionType } from '@react-native-community/netinfo' ;
1213
1314import { NavigatorBar , LoadingSpinner , ErrorView } from '../index' ;
1415import { Theme } from 'teaset' ;
16+ import { ConfigStore } from '../../store/ConfigStore' ;
1517
1618type Props = {
17- store ?: Object , // 页面中的mobx状态
19+ store ?: ConfigStore , // 页面中的mobx状态
1820 onErrorPress ?: Function , // 出错页面的点击事件
1921 navBar ?: any , // 导航条
2022 children ?: any ,
@@ -58,6 +60,7 @@ type State = {
5860class BaseContainer extends Component < Props , State > {
5961 netInfoListen : any ;
6062 componentWillUnmount ( ) {
63+ this . props . store && this . props . store . hideLoading ( ) ;
6164 this . netInfoListen && NetInfo . removeEventListener ( 'connectionChange' , this . networkHandle ) ;
6265 }
6366
@@ -72,7 +75,7 @@ class BaseContainer extends Component<Props, State> {
7275 }
7376 } ;
7477
75- networkHandle = ( netInfo : NetType ) = > {
78+ networkHandle = ( netInfo : any ) = > {
7679 const { netInfoCallBack } = this . props ;
7780 const network : NetType = this . getNetInfoStatus ( netInfo ) ;
7881
@@ -82,7 +85,7 @@ class BaseContainer extends Component<Props, State> {
8285 } ;
8386
8487 getNetInfoStatus = ( netInfo : any ) => {
85- const type : string = netInfo . type ;
88+ const type : ConnectionType = netInfo . type ;
8689 return {
8790 isConnect : type . toUpperCase ( ) === 'WIFI' || type . toUpperCase ( ) === 'CELLULAR' ,
8891 isWifi : type . toUpperCase ( ) === 'WIFI' ,
0 commit comments