You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CONTRIBUTING.md
+1
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,7 @@ Currently we use `flow` for typechecking, `eslint` with `prettier` for linting a
19
19
*`yarn test:jest`: Run unit tests with `jest`.
20
20
*`yarn test:detox:<android|ios>:build:<debug|release>`: Build the `debug` or `release` app for end-to-end tests with `detox` on either `android` or `ios`. You need to run this before running the test command and whenever you make changes to the native code.
21
21
*`yarn test:detox:<android|ios>:test:<debug|release>`: Run the `debug` or `release` end-to-end tests with `detox` on either `android` or `ios`.
22
+
*`yarn test:e2e:macos`: Run the end-to-end tests for macOS.
Copy file name to clipboardexpand all lines: README.md
+43-26
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
2
2
# `@react-native-community/netinfo`
3
3
4
-
[](https://circleci.com/gh/react-native-community/workflows/react-native-netinfo/tree/master)[](https://github.com/facebook/react-native/issues/23313)
4
+
[](https://circleci.com/gh/react-native-community/workflows/react-native-netinfo/tree/master)[](https://github.com/facebook/react-native/issues/23313)
5
5
6
-
React Native Network Info API for Android, iOS & Windows. It allows you to get information on:
6
+
React Native Network Info API for Android, iOS, macOS & Windows. It allows you to get information on:
7
7
8
8
* Connection type
9
9
* Connection quality
@@ -61,6 +61,10 @@ Linking the package manually is not required anymore with [Autolinking](https://
61
61
}
62
62
```
63
63
64
+
-**macOS Platform:**
65
+
66
+
Autolinking is not yet available on macOS. See the [Manual linking steps for macOS](#manual-linking-macos) below.
67
+
64
68
#### Using React Native < 0.60
65
69
66
70
You then need to link the native parts of the library for the platforms you are using. The easiest way to link the library is using the CLI tool by running this command from the root of your project:
@@ -82,6 +86,19 @@ pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/ne
82
86
83
87
</details>
84
88
89
+
<detailsid='manual-linking-macos'>
90
+
<summary>Manually link the library on macOS</summary>
91
+
92
+
1. Open your project `.xcodeproj` on xcode.
93
+
94
+
2. Right click on the Libraries folder and select `Add files to "yourProjectName"`.
95
+
96
+
3. Add `RNCNetInfo.xcodeproj` (located at `node_modules/@react-native-community/react-native-netinfo/macos`) to your project Libraries.
97
+
98
+
4. Go to `Build Phases -> Link Binary with Libraries` and add: `libRNCNetInfo-macOS.a`.
99
+
100
+
</details>
101
+
85
102
<details>
86
103
<summary>Manually link the library on Android</summary>
87
104
@@ -221,7 +238,7 @@ Describes the current state of the network. It is an object with these propertie
221
238
|`type`|[`NetInfoStateType`](#netinfostatetype)| The type of the current connection. |
222
239
|`isConnected`|`boolean`| If there is an active network connection. Note that this DOES NOT mean that internet is reachable. |
223
240
|`isInternetReachable`|`boolean`| If the internet is reachable with the currently active network connection. |
224
-
|`isWifiEnabled`|`boolean`|*(Android only)* Whether the device's WiFi is ON or OFF.|
241
+
|`isWifiEnabled`|`boolean`|*(Android only)* Whether the device's WiFi is ON or OFF.|
225
242
|`details`|| The value depends on the `type` value. See below. |
226
243
227
244
The `details` value depends on the `type` value.
@@ -234,23 +251,23 @@ The `details` value depends on the `type` value.
|`isConnectionExpensive`| Android, iOS, Windows, Web|`boolean`| If the network connection is considered "expensive". This could be in either energy or monetary terms. |
240
-
|`ssid`| Android, iOS (not tvOS) |`string`| The SSID 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](https://developer.apple.com/documentation/systemconfiguration/1614126-cncopycurrentnetworkinfo?language=objc#discussion). On Android, you need to have the `ACCESS_FINE_LOCATION` permission in your `AndroidManifest.xml` and accepted by the user**.|
241
-
|`strength`| Android |`number`| An integer number from `0` to `5` for the signal strength. May not be present if the signal strength cannot be determined. |
242
-
|`ipAddress`| Android, iOS |`string`| The external IP address. Can be in IPv4 or IPv6 format. May not be present if it cannot be determined. |
243
-
|`subnet`| Android, iOS |`string`| The subnet mask in IPv4 format. May not be present if it cannot be determined. |
|`isConnectionExpensive`| Android, iOS, macOS, Windows, Web |`boolean`| If the network connection is considered "expensive". This could be in either energy or monetary terms. |
257
+
|`ssid`| Android, iOS (not tvOS) |`string`| The SSID 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](https://developer.apple.com/documentation/systemconfiguration/1614126-cncopycurrentnetworkinfo?language=objc#discussion). On Android, you need to have the `ACCESS_FINE_LOCATION` permission in your `AndroidManifest.xml` and accepted by the user**. |
258
+
|`strength`| Android |`number`| An integer number from `0` to `5` for the signal strength. May not be present if the signal strength cannot be determined. |
259
+
|`ipAddress`| Android, iOS, macOS |`string`| The external IP address. Can be in IPv4 or IPv6 format. May not be present if it cannot be determined. |
260
+
|`subnet`| Android, iOS, macOS |`string`| The subnet mask in IPv4 format. May not be present if it cannot be determined. |
|`isConnectionExpensive`| Android, iOS, Windows, Web |`boolean`| If the network connection is considered "expensive". This could be in either energy or monetary terms. |
252
-
|`cellularGeneration`| Android, iOS, Windows |[`NetInfoCellularGeneration`](#netinfocellulargeneration)| The generation of the cell network the user is connected to. This can give an indication of speed, but no guarantees. |
253
-
|`carrier`| Android, iOS |`string`| The network carrier name. May not be present or may be empty if none can be determined. |
|`isConnectionExpensive`| Android, iOS, macOS, Windows, Web |`boolean`| If the network connection is considered "expensive". This could be in either energy or monetary terms. |
269
+
|`cellularGeneration`| Android, iOS, Windows |[`NetInfoCellularGeneration`](#netinfocellulargeneration)| The generation of the cell network the user is connected to. This can give an indication of speed, but no guarantees. |
270
+
|`carrier`| Android, iOS |`string`| The network carrier name. May not be present or may be empty if none can be determined. |
254
271
255
272
##### `type` is `bluetooth`, `ethernet`, `wimax`, `vpn`, or `other`
256
273
@@ -263,17 +280,17 @@ The `details` value depends on the `type` value.
263
280
#### `NetInfoStateType`
264
281
Describes the current type of network connection. It is an enum with these possible values:
0 commit comments