diff --git a/zh-cn/react-native-community-netinfo.md b/zh-cn/react-native-community-netinfo.md index 2ae2054effcf4e81eaf8f70d65317a683c8fd362..ca0f6fcfd1bc882dc180d5e35c59045425f6a91a 100644 --- a/zh-cn/react-native-community-netinfo.md +++ b/zh-cn/react-native-community-netinfo.md @@ -1,4 +1,3 @@ - > 模板版本:v0.2.2
@@ -97,7 +96,7 @@ export default App;
"dependencies": {
"@rnoh/react-native-openharmony": "file:../react_native_openharmony",
- "rnoh-netinfo": "file:../../node_modules/@react-native-oh-tpl/netinfo/harmony/netinfo.har"
+ "@react-native-oh-tpl/netinfo": "file:../../node_modules/@react-native-oh-tpl/netinfo/harmony/netinfo.har"
}
```
@@ -122,15 +121,15 @@ ohpm install
project(rnapp)
cmake_minimum_required(VERSION 3.4.1)
set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
++ set(OH_MODULE "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
add_subdirectory("${RNOH_CPP_DIR}" ./rn)
-# RNOH_BEGIN: add_package_subdirectories
+# RNOH_BEGIN: manual_package_linking_1
add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
-+ add_subdirectory("${OH_MODULE_DIR}/rnoh-netinfo/src/main/cpp" ./netinfo)
-# RNOH_END: add_package_subdirectories
++ add_subdirectory("${OH_MODULE}/@react-native-oh-tpl/netinfo/src/main/cpp" ./netinfo)
+# RNOH_END: manual_package_linking_1
add_library(rnoh_app SHARED
"./PackageProvider.cpp"
@@ -139,10 +138,10 @@ add_library(rnoh_app SHARED
target_link_libraries(rnoh_app PUBLIC rnoh)
-# RNOH_BEGIN: link_packages
+# RNOH_BEGIN: manual_package_linking_2
target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
+ target_link_libraries(rnoh_app PUBLIC rnoh_netinfo)
-# RNOH_END: link_packages
+# RNOH_END: manual_package_linking_2
```
打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
@@ -169,7 +168,7 @@ std::vector
Defaults to null on most platforms for unknown networks.
Note: Web browsers report network type unknown for many otherwise valid networks (https://caniuse.com/netinfo),
so isConnected may be true or false and represent a real connection status even for unknown network types in certain cases. | boolean, null | yes | iOS Android | yes |
+| `isInternetReachable` | If the internet is reachable with the currently active network connection.
If unknown defaults to null | boolean, null | yes | iOS Android | yes |
+| `isWifiEnabled` | (Android only) Whether the device's WiFi is ON or OFF. | boolean | yes | iOS Android | yes |
+| `details` | The value depends on the type value. See below. | | yes | iOS Android | yes |
### Details
-#### Type is none or unknown
-
-`details` is `null`.
-
#### Type is wifi
-| Name | Description | Type | Required | Platform | HarmonyOS Support |
-| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -------- | ---------------------------------- | ----------------- |
-| `isConnectionExpensive` | If the network connection is considered "expensive". This could be in either energy or monetary terms. | boolean | yes | All | yes |
-| `ssid` | The SSID of the network. May not be present, null, or an empty string if it cannot be determined. On iOS, your app must meet at least one of the following requirements and you must set the shouldFetchWiFiSSID configuration option or no attempt will be made to fetch the SSID. On Android, you need to have the ACCESS_FINE_LOCATION permission in your AndroidManifest.xml and accepted by the user. | string | yes | Android, iOS (not tvOS), Windows | yes |
-| `bssid` | The BSSID of the network. May not be present, null, or an empty string if it cannot be determined. On iOS, make sure your app meets at least one of the following requirements. On Android, you need to have the ACCESS_FINE_LOCATION permission in your AndroidManifest.xml and accepted by the user. | string | yes | Android, iOS (not tvOS), Windows\* | yes |
-| `strength` | An integer number from 0 to 100 for the signal strength. May not be present if the signal strength cannot be determined. | number | yes | Android, Windows | yes |
-| `ipAddress` | The external IP address. Can be in IPv4 or IPv6 format. May not be present if it cannot be determined. | string | yes | Android, iOS, macOS, Windows | yes |
-| `subnet` | The subnet mask in IPv4 format. May not be present if it cannot be determined. | string | yes | Android, iOS, macOS | yes |
-| `frequency` | Network frequency. Example: For 2.4 GHz networks, the method will return 2457. May not be present if it cannot be determined. | number | yes | Android, Windows\* | yes |
-| `linkSpeed` | The link speed in Mbps. | number | yes | Android | yes |
-| `rxLinkSpeed` | The current receive link speed in Mbps. | number | yes | Android | yes |
-| `txLinkSpeed` | The current transmit link speed in Mbps. | number | yes | Android | yes |
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+|-------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|----------|-------------|-------------------|
+| `isConnectionExpensive` | If the network connection is considered "expensive".
This could be in either energy or monetary terms. | boolean | yes | iOS Android | yes |
+| `ssid` | The SSID of the network.
May not be present, null, or an empty string if it cannot be determined.
On iOS, your app must meet at least one of the following requirements and you must set the shouldFetchWiFiSSID configuration option or no attempt will be made to fetch the SSID.
On Android, you need to have the ACCESS_FINE_LOCATION permission in your AndroidManifest.
xml and accepted by the user. | string | yes | iOS Android | yes |
+| `bssid` | The BSSID of the network.
May not be present, null, or an empty string if it cannot be determined.
On iOS, make sure your app meets at least one of the following requirements.
On Android, you need to have the ACCESS_FINE_LOCATION permission in your AndroidManifest.
xml and accepted by the user. | string | yes | iOS Android | yes |
+| `strength` | An integer number from 0 to 100 for the signal strength.
May not be present if the signal strength cannot be determined. | number | yes | Android | yes |
+| `ipAddress` | The external IP address. Can be in IPv4 or IPv6 format.
May not be present if it cannot be determined. | string | yes | iOS Android | yes |
+| `subnet` | The subnet mask in IPv4 format.
May not be present if it cannot be determined. | string | yes | iOS Android | yes |
+| `frequency` | Network frequency. Example: For 2.4 GHz networks, the method will return 2457.
May not be present if it cannot be determined. | number | yes | Android | yes |
+| `linkSpeed` | The link speed in Mbps. | number | yes | Android | yes |
+| `rxLinkSpeed` | The current receive link speed in Mbps. | number | yes | Android | yes |
+| `txLinkSpeed` | The current transmit link speed in Mbps. | number | yes | Android | yes |
#### Type is cellular
-| Name | Description | Type | Required | Platform | HarmonyOS Support |
-| ----------------------- | --------------------------------------------------------------------------------------------------------------------- | :-----------------------: | :------: | :-------------------: | :---------------: |
-| `isConnectionExpensive` | If the network connection is considered "expensive". This could be in either energy or monetary terms. | boolean | yes | All | no |
-| `cellularGeneration` | The generation of the cell network the user is connected to. This can give an indication of speed, but no guarantees. | NetInfoCellularGeneration | yes | Android, iOS, Windows | no |
-| `carrier` | The network carrier name. May not be present or may be empty if none can be determined. | +string | yes | Android, iOS | no |
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+|-------------------------|-----------------------------------------------------------------------------------------------------------------------|:-------------------------:|:--------:|:-----------:|:-----------------:|
+| `isConnectionExpensive` | If the network connection is considered "expensive". This could be in either energy or monetary terms. | boolean | yes | iOS Android | no |
+| `cellularGeneration` | The generation of the cell network the user is connected to. This can give an indication of speed, but no guarantees. | NetInfoCellularGeneration | yes | iOS Android | no |
+| `carrier` | The network carrier name. May not be present or may be empty if none can be determined. | +string | yes | iOS Android | no |
#### Type is bluetooth, ethernet, wimax, vpn, or other
-| Name | Description | Type | Required | Platform | HarmonyOS Support |
-| ----------------------- | ------------------------------------------------------------------------------------------------------ | :-----: | :------: | :------: | :---------------: |
-| `isConnectionExpensive` | If the network connection is considered "expensive". This could be in either energy or monetary terms. | boolean | yes | All | no |
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+|-------------------------|-------------------------------------------------------------------------------------------------------------|:-------:|:--------:|:-----------:|:-----------------:|
+| `isConnectionExpensive` | If the network connection is considered "expensive".
This could be in either energy or monetary terms. | boolean | yes | iOS Android | no |
## 静态方法
-| Name | Description | Type | Required | Platform | HarmonyOS Support |
-| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------: | :------: | :------: | :---------------: |
-| `fetch()` | Returns a Promise that resolves to a NetInfoState object. | function | yes | All | yes |
-| `refresh()` | Updates NetInfo's internal state, then returns a Promise that resolves to a NetInfoState object. This is similar to fetch(), but really only useful on platforms that do not supply internet reachability natively. For example, you can use it to immediately re-run an internet reachability test if a network request fails unexpectedly. | function | yes | All | yes |
-| `addEventListener()` | Subscribe to connection information. The callback is called with a parameter of type NetInfoState whenever the connection state changes. Your listener will be called with the latest information soon after you subscribe and then with any subsequent changes afterwards. You should not assume that the listener is called in the same way across devices or platforms. | function | yes | All | yes |
-| `useNetInfo()` | A React Hook which can be used to get access to the latest state from the global instance. It returns a hook with the NetInfoState type. | function | yes | All | yes |
-| `useNetInfoInstance()` | A React Hook which can be used to create and manage an isolated instance of a network manager class. It returns a refresh function and the current NetInfoState. | function | yes | All | yes |
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:--------:|:--------:|:-----------:|:-----------------:|
+| `fetch()` | Returns a Promise that resolves to a NetInfoState object. | function | yes | iOS Android | yes |
+| `refresh()` | Updates NetInfo's internal state, then returns a Promise that resolves to a NetInfoState object.
This is similar to fetch(), but really only useful on platforms that do not supply internet reachability natively.
For example, you can use it to immediately re-run an internet reachability test if a network request fails unexpectedly. | function | yes | iOS Android | yes |
+| `addEventListener()` | Subscribe to connection information.
The callback is called with a parameter of type NetInfoState whenever the connection state changes.
Your listener will be called with the latest information soon after you subscribe and then with any subsequent changes afterwards.
You should not assume that the listener is called in the same way across devices or platforms. | function | yes | iOS Android | yes |
+| `useNetInfo()` | A React Hook which can be used to get access to the latest state from the global instance.
It returns a hook with the NetInfoState type. | function | yes | iOS Android | yes |
+| `useNetInfoInstance()` | A React Hook which can be used to create and manage an isolated instance of a network manager class.
It returns a refresh function and the current NetInfoState. | function | yes | iOS Android | yes |
## 遗留问题
@@ -293,5 +288,3 @@ RNOH:0.72.27; SDK:HarmonyOS-Next-DB1 5.0.0.29(SP1) ; IDE:DevEco Studio 5.0
## 开源协议
本项目基于 [The MIT License (MIT)](https://github.com/react-native-netinfo/react-native-netinfo/blob/master/LICENSE) ,请自由地享受和参与开源。
-
-
\ No newline at end of file
diff --git a/zh-cn/react-native-screens.md b/zh-cn/react-native-screens.md
index fc118f1bbb05a00f66fd4895c136d18b70f7db0b..a7a317e0e2bb1f317974700367088251043138f2 100644
--- a/zh-cn/react-native-screens.md
+++ b/zh-cn/react-native-screens.md
@@ -1,5 +1,4 @@
-
-> 模板版本:v0.1.3
+> 模板版本:v0.2.2
@@ -8,11 +7,13 @@
react-native-screens
-
+