Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/26143
A new useColorScheme hook is provided as the preferred way of accessing the user's preferred color scheme (aka Dark Mode).
Changelog:
[General] [Added] - useColorScheme hook
Reviewed By: yungsters
Differential Revision: D16860954
fbshipit-source-id: 8a2b6c2624ed7cf431ab331158bc5456cde1f185
Summary: Bump eslint-plugin-relay version to 1.3.10 which contains fix for JS errors that blocks enabling the rules.
Reviewed By: kassens
Differential Revision: D17052055
fbshipit-source-id: 74867c16d128d2c0767e92861575ffcbe20370cc
Summary:
This Diff is being posted for discussion purposes. It will not be ready to land until React DevTools v4 has been published to NPM.
Update React Native to be compatible with the [new version 4 React DevTools extension](https://github.com/bvaughn/react-devtools-experimental).
**Note that this is a breaking change**, as the version 3 and version 4 backends are **not compatible**. Once this update ships (in React Native) users will be required to update their version of the [`react-devtools` NPM package](https://www.npmjs.com/package/react-devtools). The same will be true for IDEs like Nuclide as well as other developer tools like Flipper and [React Native Debugger](https://github.com/jhen0409/react-native-debugger).
Related changes also included in this diff are:
* Pass an explicit whitelist of style props for the React Native style editor (to improve developer experience when adding new styles).
* Update `YellowBox` console patching to coordinate with DevTools own console patching.
* Also improved formatting slightly by not calling `stringifySafe` for strings (since this adds visible quotation marks).
Regarding the console patching- component stacks will be appended by default when there's no DevTools frontend open. The frontend will provide an option to turn this behavior off though:
{F168852162}
React DevTools will detect if the new version is used with an older version of React Native, and offer inline upgrade instructions:
{F169306863}
**Note that the change to the `RCTEnableTurboModule` will not be included in this Diff**. I've just turned those off temporarily so I can use v8+Chrome for debugging.
Reviewed By: rickhanlonii
Differential Revision: D15973709
fbshipit-source-id: bb9d83fc829af4693e7a10a622acc95a411a48e4
Summary: This catches some errors about hooks being used at the top level in a module
Reviewed By: gaearon
Differential Revision: D16945591
fbshipit-source-id: 116ed24b4394b1f516a2ebcd75977d2ba5c57afb
Summary:
Bumps the CLI to v3 alpha which includes Metro 0.56
## Changelog
[Internal] [Changed] - Bump CLI to ^3.0.0-alpha.1
Pull Request resolved: https://github.com/facebook/react-native/pull/26028
Test Plan: None
Differential Revision: D16763732
Pulled By: cpojer
fbshipit-source-id: 8f35fb80913f623cb44d37208f49040d4a33b07b
Summary:
I created a new test project today using RN 0.60.3 and saw that prettier is now used with eslint. After looking at the `react-native-community` eslint config, I notice that it wasn't using the [recommended configuration](https://github.com/prettier/eslint-plugin-prettier#recommended-configuration) of `eslint-plugin-prettier`
This PR adds the `eslint-config-prettier` to avoid conflicts between eslint and prettier, it also adds the `prettier/react` config to avoid problems with the `eslint-plugin-react`.
## Changelog
[General] [Changed] - Use eslint-plugin-prettier recommended config
Pull Request resolved: https://github.com/facebook/react-native/pull/25674
Test Plan: - ✅ Ensure there is no difference on this repo (no ESLint errors, same number of warnings, and no changes when running prettier).
Differential Revision: D16666178
Pulled By: cpojer
fbshipit-source-id: 70f81db793866acc88388b7b00a496aab5e0b156
Summary: Brings in https://github.com/facebook/react/pull/16302. We were passing roots to a wrong renderer, hence a confusing Fabric-only crash.
Reviewed By: JoshuaGross
Differential Revision: D16672454
fbshipit-source-id: 115894eb375b50da09d145c57f15c7d5668b926d
Summary: Had to split it out if Jest because of tomocchino's patents. I hate it. Anyway, I brought it back into RN because I can't live without it.
Reviewed By: rubennorte
Differential Revision: D16560078
fbshipit-source-id: c394e248dcd048866a31a7b08b233d8966af9ee3
Summary:
It appears that Electron (or the version of Chromium it uses) has a bug that causes a `webview` process to crash if `URL.createObjectURL` is used.
Before releasing `react-devtools-core` 3.5.0, we updated Webpack and the loaders we used. Apparently the version of `style-loader` we now use makes use of the `URL.createObjectURL` API for CSS source maps. This triggers the `webview` crash I mentioned above.
The fix for this is to disable CSS source maps, in which case the loader just uses a `<style>` tag. This diff updates Nuclide to pull in this fixed version.
Reviewed By: bestander
Differential Revision: D16518772
fbshipit-source-id: a779b7d310f869793fa05988d138ce6a46840d8c
Summary:
Yesterday we shipped hermesengine.dev as part of the current 0.60 release. This PR brings those changes to master.
## Changelog
[General] [Added] - Added support for Hermes
Pull Request resolved: https://github.com/facebook/react-native/pull/25613
Test Plan:
* CI is green both on GitHub and at FB
* Creating a new app from source can use Hermes on Android
Reviewed By: cpojer
Differential Revision: D16221777
Pulled By: willholen
fbshipit-source-id: aa6be10537863039cb666292465ba2e1d44b64ef
Summary:
This updates `react-refresh` to 0.3.0 which brings a new feature: we can now detect if the root fails on _the initial mount_. In that case we currently can't recover with Fast Refresh because we don't know which element to retry mounting. (In the future, we can lift this limitation, but it would require more changes in React renderer.)
Before this diff, after you fix an error on initial mount, you would see a blank screen (because nothing managed to mount).
After this diff, after you fix an error on initial mount, you would fall back to a full reload.
This diff doesn't affect errors on updates. We can recover from those, just like before.
Reviewed By: cpojer
Differential Revision: D16440836
fbshipit-source-id: 4a414202a9eab894acd7baa0525c25ff003dd323
Summary:
Update to the latest React DevTools v3 release, which adds the ability to detect when the (v3) frontend is connected with a v4 backend and shows update instructions to the user.
## Changelog:
[General] [Added] - Updated embedded react-devtools-core package to the latest version in preparation for the upcoming v4 DevTools release.
Reviewed By: rickhanlonii
Differential Revision: D16419553
fbshipit-source-id: a36b0ba5bf6992a490f1234b9a92b8abd4c9b3e6
Summary:
Bump the React Native CLI to ^2.0.1 as it's just released now. Comes with fixes to autolinking, helpful warnings and upgrading.
## Changelog
[Internal] [Change] - Bump CLI to ^2.0.1
Pull Request resolved: https://github.com/facebook/react-native/pull/25472
Test Plan: Nothing breaks
Differential Revision: D16107705
Pulled By: cpojer
fbshipit-source-id: 1019330d434294c434b9a9d835dff67e7b3939dd
Summary: Version bump for a minor Babel transform bugfix.
Reviewed By: motiz88
Differential Revision: D16093422
fbshipit-source-id: c1c2181a1cd75d78765e9d951e0bc001eff77bb9
Summary: This bumps the dependency so I can get a new export I added.
Reviewed By: rickhanlonii
Differential Revision: D16030064
fbshipit-source-id: 2b539f04d4fbc21c097c0f1d1d1e7b59f376a894
Summary: This updates the renderer and Fresh packages to pull in the new error handling behavior. The new feature is that roots that errored on last save get remounted after an edit. This allows much faster iteration in the Fast Refresh mode as you don't need to do a full reload after typos.
Reviewed By: bvaughn
Differential Revision: D15967396
fbshipit-source-id: 96a82e6a4e00a8cb636d7bca037a1a43552a4cd2
Summary:
This pulls in the latest package updates for Fresh. It doesn't have any user-observable behavior.
The renderer is rebuilt on top of the last cherry-picked sync. I cherry-picked https://github.com/facebook/react/pull/15928 on top of it.
Reviewed By: rickhanlonii
Differential Revision: D15901887
fbshipit-source-id: ccd974f79e4c0a2a8a8cab0d472deeaedf1e3ddd
Summary:
This adds the Fresh Babel plugin and runtime to React Native dependencies. **They're not actually being used or enabled yet**. This is purely additive and just gets the deps setup out of the way for future diffs.
The `react-refresh` source of truth is in the React repo.
Reviewed By: cpojer
Differential Revision: D15828330
fbshipit-source-id: 67ec2dea8c896477ff8b434445f1730e388ea67a
Summary:
The RC1 of the CLI upgrades Metro to 0.54.1 to be compatible with 0.60 and master and fixes an issue with haste backwards compatibility.
cc kelset
## Changelog
[General] [Changed] - Bump CLI to 2.0.0-rc.1
Pull Request resolved: https://github.com/facebook/react-native/pull/25190
Differential Revision: D15737249
Pulled By: cpojer
fbshipit-source-id: a39747620a7652507d29f5dadb6a4bdc9c1393f0
Summary:
Upgrading the CLI to the latest with a bunch of fixes and features included.
## Changelog
[General] [Changed] - Bump CLI to 2.0.0-rc.0
Pull Request resolved: https://github.com/facebook/react-native/pull/25175
Differential Revision: D15694764
Pulled By: cpojer
fbshipit-source-id: 25fbf1c275ed5379e1cdb372512b6bb6327dea92
Summary:
The original reason for vendoring the fetch polyfill was to remove the default blob response type but this was reverted.
Here's a little history around the fetch polyfill and the blob issue:
- Original commit introducing the vendored polyfill: #19333, the goal was to fix a memory leak because our blob implementation doesn't release resources automatically. Not an ideal fix but since the issue was pretty severe and the infra for a proper fix was not in place.
- This introduced an issue when downloading images using `fetch` which was fixed by #22063 which re-added the default blob content type. However that re-introduced the original fetch memory leak.
- We have better infra now with jsi and I was able to get blob deallocation working, see #24405
Currently the vendored fetch polyfill is useless since it was changed back to the original version. We can just use the npm version again. I also updated to 3.0 which brings better spec compliance and support for cancellation via `AbortController`, https://github.com/github/fetch/releases/tag/v3.0.0.
## Changelog
[General] [Changed] - Remove vendored fetch polyfill, update to whatwg-fetch@3.0
Pull Request resolved: https://github.com/facebook/react-native/pull/24418
Differential Revision: D14932683
Pulled By: cpojer
fbshipit-source-id: 915e3d25978e8b9d7507ed807e7fba45aa88385a
Summary:
Updates the CLI version to the latest alpha to fix some issues around init and autolinking. Please port this PR back to `0.60-stable` branch as it fixes an issue with `npx react-native init`.
cc grabbou hramos
## Changelog
[General] [Fix] - Upgrade CLI to latest alpha
Pull Request resolved: https://github.com/facebook/react-native/pull/25094
Differential Revision: D15558082
Pulled By: cpojer
fbshipit-source-id: 60be64fbed996b6667eddc08346b07475dbb5089
Summary:
This is an ESLint plugin that infers whether an import looks like a Haste module name. To keep the linter fast and simple, it does not look in the Haste map. Instead, it looks for uppercase characters in single-name import paths, since npm has disallowed uppercase letters in package names for a long time. There are some false negatives (e.g. "merge" is a Haste module and this linter rule would not pick it up) but those are about 1.1% of the module names in the RN repo, and unit tests and integration tests will fail anyway once Haste is turned off.
You can disable the lint rule on varying granular levels with ESLint's normal disabling/enabling mechanisms.
Also rewrote more Haste imports so that the linter passes (i.e. fixed lint errors as part of this PR).
## Changelog
[General] [Changed] - Add a lint rule to disallow Haste imports
Pull Request resolved: https://github.com/facebook/react-native/pull/25058
Differential Revision: D15515826
Pulled By: cpojer
fbshipit-source-id: d58a3c30dfe0887f8a530e3393af4af5a1ec1cac
Summary:
PR https://github.com/facebook/react-native/pull/24843 broke Android tests because of a regression we introduced in terms of passing `reporter` argument to Metro config. This was fixed in latest `alpha.20` release of CLI
## Changelog
[General] [Fix] - update CLI to alpha.20 to fix Android tests
Pull Request resolved: https://github.com/facebook/react-native/pull/24869
Reviewed By: rickhanlonii
Differential Revision: D15355144
Pulled By: cpojer
fbshipit-source-id: faafd8098c708845264b7164557076bce45ea332
Summary:
This PR is related to #24760 and adds the `openURLInBrowser` functionality introduced on react-native-community/cli#383.
[General] [Changed] - Open links from new app in computer's browser.
Pull Request resolved: https://github.com/facebook/react-native/pull/24843
Reviewed By: rickhanlonii
Differential Revision: D15334011
Pulled By: cpojer
fbshipit-source-id: 947ad1b113923989cf706e60851e02a87e1099e8
Summary:
ReactNativeRenderer has `require('scheduler')` in it but we don't seem to declare a dependency. As a result, the latest sync broke `useEffect` in open source master:
```js
function Counter() {
const [count, setCount] = useState(0);
useEffect(() => {
const id = setInterval(() => {
setCount(c => c + 1);
}, 1000)
return () => clearInterval(id);
}, [])
return <View><Text>{count}</Text></View>
}
```
<img width="535" alt="Screen Shot 2019-05-10 at 3 26 05 PM" src="https://user-images.githubusercontent.com/810438/57535832-e04dc000-733a-11e9-8e3e-d685171ec55a.png">
This adds an explicit dependency on the same version we're currently using internally.
<img width="535" alt="Screen Shot 2019-05-10 at 3 47 42 PM" src="https://user-images.githubusercontent.com/810438/57535886-f65b8080-733a-11e9-82c3-78e6c3a3888b.png">
Pull Request resolved: https://github.com/facebook/react-native/pull/24802
Differential Revision: D15295252
Pulled By: hramos
fbshipit-source-id: cd897ac590de1b719f28234f7631b0dcc069d043
Summary:
packagingOptions.pickFirst is unreliable that we could not specify which library will be used.
If user have other third party libraries, the story is more complicated.
From the framework point of view, it is better to drop the pickFirst.
In jsc-android 241213.1.0, we did two things:
1. Remove libc++_shared.so in AAR to prevent the conflict with RN.
2. Build by NDK r17c, which aligned with current RN NDK version.
In this commit, I also revert the pickFirst for JSC.
pickFirst JSC also makes upgrade JSC unreliable.
Currently a lot of user report JSC crash issues, those crash issues may relate to JIT and hard to reproduce in-house.
My plan is to make sure user could choose another JSC build easier,
i.e. only to `yarn add 'jsc-android@latest'`.
We could then propose some experimented JSC build for user to check
if the build could help them to fix the crash issue.
[Android] [Fixed] - Remove unreliable packagingOptions.pickFirst for libc++_shared.so and libjsc.so
NOTE that this may not need to add the changelog, as RN 0.59 does not have pickFirst.
This will also reduce a breaking change for upgrade from RN 0.59 or before.
Pull Request resolved: https://github.com/facebook/react-native/pull/24672
Differential Revision: D15164536
Pulled By: cpojer
fbshipit-source-id: 9fc897a77409173a5841f325b38e2836bb07f599
Summary:
This fixes an issue where the Prettier config was set to the `fb` (Facebook) values for all users of the `react-native-community/eslint-config` package. This was due to [this line](8f186b84ae/packages/eslint-config-react-native-community/index.js (L219)) in the config file.
It was causing issues like these:
* Errors when using newer versions of `eslint-plugin-prettier` (you had to use a version that was >1 year old): https://github.com/facebook/react-native/issues/24564
* Errors due to the Prettier parser being forced to be `flow` when using Typescript: https://github.com/typescript-eslint/typescript-eslint/issues/481
This PR:
* Changes that line to remove the explicit `fb` config so users can set their own.
* Moves the React Native Prettier config to `.prettierrc` so ESLint, Prettier, and code editors can all read from the same place.
* Upgrades both `prettier` and the `eslint-plugin-prettier` to the latest versions.
[General] [Fixed] - Stopped the Prettier config being set for all users of react-native-community/eslint-config
Pull Request resolved: https://github.com/facebook/react-native/pull/24635
Differential Revision: D15122200
Pulled By: cpojer
fbshipit-source-id: 56bae8a7f2d8e133b1d808091a6b73302b94d2ed
Summary:
Updates React Native to use latest CLI.
Changes:
- No more `--reactNativePath`, define it once in the configuration file. This reverts the previous PR that added this flag
- Add `platforms` and `commands` - React Native now defines platform like any other package. There's no longer concept of "out-of-tree" platform. All are treated equally. If React Native works, any other platform will work too.
- Updates `jest/hasteImpl.js` to use public CLI interface (`loadConfig`) instead of `findPlugins` and removes a weird conditional that checks for CI presence.
[INTERNAL] - Update React Native CLI
Pull Request resolved: https://github.com/facebook/react-native/pull/24517
Differential Revision: D15044762
Pulled By: cpojer
fbshipit-source-id: 379b61e842e619312c542173219a7d326663cf24