Commit Graph

36 Commits

Author SHA1 Message Date
Héctor Ramos 28d60b68ad Trim docs that are already present in the open source docs site
Summary:
A lot of these docs are already present in https://github.com/facebook/react-native-website.
Closes https://github.com/facebook/react-native/pull/17776

Differential Revision: D6839783

Pulled By: hramos

fbshipit-source-id: 945fde22afb8f181d0463617d224d3f3429faa24
2018-01-29 16:20:15 -08:00
Willem Fibbe 8b044dcb80 Update the `NetInfo.isConnected` example code so that it uses the new `connectionChange` event
Summary:
The first code block already uses the new `connectionChange` event instead of
the deprecated `change` event, so change this example code block as well to use
the new event.

I came across this while upgrading my RN version. In the debug-console I saw a deprecation warning, despite I was using the example-code. Looking at the source, I saw the example code block still used the deprecated event, so update it to use the new one.
Closes https://github.com/facebook/react-native/pull/16357

Differential Revision: D6054428

Pulled By: hramos

fbshipit-source-id: 72ef1a79ece7494cda3773461a740dbbdf383e7e
2017-10-13 18:02:06 -07:00
Jiajie Zhu bca825ee50 deprecate some usage of NetInfo
Reviewed By: wwjholmes

Differential Revision: D5493891

fbshipit-source-id: f86f034294f3fd07a535d2856ca6c7d4e2eb7824
2017-07-28 09:38:58 -07:00
Adam Comella fc38fe1736 DEPRECATION: Make NetInfo API cross platform and expose whether connection is 2g/3g/4g
Summary:
This change intends to fix 2 issues with the NetInfo API:
  - The NetInfo API is currently platform-specific. It returns completely different values on iOS and Android.
  - The NetInfo API currently doesn't expose a way to determine whether the connection is 2g, 3g, or 4g.

The NetInfo API currently just exposes a string-based enum representing the connectivity type. The string values are different between iOS and Andorid. Because of this design, it's not obvious how to achieve the goals of this change without making a breaking change. Consequently, this change deprecates the old NetInfo APIs and introduces new ones. Specifically, these are the API changes:
  - The `fetch` method is deprecated in favor of `getConnection`
  - The `change` event is deprecated in favor of the `connectionchange` event.
  - `getConnection`/`connectionchange` use a new set of enum values compared to `fetch`/`change`. See the documentation for the new values.
    - On iOS, `cell` is now known as `cellular`. It's worth pointing out this one in particular because the old and new names are so similar. The rest of the iOS values have remained the same.
    - Some of the Android enum values have been removed without a replacement (e.g. `DUMMY`, `MOBILE_DUN`, `MOBILE_HIPRI`, `MOBILE_MMS`, `MOBILE_SUPL`, `VPN`). If desirable, we could find a way to expose these in the new API. For example, we could have a `platformValue` key that exposes the platform's enum values directly (like the old `fetch` API did).

`getConnection` and `connectionchange` each expose an object which has 2 keys conveying a `ConnectionType` (e.g. wifi, cellular) and an `EffectiveConnectionType` (e.g. 2g, 3g). These enums and their values are taken directly from the W3C's Network Information API spec (https://wicg.github.io/netinfo/). Copying the W3C's API will make it easy to expose a `navigation.connection` polyfill, if we want, in the future. Additionally, because the new APIs expose an object instead of a string, it's easier to extend the APIs in the future by adding keys to the object without causing a breaking change.

Note that the W3C's spec doesn't have an "unknown" value for `EffectiveConnectionType`. I chose to introduce this non-standard value because it's possible for the current implementation to not have an `effectiveConnectionType` and I figured it was worth representing this possibility explicitly with "unknown" instead of implicitly with `null`.

**Test Plan (required)**

Verified that the methods (`fetch` and `getConnection`) and the events (`change` and `connectionchange`) return the correct data on iOS and Android when connected to a wifi network and a 4G cellular network. Verified that switching networks causes the event to fire with the correct information. Verified that the old APIs (`fetch' and 'change') emit a deprecation warning when used. My team is using a similar patch in our app.

Adam Comella
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/14618

Differential Revision: D5459593

Pulled By: shergin

fbshipit-source-id: f1e6c5d572bb3e2669fbd4ba7d0fbb106525280e
2017-07-24 15:50:53 -07:00
Jakub Šimo 82f3964f2d Change Promise.done to Promise.then
Summary:
- [X] Explain the **motivation** for making this change.
- [X] Provide a **test plan** demonstrating that the code is solid.
- [X] Match the **code formatting** of the rest of the codebase.
- [X] Target the `master` branch, NOT a "stable" branch.

`Promise.done` is non-standard, `Promise.then` is preferred as a standardized method. On Android, polyfill filling in `Promise.done` has been most probably taken out in newer versions of `react-native` and app crashes when it tries to query network state through `NetInfo`.

No tests are required for this change.
Closes https://github.com/facebook/react-native/pull/13489

Differential Revision: D4897566

Pulled By: mkonicek

fbshipit-source-id: 140720d7367cd1d9bf8924ec8a118c1bff4e461d
2017-04-16 15:30:46 -07:00
Gabe Levi e2ce98b7c6 Fix the suppress comment regex for react_native
Reviewed By: davidaurelio

Differential Revision: D4435640

fbshipit-source-id: c680aee6931979859f04c0dca47037ba6f6cba73
2017-01-19 10:28:28 -08:00
Gabe Levi bf901d926e Deploy v0.36.0
Reviewed By: zertosh

Differential Revision: D4237912

fbshipit-source-id: cc251884350ffa3c8715a4920f90bd301e8a9b7f
2016-11-28 10:13:31 -08:00
Satyajit Sahoo fa5ad85252 Remove deprecated APIs and modules
Summary:
We've deprecated these APIs for quite a few releases and we should be able to get rid of them now.

Remove following deprecated modules/components
 - AppStateIOS
 - ActivityIndicatorIOS
 - IntentAndroid
 - SliderIOS
 - SwitchAndroid
 - SwitchIOS
 - LinkingIOS

Update following modules to remove callback support
 - Clipboard
 - NetInfo

cc bestander
Closes https://github.com/facebook/react-native/pull/9891

Reviewed By: bestander

Differential Revision: D3974094

Pulled By: javache

fbshipit-source-id: 9abe32716bd85d0cea9933894f4447d53bdd5ee7
2016-10-11 07:43:52 -07:00
David Aurelio 94666f16c7 Auto-fix lint errors
Reviewed By: bestander

Differential Revision: D3683952

fbshipit-source-id: 9484d0b0e86859e8edaca0da1aa13a667f200905
2016-08-09 06:43:46 -07:00
Nick Lockwood b71db11554 Update RCTNetworking, RCTNetInfo and RCTLocationManager to use new events system
Summary: Updated networking and geolocation to use the new events system.

Reviewed By: bestander

Differential Revision: D3346129

fbshipit-source-id: 957716e54d7af8c4a6783f684098e92e92f19654
2016-05-25 04:28:36 -07:00
Basil Hosmer ac5636dd59 explicit type args in react-native-github
Reviewed By: vjeux

Differential Revision: D3342856

fbshipit-source-id: ba5a4d5529fc9d1d1efe98cc175d718c5f044a5b
2016-05-24 18:28:26 -07:00
Konstantin Raev 2de0323182 Reverted commit D3339945
Summary: Updated networking and geolocation to use the new events system.

Reviewed By: javache

Differential Revision: D3339945

fbshipit-source-id: 01d307cf8a0aea3a404c87c6205132c42290abb1
2016-05-24 12:43:30 -07:00
Nick Lockwood 3f08fe4b7f Update RCTNetworking, RCTNetInfo and RCTLocationManager to use new events system
Summary: Updated networking and geolocation to use the new events system.

Reviewed By: javache

Differential Revision: D3339945

fbshipit-source-id: f1332fb2aab8560e4783739e223c1f31d583cfcf
2016-05-24 10:29:00 -07:00
Yao Bin Then 433c0e8021 Add comments on NetInfo.js
Summary:
Further describe the methods available on NetInfo.

Question: How do I update the docs on the website?
Closes https://github.com/facebook/react-native/pull/7375

Differential Revision: D3303300

fbshipit-source-id: 4343d490f65e4e47b93f2c98a645cb675d2cf708
2016-05-14 21:50:24 -07:00
Jeff Morrison 593d766ec5 Fix fbsource errors
Reviewed By: kassens

Differential Revision: D3032708

fb-gh-sync-id: e697a2433dcdcb70ddeafdee607f14e570cfb245
shipit-source-id: e697a2433dcdcb70ddeafdee607f14e570cfb245
2016-03-09 16:54:24 -08:00
Jeff Morrison b473d496c4 Update FBSource to use Flow 0.22
Reviewed By: gabelevi

Differential Revision: D3021265

fb-gh-sync-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
shipit-source-id: f4c857505c1a7b6b813bcdccd629e595ef7a81af
2016-03-08 12:39:29 -08:00
Satyajit Sahoo 14ec6f011e Use promises in 'NetInfo'
Reviewed By: svcscm

Differential Revision: D2938010

fb-gh-sync-id: 4a24ce680b37e49759f3325987b4b440eb033b94
shipit-source-id: 4a24ce680b37e49759f3325987b4b440eb033b94
2016-02-15 13:34:33 -08:00
Spencer Ahrens 1c507e6291 return remover function when adding NetInfo listener
Reviewed By: dmmiller

Differential Revision: D2931623

fb-gh-sync-id: d67e986e2b4a503c0966a3f90788e207c452f216
shipit-source-id: d67e986e2b4a503c0966a3f90788e207c452f216
2016-02-12 18:09:29 -08:00
Martin Konicek 139f9945df Don't use arrow functions with Flow types to fix website generation
Summary:
Our custom jsdocs parser doesn't support the syntax yet.

public

Reviewed By: bestander

Differential Revision: D2739861

fb-gh-sync-id: eefc3c54b98e06597ca7d93396aa4fe3a92d4a58
2015-12-09 14:56:40 -08:00
Konstantin Raev 56793e3f8d Fixed Flow error
Reviewed By: gabelevi

Differential Revision: D2734738

fb-gh-sync-id: 5ba3d4285185cd220a5bf6a26cb3818311822e52
2015-12-08 12:08:27 -08:00
Konstantin Raev c9d796fc6a NetInfo: Cleaned up code and examples
Reviewed By: andreicoman11

Differential Revision: D2723578

fb-gh-sync-id: b7bb9ce69f24ff5dcf38409de92d57f53da003fa
2015-12-08 09:35:22 -08:00
Konstantin Raev 10c8a1c417 fixed mardown formatting in NetInfo code to allow proper JS Docs
Summary:
Current docs look bad https://facebook.github.io/react-native/docs/netinfo.html#content
Closes https://github.com/facebook/react-native/pull/4531

Reviewed By: svcscm

Differential Revision: D2717974

Pulled By: androidtrunkagent

fb-gh-sync-id: cd2cadfb782f8ce6a418ca7af5fcefb54504059b
2015-12-03 07:53:28 -08:00
Konstantin Raev 0779dd1e87 Open source the Android NetInfo module
Reviewed By: mkonicek

Differential Revision: D2703432

fb-gh-sync-id: 4a85844f1734ec433df543c89f0fdd56fe5db13c
2015-12-02 11:52:22 -08:00
Nathan Spaun cf892a96d6 Fix NetInfo for Android
Reviewed By: oli

Differential Revision: D2708102

fb-gh-sync-id: f6a12c49c89c46d31114fefaf3e2b1ba72dabdee
2015-12-01 15:14:30 -08:00
Christopher 53403423ca - Fix response variable from getCurrentReachability
Summary: Fixes #3333 and #2802
Closes https://github.com/facebook/react-native/pull/3345

Reviewed By: @​svcscm

Differential Revision: D2530744

Pulled By: @vjeux

fb-gh-sync-id: 521cbe482f3811339b21cf68ba2269d2b5286e82
2015-10-11 19:42:24 -07:00
Gabe Levi 874f39bf7f [Flow] Clean up react-native for Flow v0.15.0 2015-09-04 16:51:18 -08:00
Alexsander Akers 91c8362176 Rename RCTReachability to RCTNetInfo 2015-08-14 08:20:01 -08:00
Eric Vicenti 32f895a315 [ReactNative] NetInfo listener Map 2015-06-12 14:56:21 -08:00
Gabe Levi b05e99a531 [Flow] Fix or suppress react-native github errors for Flow v0.12.0 2015-06-10 13:34:19 -08:00
Andrei Coman 0aa7f3f8d5 [react_native] Implement connectivity module 2015-06-02 05:41:16 -08:00
Mike Wilcox 17e5b04d1a Fix Typo
Summary:
* This PR fixes a typo for the NetInfo docs page
Closes https://github.com/facebook/react-native/pull/937
Github Author: Mike Wilcox <mwilcox56@gmail.com>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
2015-04-21 16:41:34 -08:00
Eric Vicenti cd81fee57c [ReactNative] Flow and doc formatting for NetInfo 2015-03-25 14:41:00 -08:00
Christopher Chedeau e1ef0328d9 [ReactNative] Expanded license on js files 2015-03-23 13:17:54 -08:00
Spencer Ahrens 9086365faf [ReactNative] Strip prefixes from NativeModules keys 2015-03-17 21:54:27 -08:00
Spencer Ahrens b396de3cc8 [ReactNative] s/RK/RCT in OSS 2015-03-17 02:48:57 -08:00
Eric Vicenti 310aef9dcc [ReactNative] NetworkInformation.reachability API w/ example 2015-03-16 13:44:40 -08:00