-
Notifications
You must be signed in to change notification settings - Fork 24.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEPRECATION: Make NetInfo API cross platform and expose whether connection is 2g/3g/4g #14618
Conversation
…ction is 2g/3g/4g 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` 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`.
Libraries/Network/NetInfo.js
Outdated
* ### IOS | ||
* | ||
* Asynchronously determine if the device is online and on a cellular network. | ||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
@@ -167,22 +163,77 @@ const _isConnectedSubscriptions = new Map(); | |||
* handleFirstConnectivityChange | |||
* ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
Libraries/Network/NetInfo.js
Outdated
* iOS connectivity types (deprecated): | ||
* - `none` - device is offline | ||
* - `wifi` - device is online and connected via wifi, or is the iOS simulator | ||
* - `cell` - device is connected via Edge, 3G, WiMax, or LTE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
Libraries/Network/NetInfo.js
Outdated
@@ -167,22 +163,77 @@ const _isConnectedSubscriptions = new Map(); | |||
* handleFirstConnectivityChange | |||
* ); | |||
* ``` | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
Libraries/Network/NetInfo.js
Outdated
* - `2g` | ||
* - `3g` | ||
* - `4g` | ||
* - `unknown` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
* - `none` - device is offline | ||
* - `wifi` - device is online and connected via wifi, or is the iOS simulator | ||
* - `cell` - device is connected via Edge, 3G, WiMax, or LTE | ||
* - `cellular` - device is connected via Edge, 3G, WiMax, or LTE | ||
* - `unknown` - error case and the network status is unknown |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
Libraries/Network/NetInfo.js
Outdated
@@ -167,22 +163,77 @@ const _isConnectedSubscriptions = new Map(); | |||
* handleFirstConnectivityChange | |||
* ); | |||
* ``` | |||
* | |||
* ### Connectivity Types (deprecated) | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
Libraries/Network/NetInfo.js
Outdated
* Asynchronously determine if the device is online and on a cellular network. | ||
* | ||
* | ||
* ### ConnectionType enum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
*/ | ||
const NetInfo = { | ||
/** | ||
* Invokes the listener whenever network status changes. | ||
* The listener receives one of the connectivity types listed above. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
Libraries/Network/NetInfo.js
Outdated
* ### EffectiveConnectionType enum | ||
* | ||
* Cross platform values for `EffectiveConnectionType`: | ||
* - `2g` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
Libraries/Network/NetInfo.js
Outdated
* | ||
* ### EffectiveConnectionType enum |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
Libraries/Network/NetInfo.js
Outdated
* | ||
* Cross platform values for `EffectiveConnectionType`: | ||
* - `2g` | ||
* - `3g` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
Libraries/Network/NetInfo.js
Outdated
* Cross platform values for `EffectiveConnectionType`: | ||
* - `2g` | ||
* - `3g` | ||
* - `4g` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
Libraries/Network/NetInfo.js
Outdated
*/ | ||
getConnection(): Promise<any> { | ||
return RCTNetInfo.getCurrentConnectivity().then(resp => { | ||
return { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
semi: Missing semicolon.
Libraries/Network/NetInfo.js
Outdated
* | ||
* ### ConnectionType enum | ||
* | ||
* `ConnectionType` describes the type of connection the device is using to communicate with the network. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no-trailing-spaces: Trailing spaces not allowed.
- Remove trailing whitespace - Use single quotes for strings - Missing semicolon - `type` should have been `eventName`
/cc @hramos |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just add new values to existing event, deprecate old values, and delete old values eventually?
Libraries/Network/NetInfo.js
Outdated
@@ -79,56 +80,51 @@ const _isConnectedSubscriptions = new Map(); | |||
* NetInfo exposes info about online/offline status | |||
* | |||
* ``` | |||
* NetInfo.fetch().then((reach) => { | |||
* console.log('Initial: ' + reach); | |||
* NetInfo.getConnection().then((connection) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name is quite confusing (because it is not connection), can/should we rename it to something like getConnectionInfo
or getConnectionStatus
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shergin I modeled it after the W3C Network Information API which offers this information off of a connection
property (https://wicg.github.io/netinfo/#-dfn-connection-dfn-attribute). I can switch it to getConnectionInfo
if you'd prefer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. The connection attribute, when getting, returns an object that implements the NetworkInformation interface.
Yeah, I think using getConnectionInfo
or getConnectionInformation
would be much better.
Libraries/Network/NetInfo.js
Outdated
} | ||
); | ||
let listener; | ||
if (eventName === 'connectionchange') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the event name is all lower case? And
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll switch it to connectionChange
If we were to reuse the existing event which fires with a string, how would we convey both the old value (so it's not a breaking change) and the new value? For example, on iOS we used to have An additional thing to note is that the new event fires with an object of 2 keys ( |
@rigdern I didn't noticed that the old event has just string parameter. |
- `connectionchange` event is now `connectionChange` - `getConnection` method is now `getConnectionInfo`
@shergin Thanks for your feedback. I pushed a commit to rename those 2 APIs:
|
super small nits
@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification. |
@rigdern Could you please verify that RNTester can be built with this patch? I am experiencing this error (seems we have to add CoreTelefony framework to the project file):
|
`TARGET_OS_IPHONE` is not the right way to differentiate between iOS and tvOS. From a bug report to Apple (http://www.openradar.me/22639221) about `TARGET_OS_IPHONE` being true on tvOS: "This is not a bug. tvOS is an evolutionary subclass of iOS (formerly "iPhone OS"). You need to use TARGET_OS_IOS instead, which is NOT defined to 1 on tvOS."
@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Summary: @public This sync includes the following changes: - **[45fc46bfa](facebook/react@45fc46bfa )**: 16.8.1 packages //<Brian Vaughn>// - **[f2e2637c8](facebook/react@f2e2637c8 )**: Backwards compat fix for ReactCurrentDispatcher on older react versions (facebook#14770) //<Brian Vaughn>// - **[1107b9673](facebook/react@1107b9673 )**: [TestUtils.act] warn when using TestUtils.act in node (facebook#14768) //<Sunil Pai>// - **[0975ea327](facebook/react@0975ea327 )**: eslint-plugin-react-hooks v1.0.0 //<Brian Vaughn>// - **[bc9818f24](facebook/react@bc9818f24 )**: Scheduler.unstable_next (facebook#14756) //<Andrew Clark>// - **[ce6ecd3fb](facebook/react@ce6ecd3fb )**: Add 16.8.0 changelog and update some READMEs (facebook#14692) //<Dan Abramov>// - **[008a2ab9c](facebook/react@008a2ab9c )**: 16.8.0 //<Brian Vaughn>// - **[d1326f466](facebook/react@d1326f466 )**: [TestUtils.act] fix return result checking (facebook#14758) //<Sunil Pai>// - **[267ed9814](facebook/react@267ed9814 )**: expose `TestUtils.act()` for batching actions in tests (facebook#14744) //<Sunil Pai>// - **[fb3f7bfde](facebook/react@fb3f7bfde )**: Avoid importing Scheduler directly (facebook#14757) //<Andrew Clark>// - **[e602b5291](facebook/react@e602b5291 )**: Use SameValue instead of === to check for dispatchAction equivalence (facebook#14752) //<Jessica Franco>// - **[e489c3f9c](facebook/react@e489c3f9c )**: Update the version with Hooks proposal in README (facebook#14751) //<SToneX>// - **[c21c41ecf](facebook/react@c21c41ecf )**: Tweak invalid Hook warning and error (facebook#14747) //<Dan Abramov>// - **[fec00a869](facebook/react@fec00a869 )**: Typo in comment (facebook#14739) //<Deniz Susman>// - **[66eb29374](facebook/react@66eb29374 )**: Restrict effect return type to a function or nothing (facebook#14119) //<Andrew Clark>// - **[51c07912a](facebook/react@51c07912a )**: Warn when second argument is passed to useCallback (facebook#14729) //<Dan Abramov>// - **[70d407583](facebook/react@70d407583 )**: Move Hook mismatch warning to first mismatch site (facebook#14720) //<Andrew Clark>// - **[ba6477aa3](facebook/react@ba6477aa3 )**: Improve Reducer Hook's lazy init API (facebook#14723) //<Andrew Clark>// - **[cb1ff430e](facebook/react@cb1ff430e )**: Phased dispatcher (facebook#14701) //<Andrew Clark>// - **[9d483dcfd](facebook/react@9d483dcfd )**: Spelling abitrarily -> arbitrarily (facebook#14710) //<Peter Donald>// - **[e19c9e106](facebook/react@e19c9e106 )**: Fix issue with multiple code branches in hooks linter (facebook#14661) //<Yurick>// - **[f11a9c1cb](facebook/react@f11a9c1cb )**: State update bug in concurrent mode (facebook#14698) //<Brian Vaughn>// - **[e679a4b6e](facebook/react@e679a4b6e )**: Fix typo in code comment (facebook#14696) //<Greg Hurrell>// - **[8bcc88f2e](facebook/react@8bcc88f2e )**: Make all readContext() and Hook-in-a-Hook checks DEV-only (facebook#14677) //<Dan Abramov>// - **[6cb26774e](facebook/react@6cb26774e )**: Enable hooks! (facebook#14679) //<Brian Vaughn>// - **[73962c366](facebook/react@73962c366 )**: Revert "Revert "Double-render function components with Hooks in DEV in StrictMode" (facebook#14652)" (facebook#14654) //<Dan Abramov>// - **[994439228](facebook/react@994439228 )**: Put DEV-only code into DEV blocks (facebook#14673) //<Dan Abramov>// - **[f0befae65](facebook/react@f0befae65 )**: Tweak context invariant message (facebook#14671) //<Dan Abramov>// - **[a129259ad](facebook/react@a129259ad )**: Disallow reading context during useMemo etc (facebook#14653) //<Dan Abramov>// - **[c068d31cc](facebook/react@c068d31cc )**: Add unit tests for concurrent mode event dispatching (facebook#14415) //<Sebastian Markbåge>// - **[38247cba3](facebook/react@38247cba3 )**: --save is no longer needed (facebook#14302) //<SamCortopassi>// - **[3f0bcaf0d](facebook/react@3f0bcaf0d )**: Importing React for the first example. (facebook#14346) //<Ramón Chancay Ortega>// - **[ecd919a2f](facebook/react@ecd919a2f )**: RFC: warn when returning different hooks on subsequent renders (facebook#14585) //<Sunil Pai>// - **[3fbebb2a0](facebook/react@3fbebb2a0 )**: Revert "Double-render function components with Hooks in DEV in StrictMode" (facebook#14652) //<Dan Abramov>// - **[5fce6488c](facebook/react@5fce6488c )**: Revert "Disallow reading context during useMemo etc" (facebook#14651) //<Dan Abramov>// - **[fe2ecd276](facebook/react@fe2ecd276 )**: Add test coverage for readContext() on the server (facebook#14649) //<Dan Abramov>// - **[8f45a7fdc](facebook/react@8f45a7fdc )**: Warn about incorrect use of useImperativeHandle() (facebook#14647) //<Dan Abramov>// - **[1fcbd2243](facebook/react@1fcbd2243 )**: Disallow reading context during useMemo etc (facebook#14648) //<Dan Abramov>// - **[2a084f51a](facebook/react@2a084f51a )**: Warn about refs on lazy function components (facebook#14645) //<Dan Abramov>// - **[b5a3df6e8](facebook/react@b5a3df6e8 )**: Fix typo (facebook#14560) //<Linchengyi>// - **[9c146e675](facebook/react@9c146e675 )**: fix typo (facebook#14316) //<liunian>// - **[baa6d40fc](facebook/react@baa6d40fc )**: Mention forwardRef() in <Fn ref={...} /> errors and warnings (facebook#14644) //<Dan Abramov>// - **[a1414e894](facebook/react@a1414e894 )**: Double-render function components with Hooks in DEV in StrictMode (facebook#14643) //<Dan Abramov>// - **[10a7a5b5c](facebook/react@10a7a5b5c )**: Fix synchronous thenable rejection (facebook#14633) //<Dan Abramov>// - **[a2fa6eb98](facebook/react@a2fa6eb98 )**: Move lazy._result assignment (facebook#14632) //<Dan Abramov>// - **[9120f6c2d](facebook/react@9120f6c2d )**: Support sync thenables for lazy() (facebook#14626) //<Dan Abramov>// - **[b66e6e41e](facebook/react@b66e6e41e )**: Add directory details to the package.json of all packages (facebook#14628) //<Grey Baker>// - **[177fb7635](facebook/react@177fb7635 )**: Warn when second callback is passed to setState/dispatch in Hooks (facebook#14625) //<Dan Abramov>// - **[d17d0b99c](facebook/react@d17d0b99c )**: Use public context.report interface in eslint rules (facebook#14623) //<Sebastian Silbermann>// - **[4f332885a](facebook/react@4f332885a )**: Fix shallow renderer set instance state after gDSFP before calling sCU (facebook#14613) //<Yi-Shan, Chen>// - **[e1cd83e49](facebook/react@e1cd83e49 )**: Throw an error when using hooks inside useMemo/useState/useReducer, or .memo's comparator (facebook#14608) //<Sunil Pai>// - **[be457ca68](facebook/react@be457ca68 )**: Small tweaks to SSR to match facebook#14594 (facebook#14618) //<Dan Abramov>// - **[17d70df91](facebook/react@17d70df91 )**: Warn when mixing createRoot() and old APIs (facebook#14615) //<Dan Abramov>// - **[4feab7fc9](facebook/react@4feab7fc9 )**: Add hooks support to ReactShallowRenderer (facebook#14567) //<Dominic Gannaway>// - **[1454a8be0](facebook/react@1454a8be0 )**: Don't bother comparing constructor when deps are not provided (facebook#14594) //<Andrew Clark>// - **[71b64d521](facebook/react@71b64d521 )**: Warn if number of hooks increases (facebook#14591) //<Andrew Clark>// - **[790c8ef04](facebook/react@790c8ef04 )**: Allow useReducer to bail out of rendering by returning previous state (facebook#14569) //<Andrew Clark>// - **[7ab8a8e97](facebook/react@7ab8a8e97 )**: Added Flow type to keep hooks dispatchers in-sync (facebook#14599) //<Brian Vaughn>// - **[4392e3821](facebook/react@4392e3821 )**: useDebugValue should throw if used in a class component (facebook#14601) //<Brian Vaughn>// - **[153a0b598](facebook/react@153a0b598 )**: Add noop useDebugValue hook to partial/server renderer (facebook#14597) //<Brian Vaughn>// - **[7ad9806d1](facebook/react@7ad9806d1 )**: Tweak to avoid property read (facebook#14593) //<Brandon Dail>// - **[0fc154751](facebook/react@0fc154751 )**: Avoid new Set([iterable]) for thenables (facebook#14592) //<Brandon Dail>// - **[edb1f5956](facebook/react@edb1f5956 )**: Support configurable labels for custom hooks (facebook#14559) //<Brian Vaughn>// - **[3e15b1c69](facebook/react@3e15b1c69 )**: make a fork for ReactCurrentDispatcher (facebook#14588) //<Sunil Pai>// - **[0005d1e3f](facebook/react@0005d1e3f )**: Fix typo (facebook#14576) //<Carl Mungazi>// - **[f290138d3](facebook/react@f290138d3 )**: react-debug-tools accepts currentDispatcher ref as param (facebook#14556) //<Brian Vaughn>// - **[b4ad8e947](facebook/react@b4ad8e947 )**: rename useImperativeMethods -> useImperativeHandle (facebook#14565) //<Sunil Pai>// - **[ab03e3d65](facebook/react@ab03e3d65 )**: Inject ReactCurrentDispatcher ref to DevTools (facebook#14550) //<Brian Vaughn>// - **[19ef0ec11](facebook/react@19ef0ec11 )**: Separate current owner and dispatcher (facebook#14548) //<Brian Vaughn>// - **[a9b035b0c](facebook/react@a9b035b0c )**: Separate Object.is polyfill (facebook#14334) //<Maksim Markelov>// - **[547e059f0](facebook/react@547e059f0 )**: Simplify wording of key warning (facebook#14503) //<Sophie Alpert>// - **[3494ee57e](facebook/react@3494ee57e )**: Update ReactUpdateQueue.js (facebook#14521) //<Carl Mungazi>// - **[659c13963](facebook/react@659c13963 )**: Update ReactFiberScheduler.js (facebook#14477) //<Carl Mungazi>// - **[c695b2384](facebook/react@c695b2384 )**: React v16.7.0 //<Andrew Clark>// - **[1c5aa2f23](facebook/react@1c5aa2f23 )**: Move SchedulerFeatureFlags fork to src directory to fix lint //<Andrew Clark>// - **[653bc582f](facebook/react@653bc582f )**: Create separate SchedulerFeatureFlags instead of using ReactFeatureFlags (facebook#14455) //<Andrew Clark>// - **[8bfef0da5](facebook/react@8bfef0da5 )**: Make scheduler debugging feature flag static //<Andrew Clark>// - **[4a1072194](facebook/react@4a1072194 )**: Memoize promise listeners to prevent exponential growth (facebook#14429) //<Andrew Clark>// - **[535804f5c](facebook/react@535804f5c )**: Removed Fabric-specific feature flag files and updated Rollup to use the (non-Fabric) React Native flag files. (facebook#14437) //<Brian Vaughn>// - **[2743fb7b2](facebook/react@2743fb7b2 )**: Enable hooks by default for FB React Native renderer (facebook#14435) //<Brian Vaughn>// - **[7325ebe4d](facebook/react@7325ebe4d )**: Inject overrideProps() fn to DevTools (facebook#14427) //<Brian Vaughn>// - **[a22880e5e](facebook/react@a22880e5e )**: Add support for Suspense & lazy() to the react-is package (facebook#14423) //<Pleun Vanderbauwhede>// - **[947bddd5c](facebook/react@947bddd5c )**: Remove redundant argument of getPlugins function (facebook#14419) //<Heaven>// - **[8df4d59be](facebook/react@8df4d59be )**: Implement pauseExecution, continueExecution, dumpQueue for Scheduler (facebook#14053) //<Kevin Chavez>// - **[5bb4ad737](facebook/react@5bb4ad737 )**: Added ErrorBoundary tests for useEffect and useLayoutEffect (facebook#14401) //<Brian Vaughn>// - **[98eb5ae53](facebook/react@98eb5ae53 )**: TestRenderer toJSON should not expose the Array wrapper Suspense uses for hidden trees (facebook#14392) //<Brian Vaughn>// - **[39489e767](facebook/react@39489e767 )**: Enable hooks in fabric (facebook#14301) //<Spencer Ahrens>// - **[1dc108e58](facebook/react@1dc108e58 )**: Tweaked wording for v8 "performance cliff" issue //<Brian Vaughn>// Release Notes: [GENERAL] [Changed] - React sync for revisions 6bf5e85...aa94237 (React 16.8.1) Differential Revision: D13976467 fbshipit-source-id: 728fbf4fecde33184b6b36f863f2dfe940becc27
Summary: Pull Request resolved: facebook#23320 @public This sync includes the following changes: - **[45fc46bfa](facebook/react@45fc46bfa )**: 16.8.1 packages //<Brian Vaughn>// - **[f2e2637c8](facebook/react@f2e2637c8 )**: Backwards compat fix for ReactCurrentDispatcher on older react versions (facebook#14770) //<Brian Vaughn>// - **[1107b9673](facebook/react@1107b9673 )**: [TestUtils.act] warn when using TestUtils.act in node (facebook#14768) //<Sunil Pai>// - **[0975ea327](facebook/react@0975ea327 )**: eslint-plugin-react-hooks v1.0.0 //<Brian Vaughn>// - **[bc9818f24](facebook/react@bc9818f24 )**: Scheduler.unstable_next (facebook#14756) //<Andrew Clark>// - **[ce6ecd3fb](facebook/react@ce6ecd3fb )**: Add 16.8.0 changelog and update some READMEs (facebook#14692) //<Dan Abramov>// - **[008a2ab9c](facebook/react@008a2ab9c )**: 16.8.0 //<Brian Vaughn>// - **[d1326f466](facebook/react@d1326f466 )**: [TestUtils.act] fix return result checking (facebook#14758) //<Sunil Pai>// - **[267ed9814](facebook/react@267ed9814 )**: expose `TestUtils.act()` for batching actions in tests (facebook#14744) //<Sunil Pai>// - **[fb3f7bfde](facebook/react@fb3f7bfde )**: Avoid importing Scheduler directly (facebook#14757) //<Andrew Clark>// - **[e602b5291](facebook/react@e602b5291 )**: Use SameValue instead of === to check for dispatchAction equivalence (facebook#14752) //<Jessica Franco>// - **[e489c3f9c](facebook/react@e489c3f9c )**: Update the version with Hooks proposal in README (facebook#14751) //<SToneX>// - **[c21c41ecf](facebook/react@c21c41ecf )**: Tweak invalid Hook warning and error (facebook#14747) //<Dan Abramov>// - **[fec00a869](facebook/react@fec00a869 )**: Typo in comment (facebook#14739) //<Deniz Susman>// - **[66eb29374](facebook/react@66eb29374 )**: Restrict effect return type to a function or nothing (facebook#14119) //<Andrew Clark>// - **[51c07912a](facebook/react@51c07912a )**: Warn when second argument is passed to useCallback (facebook#14729) //<Dan Abramov>// - **[70d407583](facebook/react@70d407583 )**: Move Hook mismatch warning to first mismatch site (facebook#14720) //<Andrew Clark>// - **[ba6477aa3](facebook/react@ba6477aa3 )**: Improve Reducer Hook's lazy init API (facebook#14723) //<Andrew Clark>// - **[cb1ff430e](facebook/react@cb1ff430e )**: Phased dispatcher (facebook#14701) //<Andrew Clark>// - **[9d483dcfd](facebook/react@9d483dcfd )**: Spelling abitrarily -> arbitrarily (facebook#14710) //<Peter Donald>// - **[e19c9e106](facebook/react@e19c9e106 )**: Fix issue with multiple code branches in hooks linter (facebook#14661) //<Yurick>// - **[f11a9c1cb](facebook/react@f11a9c1cb )**: State update bug in concurrent mode (facebook#14698) //<Brian Vaughn>// - **[e679a4b6e](facebook/react@e679a4b6e )**: Fix typo in code comment (facebook#14696) //<Greg Hurrell>// - **[8bcc88f2e](facebook/react@8bcc88f2e )**: Make all readContext() and Hook-in-a-Hook checks DEV-only (facebook#14677) //<Dan Abramov>// - **[6cb26774e](facebook/react@6cb26774e )**: Enable hooks! (facebook#14679) //<Brian Vaughn>// - **[73962c366](facebook/react@73962c366 )**: Revert "Revert "Double-render function components with Hooks in DEV in StrictMode" (facebook#14652)" (facebook#14654) //<Dan Abramov>// - **[994439228](facebook/react@994439228 )**: Put DEV-only code into DEV blocks (facebook#14673) //<Dan Abramov>// - **[f0befae65](facebook/react@f0befae65 )**: Tweak context invariant message (facebook#14671) //<Dan Abramov>// - **[a129259ad](facebook/react@a129259ad )**: Disallow reading context during useMemo etc (facebook#14653) //<Dan Abramov>// - **[c068d31cc](facebook/react@c068d31cc )**: Add unit tests for concurrent mode event dispatching (facebook#14415) //<Sebastian Markbåge>// - **[38247cba3](facebook/react@38247cba3 )**: --save is no longer needed (facebook#14302) //<SamCortopassi>// - **[3f0bcaf0d](facebook/react@3f0bcaf0d )**: Importing React for the first example. (facebook#14346) //<Ramón Chancay Ortega>// - **[ecd919a2f](facebook/react@ecd919a2f )**: RFC: warn when returning different hooks on subsequent renders (facebook#14585) //<Sunil Pai>// - **[3fbebb2a0](facebook/react@3fbebb2a0 )**: Revert "Double-render function components with Hooks in DEV in StrictMode" (facebook#14652) //<Dan Abramov>// - **[5fce6488c](facebook/react@5fce6488c )**: Revert "Disallow reading context during useMemo etc" (facebook#14651) //<Dan Abramov>// - **[fe2ecd276](facebook/react@fe2ecd276 )**: Add test coverage for readContext() on the server (facebook#14649) //<Dan Abramov>// - **[8f45a7fdc](facebook/react@8f45a7fdc )**: Warn about incorrect use of useImperativeHandle() (facebook#14647) //<Dan Abramov>// - **[1fcbd2243](facebook/react@1fcbd2243 )**: Disallow reading context during useMemo etc (facebook#14648) //<Dan Abramov>// - **[2a084f51a](facebook/react@2a084f51a )**: Warn about refs on lazy function components (facebook#14645) //<Dan Abramov>// - **[b5a3df6e8](facebook/react@b5a3df6e8 )**: Fix typo (facebook#14560) //<Linchengyi>// - **[9c146e675](facebook/react@9c146e675 )**: fix typo (facebook#14316) //<liunian>// - **[baa6d40fc](facebook/react@baa6d40fc )**: Mention forwardRef() in <Fn ref={...} /> errors and warnings (facebook#14644) //<Dan Abramov>// - **[a1414e894](facebook/react@a1414e894 )**: Double-render function components with Hooks in DEV in StrictMode (facebook#14643) //<Dan Abramov>// - **[10a7a5b5c](facebook/react@10a7a5b5c )**: Fix synchronous thenable rejection (facebook#14633) //<Dan Abramov>// - **[a2fa6eb98](facebook/react@a2fa6eb98 )**: Move lazy._result assignment (facebook#14632) //<Dan Abramov>// - **[9120f6c2d](facebook/react@9120f6c2d )**: Support sync thenables for lazy() (facebook#14626) //<Dan Abramov>// - **[b66e6e41e](facebook/react@b66e6e41e )**: Add directory details to the package.json of all packages (facebook#14628) //<Grey Baker>// - **[177fb7635](facebook/react@177fb7635 )**: Warn when second callback is passed to setState/dispatch in Hooks (facebook#14625) //<Dan Abramov>// - **[d17d0b99c](facebook/react@d17d0b99c )**: Use public context.report interface in eslint rules (facebook#14623) //<Sebastian Silbermann>// - **[4f332885a](facebook/react@4f332885a )**: Fix shallow renderer set instance state after gDSFP before calling sCU (facebook#14613) //<Yi-Shan, Chen>// - **[e1cd83e49](facebook/react@e1cd83e49 )**: Throw an error when using hooks inside useMemo/useState/useReducer, or .memo's comparator (facebook#14608) //<Sunil Pai>// - **[be457ca68](facebook/react@be457ca68 )**: Small tweaks to SSR to match facebook#14594 (facebook#14618) //<Dan Abramov>// - **[17d70df91](facebook/react@17d70df91 )**: Warn when mixing createRoot() and old APIs (facebook#14615) //<Dan Abramov>// - **[4feab7fc9](facebook/react@4feab7fc9 )**: Add hooks support to ReactShallowRenderer (facebook#14567) //<Dominic Gannaway>// - **[1454a8be0](facebook/react@1454a8be0 )**: Don't bother comparing constructor when deps are not provided (facebook#14594) //<Andrew Clark>// - **[71b64d521](facebook/react@71b64d521 )**: Warn if number of hooks increases (facebook#14591) //<Andrew Clark>// - **[790c8ef04](facebook/react@790c8ef04 )**: Allow useReducer to bail out of rendering by returning previous state (facebook#14569) //<Andrew Clark>// - **[7ab8a8e97](facebook/react@7ab8a8e97 )**: Added Flow type to keep hooks dispatchers in-sync (facebook#14599) //<Brian Vaughn>// - **[4392e3821](facebook/react@4392e3821 )**: useDebugValue should throw if used in a class component (facebook#14601) //<Brian Vaughn>// - **[153a0b598](facebook/react@153a0b598 )**: Add noop useDebugValue hook to partial/server renderer (facebook#14597) //<Brian Vaughn>// - **[7ad9806d1](facebook/react@7ad9806d1 )**: Tweak to avoid property read (facebook#14593) //<Brandon Dail>// - **[0fc154751](facebook/react@0fc154751 )**: Avoid new Set([iterable]) for thenables (facebook#14592) //<Brandon Dail>// - **[edb1f5956](facebook/react@edb1f5956 )**: Support configurable labels for custom hooks (facebook#14559) //<Brian Vaughn>// - **[3e15b1c69](facebook/react@3e15b1c69 )**: make a fork for ReactCurrentDispatcher (facebook#14588) //<Sunil Pai>// - **[0005d1e3f](facebook/react@0005d1e3f )**: Fix typo (facebook#14576) //<Carl Mungazi>// - **[f290138d3](facebook/react@f290138d3 )**: react-debug-tools accepts currentDispatcher ref as param (facebook#14556) //<Brian Vaughn>// - **[b4ad8e947](facebook/react@b4ad8e947 )**: rename useImperativeMethods -> useImperativeHandle (facebook#14565) //<Sunil Pai>// - **[ab03e3d65](facebook/react@ab03e3d65 )**: Inject ReactCurrentDispatcher ref to DevTools (facebook#14550) //<Brian Vaughn>// - **[19ef0ec11](facebook/react@19ef0ec11 )**: Separate current owner and dispatcher (facebook#14548) //<Brian Vaughn>// - **[a9b035b0c](facebook/react@a9b035b0c )**: Separate Object.is polyfill (facebook#14334) //<Maksim Markelov>// - **[547e059f0](facebook/react@547e059f0 )**: Simplify wording of key warning (facebook#14503) //<Sophie Alpert>// - **[3494ee57e](facebook/react@3494ee57e )**: Update ReactUpdateQueue.js (facebook#14521) //<Carl Mungazi>// - **[659c13963](facebook/react@659c13963 )**: Update ReactFiberScheduler.js (facebook#14477) //<Carl Mungazi>// - **[c695b2384](facebook/react@c695b2384 )**: React v16.7.0 //<Andrew Clark>// - **[1c5aa2f23](facebook/react@1c5aa2f23 )**: Move SchedulerFeatureFlags fork to src directory to fix lint //<Andrew Clark>// - **[653bc582f](facebook/react@653bc582f )**: Create separate SchedulerFeatureFlags instead of using ReactFeatureFlags (facebook#14455) //<Andrew Clark>// - **[8bfef0da5](facebook/react@8bfef0da5 )**: Make scheduler debugging feature flag static //<Andrew Clark>// - **[4a1072194](facebook/react@4a1072194 )**: Memoize promise listeners to prevent exponential growth (facebook#14429) //<Andrew Clark>// - **[535804f5c](facebook/react@535804f5c )**: Removed Fabric-specific feature flag files and updated Rollup to use the (non-Fabric) React Native flag files. (facebook#14437) //<Brian Vaughn>// - **[2743fb7b2](facebook/react@2743fb7b2 )**: Enable hooks by default for FB React Native renderer (facebook#14435) //<Brian Vaughn>// - **[7325ebe4d](facebook/react@7325ebe4d )**: Inject overrideProps() fn to DevTools (facebook#14427) //<Brian Vaughn>// - **[a22880e5e](facebook/react@a22880e5e )**: Add support for Suspense & lazy() to the react-is package (facebook#14423) //<Pleun Vanderbauwhede>// - **[947bddd5c](facebook/react@947bddd5c )**: Remove redundant argument of getPlugins function (facebook#14419) //<Heaven>// - **[8df4d59be](facebook/react@8df4d59be )**: Implement pauseExecution, continueExecution, dumpQueue for Scheduler (facebook#14053) //<Kevin Chavez>// - **[5bb4ad737](facebook/react@5bb4ad737 )**: Added ErrorBoundary tests for useEffect and useLayoutEffect (facebook#14401) //<Brian Vaughn>// - **[98eb5ae53](facebook/react@98eb5ae53 )**: TestRenderer toJSON should not expose the Array wrapper Suspense uses for hidden trees (facebook#14392) //<Brian Vaughn>// - **[39489e767](facebook/react@39489e767 )**: Enable hooks in fabric (facebook#14301) //<Spencer Ahrens>// - **[1dc108e58](facebook/react@1dc108e58 )**: Tweaked wording for v8 "performance cliff" issue //<Brian Vaughn>// Release Notes: [GENERAL] [Changed] - React sync for revisions 6bf5e85...aa94237 (React 16.8.1) Differential Revision: D13976467 fbshipit-source-id: 72db51d098109081c19bce79129a7bb5932d77f5
Summary: This sync includes the following changes: - **[45fc46bfa](facebook/react@45fc46bfa )**: 16.8.1 packages //<Brian Vaughn>// - **[f2e2637c8](facebook/react@f2e2637c8 )**: Backwards compat fix for ReactCurrentDispatcher on older react versions (facebook#14770) //<Brian Vaughn>// - **[1107b9673](facebook/react@1107b9673 )**: [TestUtils.act] warn when using TestUtils.act in node (facebook#14768) //<Sunil Pai>// - **[0975ea327](facebook/react@0975ea327 )**: eslint-plugin-react-hooks v1.0.0 //<Brian Vaughn>// - **[bc9818f24](facebook/react@bc9818f24 )**: Scheduler.unstable_next (facebook#14756) //<Andrew Clark>// - **[ce6ecd3fb](facebook/react@ce6ecd3fb )**: Add 16.8.0 changelog and update some READMEs (facebook#14692) //<Dan Abramov>// - **[008a2ab9c](facebook/react@008a2ab9c )**: 16.8.0 //<Brian Vaughn>// - **[d1326f466](facebook/react@d1326f466 )**: [TestUtils.act] fix return result checking (facebook#14758) //<Sunil Pai>// - **[267ed9814](facebook/react@267ed9814 )**: expose `TestUtils.act()` for batching actions in tests (facebook#14744) //<Sunil Pai>// - **[fb3f7bfde](facebook/react@fb3f7bfde )**: Avoid importing Scheduler directly (facebook#14757) //<Andrew Clark>// - **[e602b5291](facebook/react@e602b5291 )**: Use SameValue instead of === to check for dispatchAction equivalence (facebook#14752) //<Jessica Franco>// - **[e489c3f9c](facebook/react@e489c3f9c )**: Update the version with Hooks proposal in README (facebook#14751) //<SToneX>// - **[c21c41ecf](facebook/react@c21c41ecf )**: Tweak invalid Hook warning and error (facebook#14747) //<Dan Abramov>// - **[fec00a869](facebook/react@fec00a869 )**: Typo in comment (facebook#14739) //<Deniz Susman>// - **[66eb29374](facebook/react@66eb29374 )**: Restrict effect return type to a function or nothing (facebook#14119) //<Andrew Clark>// - **[51c07912a](facebook/react@51c07912a )**: Warn when second argument is passed to useCallback (facebook#14729) //<Dan Abramov>// - **[70d407583](facebook/react@70d407583 )**: Move Hook mismatch warning to first mismatch site (facebook#14720) //<Andrew Clark>// - **[ba6477aa3](facebook/react@ba6477aa3 )**: Improve Reducer Hook's lazy init API (facebook#14723) //<Andrew Clark>// - **[cb1ff430e](facebook/react@cb1ff430e )**: Phased dispatcher (facebook#14701) //<Andrew Clark>// - **[9d483dcfd](facebook/react@9d483dcfd )**: Spelling abitrarily -> arbitrarily (facebook#14710) //<Peter Donald>// - **[e19c9e106](facebook/react@e19c9e106 )**: Fix issue with multiple code branches in hooks linter (facebook#14661) //<Yurick>// - **[f11a9c1cb](facebook/react@f11a9c1cb )**: State update bug in concurrent mode (facebook#14698) //<Brian Vaughn>// - **[e679a4b6e](facebook/react@e679a4b6e )**: Fix typo in code comment (facebook#14696) //<Greg Hurrell>// - **[8bcc88f2e](facebook/react@8bcc88f2e )**: Make all readContext() and Hook-in-a-Hook checks DEV-only (facebook#14677) //<Dan Abramov>// - **[6cb26774e](facebook/react@6cb26774e )**: Enable hooks! (facebook#14679) //<Brian Vaughn>// - **[73962c366](facebook/react@73962c366 )**: Revert "Revert "Double-render function components with Hooks in DEV in StrictMode" (facebook#14652)" (facebook#14654) //<Dan Abramov>// - **[994439228](facebook/react@994439228 )**: Put DEV-only code into DEV blocks (facebook#14673) //<Dan Abramov>// - **[f0befae65](facebook/react@f0befae65 )**: Tweak context invariant message (facebook#14671) //<Dan Abramov>// - **[a129259ad](facebook/react@a129259ad )**: Disallow reading context during useMemo etc (facebook#14653) //<Dan Abramov>// - **[c068d31cc](facebook/react@c068d31cc )**: Add unit tests for concurrent mode event dispatching (facebook#14415) //<Sebastian Markbåge>// - **[38247cba3](facebook/react@38247cba3 )**: --save is no longer needed (facebook#14302) //<SamCortopassi>// - **[3f0bcaf0d](facebook/react@3f0bcaf0d )**: Importing React for the first example. (facebook#14346) //<Ramón Chancay Ortega>// - **[ecd919a2f](facebook/react@ecd919a2f )**: RFC: warn when returning different hooks on subsequent renders (facebook#14585) //<Sunil Pai>// - **[3fbebb2a0](facebook/react@3fbebb2a0 )**: Revert "Double-render function components with Hooks in DEV in StrictMode" (facebook#14652) //<Dan Abramov>// - **[5fce6488c](facebook/react@5fce6488c )**: Revert "Disallow reading context during useMemo etc" (facebook#14651) //<Dan Abramov>// - **[fe2ecd276](facebook/react@fe2ecd276 )**: Add test coverage for readContext() on the server (facebook#14649) //<Dan Abramov>// - **[8f45a7fdc](facebook/react@8f45a7fdc )**: Warn about incorrect use of useImperativeHandle() (facebook#14647) //<Dan Abramov>// - **[1fcbd2243](facebook/react@1fcbd2243 )**: Disallow reading context during useMemo etc (facebook#14648) //<Dan Abramov>// - **[2a084f51a](facebook/react@2a084f51a )**: Warn about refs on lazy function components (facebook#14645) //<Dan Abramov>// - **[b5a3df6e8](facebook/react@b5a3df6e8 )**: Fix typo (facebook#14560) //<Linchengyi>// - **[9c146e675](facebook/react@9c146e675 )**: fix typo (facebook#14316) //<liunian>// - **[baa6d40fc](facebook/react@baa6d40fc )**: Mention forwardRef() in <Fn ref={...} /> errors and warnings (facebook#14644) //<Dan Abramov>// - **[a1414e894](facebook/react@a1414e894 )**: Double-render function components with Hooks in DEV in StrictMode (facebook#14643) //<Dan Abramov>// - **[10a7a5b5c](facebook/react@10a7a5b5c )**: Fix synchronous thenable rejection (facebook#14633) //<Dan Abramov>// - **[a2fa6eb98](facebook/react@a2fa6eb98 )**: Move lazy._result assignment (facebook#14632) //<Dan Abramov>// - **[9120f6c2d](facebook/react@9120f6c2d )**: Support sync thenables for lazy() (facebook#14626) //<Dan Abramov>// - **[b66e6e41e](facebook/react@b66e6e41e )**: Add directory details to the package.json of all packages (facebook#14628) //<Grey Baker>// - **[177fb7635](facebook/react@177fb7635 )**: Warn when second callback is passed to setState/dispatch in Hooks (facebook#14625) //<Dan Abramov>// - **[d17d0b99c](facebook/react@d17d0b99c )**: Use public context.report interface in eslint rules (facebook#14623) //<Sebastian Silbermann>// - **[4f332885a](facebook/react@4f332885a )**: Fix shallow renderer set instance state after gDSFP before calling sCU (facebook#14613) //<Yi-Shan, Chen>// - **[e1cd83e49](facebook/react@e1cd83e49 )**: Throw an error when using hooks inside useMemo/useState/useReducer, or .memo's comparator (facebook#14608) //<Sunil Pai>// - **[be457ca68](facebook/react@be457ca68 )**: Small tweaks to SSR to match facebook#14594 (facebook#14618) //<Dan Abramov>// - **[17d70df91](facebook/react@17d70df91 )**: Warn when mixing createRoot() and old APIs (facebook#14615) //<Dan Abramov>// - **[4feab7fc9](facebook/react@4feab7fc9 )**: Add hooks support to ReactShallowRenderer (facebook#14567) //<Dominic Gannaway>// - **[1454a8be0](facebook/react@1454a8be0 )**: Don't bother comparing constructor when deps are not provided (facebook#14594) //<Andrew Clark>// - **[71b64d521](facebook/react@71b64d521 )**: Warn if number of hooks increases (facebook#14591) //<Andrew Clark>// - **[790c8ef04](facebook/react@790c8ef04 )**: Allow useReducer to bail out of rendering by returning previous state (facebook#14569) //<Andrew Clark>// - **[7ab8a8e97](facebook/react@7ab8a8e97 )**: Added Flow type to keep hooks dispatchers in-sync (facebook#14599) //<Brian Vaughn>// - **[4392e3821](facebook/react@4392e3821 )**: useDebugValue should throw if used in a class component (facebook#14601) //<Brian Vaughn>// - **[153a0b598](facebook/react@153a0b598 )**: Add noop useDebugValue hook to partial/server renderer (facebook#14597) //<Brian Vaughn>// - **[7ad9806d1](facebook/react@7ad9806d1 )**: Tweak to avoid property read (facebook#14593) //<Brandon Dail>// - **[0fc154751](facebook/react@0fc154751 )**: Avoid new Set([iterable]) for thenables (facebook#14592) //<Brandon Dail>// - **[edb1f5956](facebook/react@edb1f5956 )**: Support configurable labels for custom hooks (facebook#14559) //<Brian Vaughn>// - **[3e15b1c69](facebook/react@3e15b1c69 )**: make a fork for ReactCurrentDispatcher (facebook#14588) //<Sunil Pai>// - **[0005d1e3f](facebook/react@0005d1e3f )**: Fix typo (facebook#14576) //<Carl Mungazi>// - **[f290138d3](facebook/react@f290138d3 )**: react-debug-tools accepts currentDispatcher ref as param (facebook#14556) //<Brian Vaughn>// - **[b4ad8e947](facebook/react@b4ad8e947 )**: rename useImperativeMethods -> useImperativeHandle (facebook#14565) //<Sunil Pai>// - **[ab03e3d65](facebook/react@ab03e3d65 )**: Inject ReactCurrentDispatcher ref to DevTools (facebook#14550) //<Brian Vaughn>// - **[19ef0ec11](facebook/react@19ef0ec11 )**: Separate current owner and dispatcher (facebook#14548) //<Brian Vaughn>// - **[a9b035b0c](facebook/react@a9b035b0c )**: Separate Object.is polyfill (facebook#14334) //<Maksim Markelov>// - **[547e059f0](facebook/react@547e059f0 )**: Simplify wording of key warning (facebook#14503) //<Sophie Alpert>// - **[3494ee57e](facebook/react@3494ee57e )**: Update ReactUpdateQueue.js (facebook#14521) //<Carl Mungazi>// - **[659c13963](facebook/react@659c13963 )**: Update ReactFiberScheduler.js (facebook#14477) //<Carl Mungazi>// - **[c695b2384](facebook/react@c695b2384 )**: React v16.7.0 //<Andrew Clark>// - **[1c5aa2f23](facebook/react@1c5aa2f23 )**: Move SchedulerFeatureFlags fork to src directory to fix lint //<Andrew Clark>// - **[653bc582f](facebook/react@653bc582f )**: Create separate SchedulerFeatureFlags instead of using ReactFeatureFlags (facebook#14455) //<Andrew Clark>// - **[8bfef0da5](facebook/react@8bfef0da5 )**: Make scheduler debugging feature flag static //<Andrew Clark>// - **[4a1072194](facebook/react@4a1072194 )**: Memoize promise listeners to prevent exponential growth (facebook#14429) //<Andrew Clark>// - **[535804f5c](facebook/react@535804f5c )**: Removed Fabric-specific feature flag files and updated Rollup to use the (non-Fabric) React Native flag files. (facebook#14437) //<Brian Vaughn>// - **[2743fb7b2](facebook/react@2743fb7b2 )**: Enable hooks by default for FB React Native renderer (facebook#14435) //<Brian Vaughn>// - **[7325ebe4d](facebook/react@7325ebe4d )**: Inject overrideProps() fn to DevTools (facebook#14427) //<Brian Vaughn>// - **[a22880e5e](facebook/react@a22880e5e )**: Add support for Suspense & lazy() to the react-is package (facebook#14423) //<Pleun Vanderbauwhede>// - **[947bddd5c](facebook/react@947bddd5c )**: Remove redundant argument of getPlugins function (facebook#14419) //<Heaven>// - **[8df4d59be](facebook/react@8df4d59be )**: Implement pauseExecution, continueExecution, dumpQueue for Scheduler (facebook#14053) //<Kevin Chavez>// - **[5bb4ad737](facebook/react@5bb4ad737 )**: Added ErrorBoundary tests for useEffect and useLayoutEffect (facebook#14401) //<Brian Vaughn>// - **[98eb5ae53](facebook/react@98eb5ae53 )**: TestRenderer toJSON should not expose the Array wrapper Suspense uses for hidden trees (facebook#14392) //<Brian Vaughn>// - **[39489e767](facebook/react@39489e767 )**: Enable hooks in fabric (facebook#14301) //<Spencer Ahrens>// - **[1dc108e58](facebook/react@1dc108e58 )**: Tweaked wording for v8 "performance cliff" issue //<Brian Vaughn>// Release Notes: [GENERAL] [Changed] - React sync for revisions 6bf5e85...aa94237 (React 16.8.1) Pull Request resolved: facebook#23320 Differential Revision: D13976467 fbshipit-source-id: 4d169f105c8964741cf3d8f9bc192d9955637cea
Summary: This sync includes the following changes: - **[45fc46bfa](facebook/react@45fc46bfa )**: 16.8.1 packages //<Brian Vaughn>// - **[f2e2637c8](facebook/react@f2e2637c8 )**: Backwards compat fix for ReactCurrentDispatcher on older react versions (facebook#14770) //<Brian Vaughn>// - **[1107b9673](facebook/react@1107b9673 )**: [TestUtils.act] warn when using TestUtils.act in node (facebook#14768) //<Sunil Pai>// - **[0975ea327](facebook/react@0975ea327 )**: eslint-plugin-react-hooks v1.0.0 //<Brian Vaughn>// - **[bc9818f24](facebook/react@bc9818f24 )**: Scheduler.unstable_next (facebook#14756) //<Andrew Clark>// - **[ce6ecd3fb](facebook/react@ce6ecd3fb )**: Add 16.8.0 changelog and update some READMEs (facebook#14692) //<Dan Abramov>// - **[008a2ab9c](facebook/react@008a2ab9c )**: 16.8.0 //<Brian Vaughn>// - **[d1326f466](facebook/react@d1326f466 )**: [TestUtils.act] fix return result checking (facebook#14758) //<Sunil Pai>// - **[267ed9814](facebook/react@267ed9814 )**: expose `TestUtils.act()` for batching actions in tests (facebook#14744) //<Sunil Pai>// - **[fb3f7bfde](facebook/react@fb3f7bfde )**: Avoid importing Scheduler directly (facebook#14757) //<Andrew Clark>// - **[e602b5291](facebook/react@e602b5291 )**: Use SameValue instead of === to check for dispatchAction equivalence (facebook#14752) //<Jessica Franco>// - **[e489c3f9c](facebook/react@e489c3f9c )**: Update the version with Hooks proposal in README (facebook#14751) //<SToneX>// - **[c21c41ecf](facebook/react@c21c41ecf )**: Tweak invalid Hook warning and error (facebook#14747) //<Dan Abramov>// - **[fec00a869](facebook/react@fec00a869 )**: Typo in comment (facebook#14739) //<Deniz Susman>// - **[66eb29374](facebook/react@66eb29374 )**: Restrict effect return type to a function or nothing (facebook#14119) //<Andrew Clark>// - **[51c07912a](facebook/react@51c07912a )**: Warn when second argument is passed to useCallback (facebook#14729) //<Dan Abramov>// - **[70d407583](facebook/react@70d407583 )**: Move Hook mismatch warning to first mismatch site (facebook#14720) //<Andrew Clark>// - **[ba6477aa3](facebook/react@ba6477aa3 )**: Improve Reducer Hook's lazy init API (facebook#14723) //<Andrew Clark>// - **[cb1ff430e](facebook/react@cb1ff430e )**: Phased dispatcher (facebook#14701) //<Andrew Clark>// - **[9d483dcfd](facebook/react@9d483dcfd )**: Spelling abitrarily -> arbitrarily (facebook#14710) //<Peter Donald>// - **[e19c9e106](facebook/react@e19c9e106 )**: Fix issue with multiple code branches in hooks linter (facebook#14661) //<Yurick>// - **[f11a9c1cb](facebook/react@f11a9c1cb )**: State update bug in concurrent mode (facebook#14698) //<Brian Vaughn>// - **[e679a4b6e](facebook/react@e679a4b6e )**: Fix typo in code comment (facebook#14696) //<Greg Hurrell>// - **[8bcc88f2e](facebook/react@8bcc88f2e )**: Make all readContext() and Hook-in-a-Hook checks DEV-only (facebook#14677) //<Dan Abramov>// - **[6cb26774e](facebook/react@6cb26774e )**: Enable hooks! (facebook#14679) //<Brian Vaughn>// - **[73962c366](facebook/react@73962c366 )**: Revert "Revert "Double-render function components with Hooks in DEV in StrictMode" (facebook#14652)" (facebook#14654) //<Dan Abramov>// - **[994439228](facebook/react@994439228 )**: Put DEV-only code into DEV blocks (facebook#14673) //<Dan Abramov>// - **[f0befae65](facebook/react@f0befae65 )**: Tweak context invariant message (facebook#14671) //<Dan Abramov>// - **[a129259ad](facebook/react@a129259ad )**: Disallow reading context during useMemo etc (facebook#14653) //<Dan Abramov>// - **[c068d31cc](facebook/react@c068d31cc )**: Add unit tests for concurrent mode event dispatching (facebook#14415) //<Sebastian Markbåge>// - **[38247cba3](facebook/react@38247cba3 )**: --save is no longer needed (facebook#14302) //<SamCortopassi>// - **[3f0bcaf0d](facebook/react@3f0bcaf0d )**: Importing React for the first example. (facebook#14346) //<Ramón Chancay Ortega>// - **[ecd919a2f](facebook/react@ecd919a2f )**: RFC: warn when returning different hooks on subsequent renders (facebook#14585) //<Sunil Pai>// - **[3fbebb2a0](facebook/react@3fbebb2a0 )**: Revert "Double-render function components with Hooks in DEV in StrictMode" (facebook#14652) //<Dan Abramov>// - **[5fce6488c](facebook/react@5fce6488c )**: Revert "Disallow reading context during useMemo etc" (facebook#14651) //<Dan Abramov>// - **[fe2ecd276](facebook/react@fe2ecd276 )**: Add test coverage for readContext() on the server (facebook#14649) //<Dan Abramov>// - **[8f45a7fdc](facebook/react@8f45a7fdc )**: Warn about incorrect use of useImperativeHandle() (facebook#14647) //<Dan Abramov>// - **[1fcbd2243](facebook/react@1fcbd2243 )**: Disallow reading context during useMemo etc (facebook#14648) //<Dan Abramov>// - **[2a084f51a](facebook/react@2a084f51a )**: Warn about refs on lazy function components (facebook#14645) //<Dan Abramov>// - **[b5a3df6e8](facebook/react@b5a3df6e8 )**: Fix typo (facebook#14560) //<Linchengyi>// - **[9c146e675](facebook/react@9c146e675 )**: fix typo (facebook#14316) //<liunian>// - **[baa6d40fc](facebook/react@baa6d40fc )**: Mention forwardRef() in <Fn ref={...} /> errors and warnings (facebook#14644) //<Dan Abramov>// - **[a1414e894](facebook/react@a1414e894 )**: Double-render function components with Hooks in DEV in StrictMode (facebook#14643) //<Dan Abramov>// - **[10a7a5b5c](facebook/react@10a7a5b5c )**: Fix synchronous thenable rejection (facebook#14633) //<Dan Abramov>// - **[a2fa6eb98](facebook/react@a2fa6eb98 )**: Move lazy._result assignment (facebook#14632) //<Dan Abramov>// - **[9120f6c2d](facebook/react@9120f6c2d )**: Support sync thenables for lazy() (facebook#14626) //<Dan Abramov>// - **[b66e6e41e](facebook/react@b66e6e41e )**: Add directory details to the package.json of all packages (facebook#14628) //<Grey Baker>// - **[177fb7635](facebook/react@177fb7635 )**: Warn when second callback is passed to setState/dispatch in Hooks (facebook#14625) //<Dan Abramov>// - **[d17d0b99c](facebook/react@d17d0b99c )**: Use public context.report interface in eslint rules (facebook#14623) //<Sebastian Silbermann>// - **[4f332885a](facebook/react@4f332885a )**: Fix shallow renderer set instance state after gDSFP before calling sCU (facebook#14613) //<Yi-Shan, Chen>// - **[e1cd83e49](facebook/react@e1cd83e49 )**: Throw an error when using hooks inside useMemo/useState/useReducer, or .memo's comparator (facebook#14608) //<Sunil Pai>// - **[be457ca68](facebook/react@be457ca68 )**: Small tweaks to SSR to match facebook#14594 (facebook#14618) //<Dan Abramov>// - **[17d70df91](facebook/react@17d70df91 )**: Warn when mixing createRoot() and old APIs (facebook#14615) //<Dan Abramov>// - **[4feab7fc9](facebook/react@4feab7fc9 )**: Add hooks support to ReactShallowRenderer (facebook#14567) //<Dominic Gannaway>// - **[1454a8be0](facebook/react@1454a8be0 )**: Don't bother comparing constructor when deps are not provided (facebook#14594) //<Andrew Clark>// - **[71b64d521](facebook/react@71b64d521 )**: Warn if number of hooks increases (facebook#14591) //<Andrew Clark>// - **[790c8ef04](facebook/react@790c8ef04 )**: Allow useReducer to bail out of rendering by returning previous state (facebook#14569) //<Andrew Clark>// - **[7ab8a8e97](facebook/react@7ab8a8e97 )**: Added Flow type to keep hooks dispatchers in-sync (facebook#14599) //<Brian Vaughn>// - **[4392e3821](facebook/react@4392e3821 )**: useDebugValue should throw if used in a class component (facebook#14601) //<Brian Vaughn>// - **[153a0b598](facebook/react@153a0b598 )**: Add noop useDebugValue hook to partial/server renderer (facebook#14597) //<Brian Vaughn>// - **[7ad9806d1](facebook/react@7ad9806d1 )**: Tweak to avoid property read (facebook#14593) //<Brandon Dail>// - **[0fc154751](facebook/react@0fc154751 )**: Avoid new Set([iterable]) for thenables (facebook#14592) //<Brandon Dail>// - **[edb1f5956](facebook/react@edb1f5956 )**: Support configurable labels for custom hooks (facebook#14559) //<Brian Vaughn>// - **[3e15b1c69](facebook/react@3e15b1c69 )**: make a fork for ReactCurrentDispatcher (facebook#14588) //<Sunil Pai>// - **[0005d1e3f](facebook/react@0005d1e3f )**: Fix typo (facebook#14576) //<Carl Mungazi>// - **[f290138d3](facebook/react@f290138d3 )**: react-debug-tools accepts currentDispatcher ref as param (facebook#14556) //<Brian Vaughn>// - **[b4ad8e947](facebook/react@b4ad8e947 )**: rename useImperativeMethods -> useImperativeHandle (facebook#14565) //<Sunil Pai>// - **[ab03e3d65](facebook/react@ab03e3d65 )**: Inject ReactCurrentDispatcher ref to DevTools (facebook#14550) //<Brian Vaughn>// - **[19ef0ec11](facebook/react@19ef0ec11 )**: Separate current owner and dispatcher (facebook#14548) //<Brian Vaughn>// - **[a9b035b0c](facebook/react@a9b035b0c )**: Separate Object.is polyfill (facebook#14334) //<Maksim Markelov>// - **[547e059f0](facebook/react@547e059f0 )**: Simplify wording of key warning (facebook#14503) //<Sophie Alpert>// - **[3494ee57e](facebook/react@3494ee57e )**: Update ReactUpdateQueue.js (facebook#14521) //<Carl Mungazi>// - **[659c13963](facebook/react@659c13963 )**: Update ReactFiberScheduler.js (facebook#14477) //<Carl Mungazi>// - **[c695b2384](facebook/react@c695b2384 )**: React v16.7.0 //<Andrew Clark>// - **[1c5aa2f23](facebook/react@1c5aa2f23 )**: Move SchedulerFeatureFlags fork to src directory to fix lint //<Andrew Clark>// - **[653bc582f](facebook/react@653bc582f )**: Create separate SchedulerFeatureFlags instead of using ReactFeatureFlags (facebook#14455) //<Andrew Clark>// - **[8bfef0da5](facebook/react@8bfef0da5 )**: Make scheduler debugging feature flag static //<Andrew Clark>// - **[4a1072194](facebook/react@4a1072194 )**: Memoize promise listeners to prevent exponential growth (facebook#14429) //<Andrew Clark>// - **[535804f5c](facebook/react@535804f5c )**: Removed Fabric-specific feature flag files and updated Rollup to use the (non-Fabric) React Native flag files. (facebook#14437) //<Brian Vaughn>// - **[2743fb7b2](facebook/react@2743fb7b2 )**: Enable hooks by default for FB React Native renderer (facebook#14435) //<Brian Vaughn>// - **[7325ebe4d](facebook/react@7325ebe4d )**: Inject overrideProps() fn to DevTools (facebook#14427) //<Brian Vaughn>// - **[a22880e5e](facebook/react@a22880e5e )**: Add support for Suspense & lazy() to the react-is package (facebook#14423) //<Pleun Vanderbauwhede>// - **[947bddd5c](facebook/react@947bddd5c )**: Remove redundant argument of getPlugins function (facebook#14419) //<Heaven>// - **[8df4d59be](facebook/react@8df4d59be )**: Implement pauseExecution, continueExecution, dumpQueue for Scheduler (facebook#14053) //<Kevin Chavez>// - **[5bb4ad737](facebook/react@5bb4ad737 )**: Added ErrorBoundary tests for useEffect and useLayoutEffect (facebook#14401) //<Brian Vaughn>// - **[98eb5ae53](facebook/react@98eb5ae53 )**: TestRenderer toJSON should not expose the Array wrapper Suspense uses for hidden trees (facebook#14392) //<Brian Vaughn>// - **[39489e767](facebook/react@39489e767 )**: Enable hooks in fabric (facebook#14301) //<Spencer Ahrens>// - **[1dc108e58](facebook/react@1dc108e58 )**: Tweaked wording for v8 "performance cliff" issue //<Brian Vaughn>// Release Notes: [GENERAL] [Changed] - React sync for revisions 6bf5e85...aa94237 (React 16.8.1) Pull Request resolved: facebook#23320 Differential Revision: D13976467 fbshipit-source-id: 9e11552268883db8672d11cf489d3a5949f498b7
…ction 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 facebook#14618 Differential Revision: D5459593 Pulled By: shergin fbshipit-source-id: f1e6c5d572bb3e2669fbd4ba7d0fbb106525280e
Summary: allow-large-files This sync includes the following changes: - **[45fc46bfa](facebook/react@45fc46bfa )**: 16.8.1 packages //<Brian Vaughn>// - **[f2e2637c8](facebook/react@f2e2637c8 )**: Backwards compat fix for ReactCurrentDispatcher on older react versions (#14770) //<Brian Vaughn>// - **[1107b9673](facebook/react@1107b9673 )**: [TestUtils.act] warn when using TestUtils.act in node (#14768) //<Sunil Pai>// - **[0975ea327](facebook/react@0975ea327 )**: eslint-plugin-react-hooks v1.0.0 //<Brian Vaughn>// - **[bc9818f24](facebook/react@bc9818f24 )**: Scheduler.unstable_next (#14756) //<Andrew Clark>// - **[ce6ecd3fb](facebook/react@ce6ecd3fb )**: Add 16.8.0 changelog and update some READMEs (#14692) //<Dan Abramov>// - **[008a2ab9c](facebook/react@008a2ab9c )**: 16.8.0 //<Brian Vaughn>// - **[d1326f466](facebook/react@d1326f466 )**: [TestUtils.act] fix return result checking (#14758) //<Sunil Pai>// - **[267ed9814](facebook/react@267ed9814 )**: expose `TestUtils.act()` for batching actions in tests (#14744) //<Sunil Pai>// - **[fb3f7bfde](facebook/react@fb3f7bfde )**: Avoid importing Scheduler directly (#14757) //<Andrew Clark>// - **[e602b5291](facebook/react@e602b5291 )**: Use SameValue instead of === to check for dispatchAction equivalence (#14752) //<Jessica Franco>// - **[e489c3f9c](facebook/react@e489c3f9c )**: Update the version with Hooks proposal in README (#14751) //<SToneX>// - **[c21c41ecf](facebook/react@c21c41ecf )**: Tweak invalid Hook warning and error (#14747) //<Dan Abramov>// - **[fec00a869](facebook/react@fec00a869 )**: Typo in comment (#14739) //<Deniz Susman>// - **[66eb29374](facebook/react@66eb29374 )**: Restrict effect return type to a function or nothing (#14119) //<Andrew Clark>// - **[51c07912a](facebook/react@51c07912a )**: Warn when second argument is passed to useCallback (#14729) //<Dan Abramov>// - **[70d407583](facebook/react@70d407583 )**: Move Hook mismatch warning to first mismatch site (#14720) //<Andrew Clark>// - **[ba6477aa3](facebook/react@ba6477aa3 )**: Improve Reducer Hook's lazy init API (#14723) //<Andrew Clark>// - **[cb1ff430e](facebook/react@cb1ff430e )**: Phased dispatcher (#14701) //<Andrew Clark>// - **[9d483dcfd](facebook/react@9d483dcfd )**: Spelling abitrarily -> arbitrarily (#14710) //<Peter Donald>// - **[e19c9e106](facebook/react@e19c9e106 )**: Fix issue with multiple code branches in hooks linter (#14661) //<Yurick>// - **[f11a9c1cb](facebook/react@f11a9c1cb )**: State update bug in concurrent mode (#14698) //<Brian Vaughn>// - **[e679a4b6e](facebook/react@e679a4b6e )**: Fix typo in code comment (#14696) //<Greg Hurrell>// - **[8bcc88f2e](facebook/react@8bcc88f2e )**: Make all readContext() and Hook-in-a-Hook checks DEV-only (#14677) //<Dan Abramov>// - **[6cb26774e](facebook/react@6cb26774e )**: Enable hooks! (#14679) //<Brian Vaughn>// - **[73962c366](facebook/react@73962c366 )**: Revert "Revert "Double-render function components with Hooks in DEV in StrictMode" (#14652)" (#14654) //<Dan Abramov>// - **[994439228](facebook/react@994439228 )**: Put DEV-only code into DEV blocks (#14673) //<Dan Abramov>// - **[f0befae65](facebook/react@f0befae65 )**: Tweak context invariant message (#14671) //<Dan Abramov>// - **[a129259ad](facebook/react@a129259ad )**: Disallow reading context during useMemo etc (#14653) //<Dan Abramov>// - **[c068d31cc](facebook/react@c068d31cc )**: Add unit tests for concurrent mode event dispatching (#14415) //<Sebastian Markbåge>// - **[38247cba3](facebook/react@38247cba3 )**: --save is no longer needed (#14302) //<SamCortopassi>// - **[3f0bcaf0d](facebook/react@3f0bcaf0d )**: Importing React for the first example. (#14346) //<Ramón Chancay Ortega>// - **[ecd919a2f](facebook/react@ecd919a2f )**: RFC: warn when returning different hooks on subsequent renders (#14585) //<Sunil Pai>// - **[3fbebb2a0](facebook/react@3fbebb2a0 )**: Revert "Double-render function components with Hooks in DEV in StrictMode" (#14652) //<Dan Abramov>// - **[5fce6488c](facebook/react@5fce6488c )**: Revert "Disallow reading context during useMemo etc" (#14651) //<Dan Abramov>// - **[fe2ecd276](facebook/react@fe2ecd276 )**: Add test coverage for readContext() on the server (#14649) //<Dan Abramov>// - **[8f45a7fdc](facebook/react@8f45a7fdc )**: Warn about incorrect use of useImperativeHandle() (#14647) //<Dan Abramov>// - **[1fcbd2243](facebook/react@1fcbd2243 )**: Disallow reading context during useMemo etc (#14648) //<Dan Abramov>// - **[2a084f51a](facebook/react@2a084f51a )**: Warn about refs on lazy function components (#14645) //<Dan Abramov>// - **[b5a3df6e8](facebook/react@b5a3df6e8 )**: Fix typo (#14560) //<Linchengyi>// - **[9c146e675](facebook/react@9c146e675 )**: fix typo (#14316) //<liunian>// - **[baa6d40fc](facebook/react@baa6d40fc )**: Mention forwardRef() in <Fn ref={...} /> errors and warnings (#14644) //<Dan Abramov>// - **[a1414e894](facebook/react@a1414e894 )**: Double-render function components with Hooks in DEV in StrictMode (#14643) //<Dan Abramov>// - **[10a7a5b5c](facebook/react@10a7a5b5c )**: Fix synchronous thenable rejection (#14633) //<Dan Abramov>// - **[a2fa6eb98](facebook/react@a2fa6eb98 )**: Move lazy._result assignment (#14632) //<Dan Abramov>// - **[9120f6c2d](facebook/react@9120f6c2d )**: Support sync thenables for lazy() (#14626) //<Dan Abramov>// - **[b66e6e41e](facebook/react@b66e6e41e )**: Add directory details to the package.json of all packages (#14628) //<Grey Baker>// - **[177fb7635](facebook/react@177fb7635 )**: Warn when second callback is passed to setState/dispatch in Hooks (#14625) //<Dan Abramov>// - **[d17d0b99c](facebook/react@d17d0b99c )**: Use public context.report interface in eslint rules (#14623) //<Sebastian Silbermann>// - **[4f332885a](facebook/react@4f332885a )**: Fix shallow renderer set instance state after gDSFP before calling sCU (#14613) //<Yi-Shan, Chen>// - **[e1cd83e49](facebook/react@e1cd83e49 )**: Throw an error when using hooks inside useMemo/useState/useReducer, or .memo's comparator (#14608) //<Sunil Pai>// - **[be457ca68](facebook/react@be457ca68 )**: Small tweaks to SSR to match #14594 (#14618) //<Dan Abramov>// - **[17d70df91](facebook/react@17d70df91 )**: Warn when mixing createRoot() and old APIs (#14615) //<Dan Abramov>// - **[4feab7fc9](facebook/react@4feab7fc9 )**: Add hooks support to ReactShallowRenderer (#14567) //<Dominic Gannaway>// - **[1454a8be0](facebook/react@1454a8be0 )**: Don't bother comparing constructor when deps are not provided (#14594) //<Andrew Clark>// - **[71b64d521](facebook/react@71b64d521 )**: Warn if number of hooks increases (#14591) //<Andrew Clark>// - **[790c8ef04](facebook/react@790c8ef04 )**: Allow useReducer to bail out of rendering by returning previous state (#14569) //<Andrew Clark>// - **[7ab8a8e97](facebook/react@7ab8a8e97 )**: Added Flow type to keep hooks dispatchers in-sync (#14599) //<Brian Vaughn>// - **[4392e3821](facebook/react@4392e3821 )**: useDebugValue should throw if used in a class component (#14601) //<Brian Vaughn>// - **[153a0b598](facebook/react@153a0b598 )**: Add noop useDebugValue hook to partial/server renderer (#14597) //<Brian Vaughn>// - **[7ad9806d1](facebook/react@7ad9806d1 )**: Tweak to avoid property read (#14593) //<Brandon Dail>// - **[0fc154751](facebook/react@0fc154751 )**: Avoid new Set([iterable]) for thenables (#14592) //<Brandon Dail>// - **[edb1f5956](facebook/react@edb1f5956 )**: Support configurable labels for custom hooks (#14559) //<Brian Vaughn>// - **[3e15b1c69](facebook/react@3e15b1c69 )**: make a fork for ReactCurrentDispatcher (#14588) //<Sunil Pai>// - **[0005d1e3f](facebook/react@0005d1e3f )**: Fix typo (#14576) //<Carl Mungazi>// - **[f290138d3](facebook/react@f290138d3 )**: react-debug-tools accepts currentDispatcher ref as param (#14556) //<Brian Vaughn>// - **[b4ad8e947](facebook/react@b4ad8e947 )**: rename useImperativeMethods -> useImperativeHandle (#14565) //<Sunil Pai>// - **[ab03e3d65](facebook/react@ab03e3d65 )**: Inject ReactCurrentDispatcher ref to DevTools (#14550) //<Brian Vaughn>// - **[19ef0ec11](facebook/react@19ef0ec11 )**: Separate current owner and dispatcher (#14548) //<Brian Vaughn>// - **[a9b035b0c](facebook/react@a9b035b0c )**: Separate Object.is polyfill (#14334) //<Maksim Markelov>// - **[547e059f0](facebook/react@547e059f0 )**: Simplify wording of key warning (#14503) //<Sophie Alpert>// - **[3494ee57e](facebook/react@3494ee57e )**: Update ReactUpdateQueue.js (#14521) //<Carl Mungazi>// - **[659c13963](facebook/react@659c13963 )**: Update ReactFiberScheduler.js (#14477) //<Carl Mungazi>// - **[c695b2384](facebook/react@c695b2384 )**: React v16.7.0 //<Andrew Clark>// - **[1c5aa2f23](facebook/react@1c5aa2f23 )**: Move SchedulerFeatureFlags fork to src directory to fix lint //<Andrew Clark>// - **[653bc582f](facebook/react@653bc582f )**: Create separate SchedulerFeatureFlags instead of using ReactFeatureFlags (#14455) //<Andrew Clark>// - **[8bfef0da5](facebook/react@8bfef0da5 )**: Make scheduler debugging feature flag static //<Andrew Clark>// - **[4a1072194](facebook/react@4a1072194 )**: Memoize promise listeners to prevent exponential growth (#14429) //<Andrew Clark>// - **[535804f5c](facebook/react@535804f5c )**: Removed Fabric-specific feature flag files and updated Rollup to use the (non-Fabric) React Native flag files. (#14437) //<Brian Vaughn>// - **[2743fb7b2](facebook/react@2743fb7b2 )**: Enable hooks by default for FB React Native renderer (#14435) //<Brian Vaughn>// - **[7325ebe4d](facebook/react@7325ebe4d )**: Inject overrideProps() fn to DevTools (#14427) //<Brian Vaughn>// - **[a22880e5e](facebook/react@a22880e5e )**: Add support for Suspense & lazy() to the react-is package (#14423) //<Pleun Vanderbauwhede>// - **[947bddd5c](facebook/react@947bddd5c )**: Remove redundant argument of getPlugins function (#14419) //<Heaven>// - **[8df4d59be](facebook/react@8df4d59be )**: Implement pauseExecution, continueExecution, dumpQueue for Scheduler (#14053) //<Kevin Chavez>// - **[5bb4ad737](facebook/react@5bb4ad737 )**: Added ErrorBoundary tests for useEffect and useLayoutEffect (#14401) //<Brian Vaughn>// - **[98eb5ae53](facebook/react@98eb5ae53 )**: TestRenderer toJSON should not expose the Array wrapper Suspense uses for hidden trees (#14392) //<Brian Vaughn>// - **[39489e767](facebook/react@39489e767 )**: Enable hooks in fabric (#14301) //<Spencer Ahrens>// - **[1dc108e58](facebook/react@1dc108e58 )**: Tweaked wording for v8 "performance cliff" issue //<Brian Vaughn>// Release Notes: [GENERAL] [Changed] - React sync for revisions 6bf5e85...aa94237 (React 16.8.1) Pull Request resolved: #23320 Reviewed By: rickhanlonii Differential Revision: D13976467 fbshipit-source-id: 4ce198e86a54658e1c35aa36bffe4a7dc2956a2e
This change intends to fix 2 issues with the NetInfo API:
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:
fetch
method is deprecated in favor ofgetConnection
change
event is deprecated in favor of theconnectionchange
event.getConnection
/connectionchange
use a new set of enum values compared tofetch
/change
. See the documentation for the new values.cell
is now known ascellular
. 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.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 aplatformValue
key that exposes the platform's enum values directly (like the oldfetch
API did).getConnection
andconnectionchange
each expose an object which has 2 keys conveying aConnectionType
(e.g. wifi, cellular) and anEffectiveConnectionType
(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 anavigation.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 aneffectiveConnectionType
and I figured it was worth representing this possibility explicitly with "unknown" instead of implicitly withnull
.Test Plan (required)
Verified that the methods (
fetch
andgetConnection
) and the events (change
andconnectionchange
) 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.