netinfo
获得Network Connection type、Network Connection quality
NetInfoState
- type :
NetInfoStateType - isConnected:
boolean,null - isInternetReachable:
boolean,null - isWifiEnabled:
boolean, (Android only) - details:The value depends on the
typevalue.
NetInfoStateType
NetInfoCellularGeneration
描述 蜂窝网络 ,值 有:null、2g、3g、4g、5g
configure()
使用给定配置配置库。您只需提供要从默认值更改的属性。
请注意,调用此将停止再次调用以前添加的 listeners。It is best to call this right when your application is started to avoid issues.
addEventListener()
订阅连接信息。每当连接状态更改时,通过NetInfostate类型的参数调用回调。
useNetInfo()
A React Hook which can be used to get access to the latest state. It returns a hook with the
[NetInfoState](https://github.com/react-native-netinfo/react-native-netinfo/blob/HEAD/README.md#netinfostate)type.
fetch()
Returns a
Promisethat resolves to a[NetInfoState](https://github.com/react-native-netinfo/react-native-netinfo/blob/6b01fee211df160d0afce70c5955681c75b24a5a/README.md#netinfostate)object.