We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f91b35a + 111c958 commit 3fd2d77Copy full SHA for 3fd2d77
AppCacheUtil.js
@@ -1,5 +1,5 @@
1
'use strict'
2
-import { NativeModules,Platform } from 'react-native';
+import { NativeModules,Platform, NetInfo } from 'react-native';
3
4
const { RNNeteaseIm } = NativeModules;
5
@@ -21,8 +21,16 @@ export default class AppCacheUtil{
21
/**
22
* 获取网络状态
23
*/
24
- static getNetWorkStatus(){//0:无网络,1:有网络
25
- return RNNeteaseIm.getNetWorkStatus();
+ static networkIsConnected(){//0:无网络,1:有网络
+ if(Platform.OS === 'ios'){
26
+ if(RNNeteaseIm.getNetWorkStatus() === '1'){
27
+ return true;
28
+ }
29
+ return false;
30
+ }else{
31
+ return NetInfo.isConnected.fetch().done();
32
33
}
34
+
35
36
0 commit comments