Phecda

feat: add RNCNetInfo

... ... @@ -233,6 +233,8 @@ PODS:
- React-cxxreact (= 0.62.1)
- React-jsi (= 0.62.1)
- React-jsinspector (0.62.1)
- react-native-netinfo (5.7.1):
- React
- react-native-safe-area-context (0.7.3):
- React
- react-native-webview (9.1.1):
... ... @@ -340,6 +342,7 @@ DEPENDENCIES:
- React-jsi (from `../node_modules/react-native/ReactCommon/jsi`)
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-webview (from `../node_modules/react-native-webview`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
... ... @@ -408,6 +411,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/jsiexecutor"
React-jsinspector:
:path: "../node_modules/react-native/ReactCommon/jsinspector"
react-native-netinfo:
:path: "../node_modules/@react-native-community/netinfo"
react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context"
react-native-webview:
... ... @@ -479,6 +484,7 @@ SPEC CHECKSUMS:
React-jsi: 600d8e42510c3254fd2abd702f4b9d3f598d8f52
React-jsiexecutor: e9698dee4fd43ceb44832baf15d5745f455b0157
React-jsinspector: f74a62727e5604119abd4a1eda52c0a12144bcd5
react-native-netinfo: 4fa023c153d582aeae8435df95c9a975c5986449
react-native-safe-area-context: e200d4433aba6b7e60b52da5f37af11f7a0b0392
react-native-webview: 0633fd7861a9bd7a80bacaee7da763c3afc248fa
React-RCTActionSheet: af8f28dd82fec89b8fe29637b8c779829e016a88
... ...
... ... @@ -16,6 +16,7 @@
"@huse/previous-value": "^1.0.1",
"@react-native-community/art": "^1.2.0",
"@react-native-community/masked-view": "^0.1.7",
"@react-native-community/netinfo": "^5.7.1",
"@react-navigation/bottom-tabs": "^5.2.5",
"@react-navigation/drawer": "^5.4.0",
"@react-navigation/material-top-tabs": "^5.1.7",
... ...
import React from 'react';
import { useWindowDimensions } from 'react-native';
import { screensEnabled } from 'react-native-screens';
import { useNetInfo } from '@react-native-community/netinfo';
import { ListItem, BGScroll, Card, Divider } from '../component/View';
import { MainTabScreenProps } from '../type/Navigation';
import { useI18nStrings } from '../i18n';
... ... @@ -12,6 +13,7 @@ const SystemInfo = ({
route,
}: MainTabScreenProps<'SystemInfo'>) => {
const strings = useI18nStrings();
const netInfo = useNetInfo();
const { width, height, fontScale, scale } = useWindowDimensions();
return (
<BGScroll white>
... ... @@ -45,6 +47,21 @@ const SystemInfo = ({
/>
</Card>
<Card shadow>
<ListItem title="type" rightTitle={netInfo.type} />
<Divider />
<ListItem
title="isInternetReachable"
rightTitle={`${netInfo.isInternetReachable}`}
/>
<Divider />
<ListItem title="isConnected" rightTitle={`${netInfo.isConnected}`} />
<Divider />
<ListItem
title="details"
rightTitle={JSON.stringify(netInfo.details)}
/>
</Card>
<Card shadow>
<ListItem
title="RNDeviceInfo"
onPress={() => navigation.navigate('RNDeviceInfoList')}
... ...
... ... @@ -1170,6 +1170,11 @@
resolved "https://registry.npm.taobao.org/@react-native-community/masked-view/download/@react-native-community/masked-view-0.1.7.tgz#a65ce0702f55cb67fd777995de6fc7b3e5781903"
integrity sha1-plzgcC9Vy2f9d3mV3m/Hs+V4GQM=
"@react-native-community/netinfo@^5.7.1":
version "5.7.1"
resolved "https://registry.npm.taobao.org/@react-native-community/netinfo/download/@react-native-community/netinfo-5.7.1.tgz#715a6061307055c6aa59c901bca313050695f75e"
integrity sha1-cVpgYTBwVcaqWckBvKMTBQaV914=
"@react-navigation/bottom-tabs@^5.2.5":
version "5.2.5"
resolved "https://registry.npm.taobao.org/@react-navigation/bottom-tabs/download/@react-navigation/bottom-tabs-5.2.5.tgz#d434dbf99bd963005d13d05eec3558ae12b9f1af"
... ...