-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Modified deepFreezeAndThrowOnMutationInDev to use Object.prototype.ha… #19598
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…sOwnProperty.call Added unit test to verify the new change allow objects with no prototype to be passed to this method without error.
facebook-github-bot
added
the
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
label
Jun 7, 2018
facebook-github-bot
added
the
Import Started
This pull request has been imported. This does not imply the PR has been approved.
label
Jun 7, 2018
facebook-github-bot
approved these changes
Jun 7, 2018
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.
@TheSavior is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
hramos
pushed a commit
to hramos/react-native
that referenced
this pull request
Jun 8, 2018
facebook#19598) Summary: This PR fixes a bug in `deepFreezeAndThrowOnMutationInDev` which did not take into account that objects passed to it may have been created with `Object.create(null)` and thus may not have a prototype. Such objects don't have the methods `hasOwnProperty`, `__defineGetter__`, or `__defineSetter__` on the instance. I ran into an unrecoverable error in React Native when passing this type of object across the bridge because `deepFreezeAndThrowOnMutationInDev` attempts to call `object.hasOwnProperty(key)`, `object.__defineGetter__` and `object__defineSetter__` on objects passed to it. But my object instance does not have these prototype methods. Changes: * Defined `Object.prototype.hasOwnProperty` as a `const` (pattern used elsewhere in React Native) * Modified calls to `object.hasOwnProperty(key)` to use `hasOwnProperty.call(object, key)` (Per ESLint rule [here](https://eslint.org/docs/rules/no-prototype-builtins)) * Modified calls to deprecated methods `object.__defineGetter__` and `object.__defineSetter__` to instead use `Object.defineProperty` to define get and set methods on the object. (Per guidance on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__)) * Added a new test to `deepFreezeAndThrowOnMutationInDev-test` to verify the fix. I tried to create a reproducible example to post to Snack by passing prototype-less objects to a `Text` component, in various ways, but they appear to be converted to plain objects before crossing the bridge and therefore they do not throw an error. However, I was able to create a new test to reproduce the issue. I added the following test to `deepFreezeAndThrowOnMutationInDev-test`: ```JavaScript it('should not throw on object without prototype', () => { __DEV__ = true; var o = Object.create(null); o.key = 'Value'; expect(() => deepFreezeAndThrowOnMutationInDev(o)).not.toThrow(); }); ``` The changes in this PR include this new test. ESLint test produced no change in Error count (3) or Warnings (671) N/A Other areas with _possibly_ the same issue: https://github.com/facebook/react-native/blob/c6b96c0df789717d53ec520ad28ba0ae00db6ec2/Libraries/vendor/core/mergeInto.js#L50 https://github.com/facebook/react-native/blob/8dc3ba0444c94d9bbb66295b5af885bff9b9cd34/Libraries/ReactNative/requireNativeComponent.js#L134 [GENERAL] [BUGFIX] [Libraries/Utilities/deepFreezeAndThrowOnMutationInDev] -Fix for compatibility with objects without a prototype. Closes facebook#19598 Differential Revision: D8310845 Pulled By: TheSavior fbshipit-source-id: 020c414a1062a637e97f9ee99bf8e5ba2d1fcf4f Track results of e2e tests
marafat
added a commit
to plexinc/fb-react-native
that referenced
this pull request
Jun 8, 2018
* master: Fix NullPointerException when emiting event using UIManagerModule Fixed concurrency issue in remote debugger Fix ReactImagePropertyTest SoLoader failures (facebook#19607) Remove unused include. (facebook#19548) Update Danger token (facebook#19606) Modified deepFreezeAndThrowOnMutationInDev to use Object.prototype.ha… (facebook#19598) Change error message on interpolation (facebook#19571) Bump Prettier to 1.13.4 on xplat Fix/security issues (facebook#19373) Add open source Flow declaration for Metro module Use correct library reference for libfishhook.a in RCTWebSocket (facebook#19579) Enable proguard for Fabric in release builds Fix events not working after closing and navigating back to Fabric screen in FB4A
macdoum1
pushed a commit
to macdoum1/react-native
that referenced
this pull request
Jun 28, 2018
facebook#19598) Summary: This PR fixes a bug in `deepFreezeAndThrowOnMutationInDev` which did not take into account that objects passed to it may have been created with `Object.create(null)` and thus may not have a prototype. Such objects don't have the methods `hasOwnProperty`, `__defineGetter__`, or `__defineSetter__` on the instance. I ran into an unrecoverable error in React Native when passing this type of object across the bridge because `deepFreezeAndThrowOnMutationInDev` attempts to call `object.hasOwnProperty(key)`, `object.__defineGetter__` and `object__defineSetter__` on objects passed to it. But my object instance does not have these prototype methods. Changes: * Defined `Object.prototype.hasOwnProperty` as a `const` (pattern used elsewhere in React Native) * Modified calls to `object.hasOwnProperty(key)` to use `hasOwnProperty.call(object, key)` (Per ESLint rule [here](https://eslint.org/docs/rules/no-prototype-builtins)) * Modified calls to deprecated methods `object.__defineGetter__` and `object.__defineSetter__` to instead use `Object.defineProperty` to define get and set methods on the object. (Per guidance on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__)) * Added a new test to `deepFreezeAndThrowOnMutationInDev-test` to verify the fix. I tried to create a reproducible example to post to Snack by passing prototype-less objects to a `Text` component, in various ways, but they appear to be converted to plain objects before crossing the bridge and therefore they do not throw an error. However, I was able to create a new test to reproduce the issue. I added the following test to `deepFreezeAndThrowOnMutationInDev-test`: ```JavaScript it('should not throw on object without prototype', () => { __DEV__ = true; var o = Object.create(null); o.key = 'Value'; expect(() => deepFreezeAndThrowOnMutationInDev(o)).not.toThrow(); }); ``` The changes in this PR include this new test. ESLint test produced no change in Error count (3) or Warnings (671) N/A Other areas with _possibly_ the same issue: https://github.com/facebook/react-native/blob/c6b96c0df789717d53ec520ad28ba0ae00db6ec2/Libraries/vendor/core/mergeInto.js#L50 https://github.com/facebook/react-native/blob/8dc3ba0444c94d9bbb66295b5af885bff9b9cd34/Libraries/ReactNative/requireNativeComponent.js#L134 [GENERAL] [BUGFIX] [Libraries/Utilities/deepFreezeAndThrowOnMutationInDev] -Fix for compatibility with objects without a prototype. Closes facebook#19598 Differential Revision: D8310845 Pulled By: TheSavior fbshipit-source-id: 020c414a1062a637e97f9ee99bf8e5ba2d1fcf4f
dysonpro
pushed a commit
to dysonpro/react-native
that referenced
this pull request
Aug 10, 2018
…Dev fix into 0.49-stable
zhongwuzw
added a commit
to zhongwuzw/react-native
that referenced
this pull request
Nov 27, 2018
Remove _workQueue of webSocket set to NULL which may leads to crash Remove _delegateDispatchQueue nil handler Sync stream event cleanup with SRWebSocket Added operation for unschedule stream from runloop Adjust order of weakSelf Adding `Wrapper` suffix to `EventHandler` and `EventHandler` type names Summary: It's maybe not so important/crucial, but this thing bothers me a lot. We use raw opaque `EventTarget`, `InstanceHandle` and `EventHandler` pointers in application layer quite a lot and we don't have any kind of type-safety here. I believe all those opaque types should be represented as named scalar types which compiler at least can differentiate at compile time. So I propose introducing named aliases for them which will point to particular empty `struct`s. This will allow us to tag types properly in all functions and methods and ensure that we pass right values as right arguments. Again, they are *just aliases*, which are effectively still `void *`, no any additional logic or names are involved. Unfortunately, those nice type names are already taken by `JSIFabricUIManager` local anonymous namespace (even if they are inside anonymous namespace we cannot use them https://stackoverflow.com/questions/3673353/anonymous-namespace-ambiguity). I think it's fair to rename them because... it's local. And we already use `Wrapper` suffix for them anyways. Reviewed By: fkgozali Differential Revision: D8181151 fbshipit-source-id: 9b55b43fb671a56b32a862ac54f78d528e1188ce Export JSExecutor Reviewed By: rzito Differential Revision: D8187754 fbshipit-source-id: e0da3781e2b3e24cef04086d15e3f5394e059d30 Vendor fetch polyfill, remove default blob response type Summary: While investigating an issue about blobs (https://github.com/facebook/react-native/issues/18223), I noticed that the fetch polyfill (https://github.com/github/fetch) uses blobs as the response type by default if the module is available (https://github.com/github/fetch/blob/master/fetch.js#L454). This surfaced some issue with the blob implementation on iOS that has since been fixed. However after further review of the fetch polyfill and the way Blobs work in RN, I noticed a major issue that causes blobs created by fetch to leak memory. This is because RN blobs are not deallocated automatically like in the browser (see comment https://github.com/facebook/react-native/blob/master/Libraries/Blob/Blob.js#L108) and the fetch polyfill does not deallocate them explicitly using the close method. Ideally we should implement automatic blob cleanup when the instance is garbage collected but implementing that is probably somewhat complex as it requires integrating with JSC. For now I suggest disabling the default handling of requests as blobs in the fetch polyfill. This will mitigate the issue for people not using Blobs directly. I'm not sure how well documented the Blob module is but we should make it clear that they currently require explicit deallocation with the close method for people using them directly. Run a simple http request using fetch and make sure it does not use the Blob module anymore. [GENERAL] [BUGFIX] [fetch] - Do not use blobs to handle responses in the fetch polyfill, fixes potential memory leak. Closes https://github.com/facebook/react-native/pull/19333 Differential Revision: D8125463 Pulled By: hramos fbshipit-source-id: 8f4602190dfc2643606606886c698e8e9b1d91d1 Fabric: Using types `EventTarget`, `EventHandler` & co. instead of `void *` everywhere Summary: Nothing actually changed besides type names... which actually helps me found an issue in FabricUIManager! Now there is no a single `void *` in Fabric/C++ and JavaScript bindings. Yay! Reviewed By: fkgozali Differential Revision: D8191420 fbshipit-source-id: b1eb60b6bc34dd25ab200aab854ffbd7ccf5b15d cli: upgrade envinfo for new features in `react-native info` Summary: envinfo has done a good job reporting issues in the issue template so far, and I've done a lot of work between version 3.x and 5.x that react-native could benefit from. This adds: - better information organization, including versions and paths - Platform/CPU/RAM - Android and iOS SDK version detection - npm package globbing (select all babel* packages - global npm packages (with globbing) envinfo also can report IDE versions, other binaries, languages and browsers if needed, and in different formats. Take a look here if interested: https://github.com/tabrindle/envinfo - run `react-native info` // standard info - run `react-native info --packages` // all packages in package.json - run `react-native info --packages jest,eslint,babel-polyfill` // specified packages - run `react-native info --packages *babel*` // globbed packages Sample standard output: ``` System: OS: macOS High Sierra 10.13 CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz Memory: 97.59 MB / 16.00 GB Shell: 5.4.2 - /usr/local/bin/zsh Binaries: Node: 8.11.0 - ~/.nvm/versions/node/v8.11.0/bin/node Yarn: 1.5.1 - ~/.yarn/bin/yarn npm: 5.6.0 - ~/.nvm/versions/node/v8.11.0/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 11.0, macOS 10.13, tvOS 11.0, watchOS 4.0 Android SDK: Build Tools: 27.0.3 API Levels: 26 IDEs: Android Studio: 3.0 AI-171.4443003 Xcode: 9.0/9A235 - /usr/bin/xcodebuild npmPackages: react: 16.3.2 => 16.3.2 react-native: 0.55.0 => 0.55.0 npmGlobalPackages: create-react-native-app: 1.0.0 react-native-cli: 2.0.1 ``` https://github.com/facebook/react-native/pull/14428 - original inclusion of `react-native info` [CLI] [ENHANCEMENT] [local-cli/info/info.js] - add more info to react-native info cli command, like global npm packages, binary paths, and SDK versions Closes https://github.com/facebook/react-native/pull/19331 Differential Revision: D8049650 Pulled By: hramos fbshipit-source-id: 35c677f369bcad1a014eb083b2ce60ba33fee0ea Update Jest snapshots Summary: Jest will now exclude undefined props from snapshots (https://github.com/facebook/jest/pull/6162). Updating the snapshots should fix the current `test_javascript` failures. Circle CI [INTERNAL][MINOR][Snapshots] - Update snapshots Closes https://github.com/facebook/react-native/pull/19414 Differential Revision: D8125193 Pulled By: hramos fbshipit-source-id: db8dcfcd8afbf9d6256f83c6e922680a7872d776 Add Feature Request template Summary: Closes https://github.com/facebook/react-native/pull/19498 Differential Revision: D8197147 Pulled By: hramos fbshipit-source-id: 0668b885a0eb04a3af948f5643649d5b68488c71 OSS: ignore xcodeproj in root dir Summary: We don't need Xcode project in root dir. Reviewed By: davidaurelio Differential Revision: D8197985 fbshipit-source-id: dbbb8820111e84181c9880372dab9af55e0876e6 [email protected] in xplat/js Reviewed By: rafeca Differential Revision: D8195559 fbshipit-source-id: 7e96f24ae1f9586e9fbc6e1687f731420979352d deleted UI Action Sheet Delegate Methods Reviewed By: PeteTheHeat Differential Revision: D8191111 fbshipit-source-id: 39867683cf5e0cdf8a94a76269d939b5ecf6bbd4 Fix ART surface sleep issue Summary: Fixes https://github.com/facebook/react-native/issues/17565. Reviewed By: achen1 Differential Revision: D8194925 fbshipit-source-id: 5448d49d959078eaded697f791e1b382471fabdb Fix TextInput's initial layout measurements Reviewed By: mdvacca Differential Revision: D7732819 fbshipit-source-id: 0ca4e5643d2cfefe304d7f189474a671c4bcb31e Fix ReactInstanceManager unmountApplication Reviewed By: mdvacca Differential Revision: D7945746 fbshipit-source-id: 0c2eed9a623e442fa4a4ff29ffa01f025466c9b6 Introducing Scheduling of JS calls from native Reviewed By: achen1 Differential Revision: D7729226 fbshipit-source-id: 9869e0a6a2b0c58b7538836ed2c13a4b28dd8887 Refactor setup of Event Dispatcher Reviewed By: achen1 Differential Revision: D7746311 fbshipit-source-id: cfee1c2ced6d85477628085f3260496e80ae48c2 First implementation of scheduleWork method Reviewed By: shergin Differential Revision: D7799412 fbshipit-source-id: b78a0bc0e80868f6877a31f862d7e6104fd4a049 Deprecate UIManagerModule#getEventDispatcher and refactor usages Reviewed By: shergin Differential Revision: D7832079 fbshipit-source-id: 263a2f8ff96ab6e14b91395644710b4d5f36dc50 store / retrieve instanceHandle from View Reviewed By: shergin, achen1 Differential Revision: D8074014 fbshipit-source-id: aee0d41e0e9da44e8748f47da04dcd76dbe96d8d Include instanceHandle in cloning mechanism Reviewed By: shergin, achen1 Differential Revision: D8072075 fbshipit-source-id: 2fcfdfa5116850ce0bac6c2c86d87e5bf00fd7f0 Binding for js events Reviewed By: fkgozali Differential Revision: D8181616 fbshipit-source-id: 5937c83f22ac09e3041fcb0f8d4e9e3026b2b397 Initialize Event Emitter as part of UIManagerModule Reviewed By: achen1 Differential Revision: D8216184 fbshipit-source-id: 3b188804e2dad2b112f566da49a939eb4338713d Use timestamps from QPL by default Differential Revision: D8207166 fbshipit-source-id: 1e43d6874ee400cb2e26a11cbcfb12ee32d28d3c Upgrade Jest to 23.1.0 Reviewed By: davidaurelio Differential Revision: D8212583 fbshipit-source-id: 245a5ccc9bcd63a0995dcb5a1770a6f5f34cd04e Revert D8194925: Fix ART surface sleep issue Differential Revision: D8194925 Original commit changeset: 5448d49d9590 fbshipit-source-id: c01e11d44424e1f6fb79866bb845ed60764c5f13 Fix jest snapshot testing on windows Summary: Fixes #19370 Applied changes to existing project that uses jest snapshot testing. Testing was broken before and now works. To verify: Run any snapshot test containing an image reference on Windows before and after this PR. [WINDOWS][BUGFIX][jest] - Fixed jest snapshot testing on windows Closes https://github.com/facebook/react-native/pull/19496 Differential Revision: D8195947 Pulled By: hramos fbshipit-source-id: 909b5fe7cfd8c6286baf161a227a359854a37603 Enable webhooks on Circle Summary: Release Notes ============= [INTERNAL][MINOR][CircleCI] - Send webhooks to Facebook. Closes https://github.com/facebook/react-native/pull/19527 Differential Revision: D8228361 Pulled By: hramos fbshipit-source-id: 5d7c0960392b9a860d3f665e2a316c18153879eb Migrate Android sources to MIT license header Reviewed By: fkgozali Differential Revision: D8065619 fbshipit-source-id: 719c303b40c96950bab8e5dde9a75f449b2956c6 Upgrade Metro to 0.37.2 Reviewed By: rafeca Differential Revision: D8223545 fbshipit-source-id: fdaacbb514e2947b9244cb55ef9170af55ba2f60 Rename default RN transformer Differential Revision: D8235001 fbshipit-source-id: 59a4b2f13185dd9be0d33f01589d907d49493a26 Change default metro transformer Differential Revision: D8234984 fbshipit-source-id: 83cecfbfa3300f7703ea197009d985bbbc58127a Bump [email protected] Reviewed By: davidaurelio Differential Revision: D8235787 fbshipit-source-id: a22802c829920e7e182a9aae70bd69a6446d5f8f Fabric: Integrating `tag` into `EventHandlers` Summary: In order to dispatch event, `EventHandlers` must also know react tag. So we have to store it inside. We plan to illuminate this requirement (and `tag` from `EventHandlers`) eventually. Reviewed By: fkgozali Differential Revision: D8211685 fbshipit-source-id: 2064c0f4a7869cbf4d2c92d0349f4ee3998cb8f5 Fabric: The first version of event dispatching pipeline Summary: This is the first attempt to implement some base part of event dispatching pipeline from end-to-end. Even when it is working, all this is still incomplete and generally up in the air. We are still messing proper implementation of event queue, priority, and synchronization of react reconciliation process with event scheduling. Reviewed By: fkgozali Differential Revision: D8212271 fbshipit-source-id: 92f9427d14726441c70ffff294ac95eeb004152a Fabric: Removed unused type aliases Summary: Trivial. Reviewed By: fkgozali Differential Revision: D8212287 fbshipit-source-id: 228951742568d28a064ee03b6314a4c01532b9c9 Clamp typechecks -> Flow Reviewed By: yungsters Differential Revision: D8219220 fbshipit-source-id: e849d9dae573459e4b09e317cc6dc37bec9ce4e8 RefreshControl ES6 Class Reviewed By: sahrens Differential Revision: D8219221 fbshipit-source-id: 445243964d64dd5274c1e47bdc137645dc8eecaf ActivityIndicator ES6 Class Reviewed By: yungsters Differential Revision: D8219463 fbshipit-source-id: 7d252d15bb4a7345d156b1659b09be2a4a69ba6c DatePickerIOS add onChange event definition Reviewed By: sahrens Differential Revision: D8219622 fbshipit-source-id: 37f26d0981318b7eab9d3c734c44e7714fa6f0e8 DatePickerIOS ES6 Class Reviewed By: sahrens Differential Revision: D8219657 fbshipit-source-id: cef48cf3ad24ad442f07df0edad55ab97d96c6f2 Delete EventDispatcher interface Reviewed By: achen1 Differential Revision: D8232129 fbshipit-source-id: 6d618b4a587c0b0e1dfac967e8d22c05a62c44ee RN: Remove Native Prop Validation Summary: As we migrate over to static typing solutions for props, we cannot rely on always having `propTypes` available at runtime. This gets us started on that journey by removing the native prop validation that happens when we require native components. bypass-lint Reviewed By: TheSavior Differential Revision: D7976854 fbshipit-source-id: f3ab579a7f0f8cfb716b0eb7fd4625f8168f3d96 Bump to BUCK v2018.03.26.01 Summary: Bumps CI to latest BUCK release. Test Plan --------- Run on Circle CI. Release Notes ------------- [INTERNAL] [MINOR] [Tests] - Bump to BUCK v2018.03.26.01 Closes https://github.com/facebook/react-native/pull/19535 Differential Revision: D8240382 Pulled By: hramos fbshipit-source-id: 60812cc90542201b362ef264083dd79dbf5d9360 make logMarker visible for consistency with logTaggedMarker Differential Revision: D8240294 fbshipit-source-id: 8d056dc89adff41ff43c0df2f752b01ac1fb189f react-native-xcode.sh: Support Homebrew-installed nodenv Summary: As well as nvm. https://github.com/facebook/react-native/blob/9d315f4a1e7b0c9cd80a51903db0b1b561b19e33/scripts/react-native-xcode.sh#L56-L60 Build React Native iOS app with Release configuration and run the script using `node` command which is installed through Homebrew-installed `nodenv` and `node-build`. None. [IOS] [ENHANCEMENT] [scripts/react-native-xcode.sh] - Support Homebrew-installed nodenv Closes https://github.com/facebook/react-native/pull/19509 Differential Revision: D8243181 Pulled By: hramos fbshipit-source-id: fbd75f377f4aebf89ce35b96a47c59238e62e9ce Low the priority for logging events in fabric Reviewed By: achen1 Differential Revision: D8238957 fbshipit-source-id: f2e8bd941ac68ead4c5ed7cadfcf83a753e44cab better place for dismiss all button Summary: This pr makes a little bit simpler to dismiss all warnings (1 click instead of 2) Sometimes you don't want to use `YellowBox.ignoreWarnings` to remember. RNTester sceenshot: <img width="322" alt="screen shot 2018-05-30 at 09 51 25" src="https://user-images.githubusercontent.com/1488195/40701475-1142506a-63ef-11e8-8fc9-ea1696d9cb65.png"> Or RNTester -> Native Animation Example -> Force JS Stalls (in the end of the list) also cause warning to test. [GENERAL][ENHANCEMENT][YellowBox] - Move `Dismiss All` yellow box button to another place which makes a little bit simpler to dismiss warnings. Closes https://github.com/facebook/react-native/pull/19501 Differential Revision: D8243823 Pulled By: hramos fbshipit-source-id: 31887469cddb4adfd7b889ae0c29a3bf41e87b7b Slider remove $FlowFixMe Reviewed By: sahrens Differential Revision: D8234803 fbshipit-source-id: cfc0466a54f3c219d8a2eadfebf840399a2abdd8 refactor JSI module initialization Reviewed By: fkgozali Differential Revision: D8111636 fbshipit-source-id: 6e32703b077144962519485002adff8c9f6084ad Add backward compatible support for onLayout event in Fabric Reviewed By: achen1 Differential Revision: D8231722 fbshipit-source-id: 3d0641a7813e742ca81b98576f9ffc30ee597f30 Implement release of FabricUIManager resources Reviewed By: achen1 Differential Revision: D8232155 fbshipit-source-id: 6683c692a830f5a73aab2c606167e54d668ae5c2 normalizeColor to compute regexps lazily Reviewed By: johnislarry Differential Revision: D8241955 fbshipit-source-id: 0939f442bb1e51118207449e0b95c6da97b899da Revert D8234803: [RN] Slider remove $FlowFixMe Differential Revision: D8234803 Original commit changeset: cfc0466a54f3 fbshipit-source-id: 354fcc1853597cbcd518abaf4be5b11116f594b3 Slider remove $FlowFixMe #take2 Reviewed By: fkgozali Differential Revision: D8246336 fbshipit-source-id: 21555a318bd823309ac2c285b49c2045338c2b28 Slider move prop comments to flow types Reviewed By: yungsters Differential Revision: D8246378 fbshipit-source-id: f62a77d64016f6502b3445ab6d0d1558034333e6 Slider to ES6 Class Reviewed By: yungsters Differential Revision: D8246422 fbshipit-source-id: 1955ae87abe077115ac8f8ea105be85db8ea66b4 Switch to ES6 Class Reviewed By: yungsters Differential Revision: D8246980 fbshipit-source-id: fbd6998429e6791000ea093d3fa15c1a486914bd Remove duplicated attachWebsocketServer module Reviewed By: jeanlauliac Differential Revision: D8248752 fbshipit-source-id: b829de4b0d75d154dd80196b589fe70b0050be4d Bump [email protected] Reviewed By: jeanlauliac Differential Revision: D8248753 fbshipit-source-id: aa6d0da4e96e8b4109b6b5bca050614ec1860fc2 Trigger nested VirtualizedLists to re-measure if their containing cell's onLayout fires Reviewed By: sahrens Differential Revision: D8272040 fbshipit-source-id: c490ffa875bfd0547ac54d214c5ebbeb23c99942 skip dismiss all if all rows are hidden (#19564) Summary: Small fix based on https://github.com/facebook/react-native/pull/19501#issuecomment-394486884 No need to mention it [GENERAL] [BUGFIX] [YellowBox] - Message Closes https://github.com/facebook/react-native/pull/19564 Differential Revision: D8276808 Pulled By: hramos fbshipit-source-id: 59832d3d6e60ae30afbeb7c9303405746e9eec45 Fix events not working after closing and navigating back to Fabric screen in FB4A Reviewed By: fkgozali Differential Revision: D8240344 fbshipit-source-id: 992945f94843589cefdf7ea24da709449ee38778 Enable proguard for Fabric in release builds Reviewed By: shergin Differential Revision: D8247814 fbshipit-source-id: 94ed8a767fcf4f6093646618a5691ff17753ffe0 Use correct library reference for libfishhook.a in RCTWebSocket (#19579) Summary: This uses the reference for `libfishhook.a` from the Products, rather than the reference from the Frameworks group. This fixes the build for the new Xcode build system, on both Xcode 9 and Xcode 10. Fixes #19569 - Using Xcode 10: - Open `RNTester/RNTester.xcodeproj` - Build RNTester, noting build errors - Using Xcode 9: - Open `RNTester/RNTester.xcodeproj` - Switch to using new build system in `File > Project Settings > Build System`, selecting `New Build System (Preview)` - Build RNTester, noting build errors none [IOS] [BUGFIX] [RCTWebSocket] - Fix build for new Xcode build system Closes https://github.com/facebook/react-native/pull/19579 Differential Revision: D8287487 Pulled By: hramos fbshipit-source-id: 5bfc9decb09ebc763824df8474b5897099d39ad7 Add open source Flow declaration for Metro module Summary: Fix Flow failure by adding a declaration to the Flow config used in open source. This did not get caught internally because we use a different Flow config. Release Notes ------------- [INTERNAL] [MINOR] [Flow] - Fix Flow config. Reviewed By: rafeca Differential Revision: D8257641 fbshipit-source-id: 3f4b2cbe622b2e76aa018e9369216a6b9ac25f47 Fix/security issues (#19373) Summary: This updates both [`react-devtools-core`](https://github.com/facebook/react-devtools/issues/941) and [`plist`](https://github.com/TooTallNate/plist.js/commit/04c8ee7646d4abcfe13b3fdc3037b75047069ead) to include security fixes, reported by `npm audit`. Fixes #18854 _Only dependencies are updated with security patches, no change in actual code._ _Only dependencies are updated with security patches, no change in actual code._ [GENERAL] [ENHANCEMENT] [react-devtools-core] - Bump to `3.2.2` for a security fix for `ws` [GENERAL] [ENHANCEMENT] [plist] - Bump to `3.0.0` for a security fix for `xmlbuilder` Closes https://github.com/facebook/react-native/pull/19373 Reviewed By: sophiebits Differential Revision: D8149200 Pulled By: hramos fbshipit-source-id: 732fd627b232c315be60ed2da432742e8256a38a Bump Prettier to 1.13.4 on xplat Summary: Bump Prettier to use version 1.13.4 All code changes are caused by running Prettier and should only affect files that have an `format` header. All other changes caused by yarn. Reviewed By: ryanmce Differential Revision: D8251255 fbshipit-source-id: 0b4445c35f1269d72730f2000002a27c1bc35914 Change error message on interpolation (#19571) Summary: Change message in Animated.Interpolation to "inputRange must be monotonically non-decreasing" as it's allowed to give the same x's like in the test [example](https://github.com/facebook/react-native/blob/4435f087713e1d0ac3639e3b3196d71c6402898e/Libraries/Animated/src/__tests__/Interpolation-test.js#L71) Simply giving improper value of interpolation input [GENERAL] [MINOR] [AnimatedInterpolation.js] - Change error message on interpolation improper range error Closes https://github.com/facebook/react-native/pull/19571 Differential Revision: D8310791 Pulled By: TheSavior fbshipit-source-id: 803ef55104ad2a36231c5f18c0c089bd14822bf3 Modified deepFreezeAndThrowOnMutationInDev to use Object.prototype.ha… (#19598) Summary: This PR fixes a bug in `deepFreezeAndThrowOnMutationInDev` which did not take into account that objects passed to it may have been created with `Object.create(null)` and thus may not have a prototype. Such objects don't have the methods `hasOwnProperty`, `__defineGetter__`, or `__defineSetter__` on the instance. I ran into an unrecoverable error in React Native when passing this type of object across the bridge because `deepFreezeAndThrowOnMutationInDev` attempts to call `object.hasOwnProperty(key)`, `object.__defineGetter__` and `object__defineSetter__` on objects passed to it. But my object instance does not have these prototype methods. Changes: * Defined `Object.prototype.hasOwnProperty` as a `const` (pattern used elsewhere in React Native) * Modified calls to `object.hasOwnProperty(key)` to use `hasOwnProperty.call(object, key)` (Per ESLint rule [here](https://eslint.org/docs/rules/no-prototype-builtins)) * Modified calls to deprecated methods `object.__defineGetter__` and `object.__defineSetter__` to instead use `Object.defineProperty` to define get and set methods on the object. (Per guidance on [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/__defineGetter__)) * Added a new test to `deepFreezeAndThrowOnMutationInDev-test` to verify the fix. I tried to create a reproducible example to post to Snack by passing prototype-less objects to a `Text` component, in various ways, but they appear to be converted to plain objects before crossing the bridge and therefore they do not throw an error. However, I was able to create a new test to reproduce the issue. I added the following test to `deepFreezeAndThrowOnMutationInDev-test`: ```JavaScript it('should not throw on object without prototype', () => { __DEV__ = true; var o = Object.create(null); o.key = 'Value'; expect(() => deepFreezeAndThrowOnMutationInDev(o)).not.toThrow(); }); ``` The changes in this PR include this new test. ESLint test produced no change in Error count (3) or Warnings (671) N/A Other areas with _possibly_ the same issue: https://github.com/facebook/react-native/blob/c6b96c0df789717d53ec520ad28ba0ae00db6ec2/Libraries/vendor/core/mergeInto.js#L50 https://github.com/facebook/react-native/blob/8dc3ba0444c94d9bbb66295b5af885bff9b9cd34/Libraries/ReactNative/requireNativeComponent.js#L134 [GENERAL] [BUGFIX] [Libraries/Utilities/deepFreezeAndThrowOnMutationInDev] -Fix for compatibility with objects without a prototype. Closes https://github.com/facebook/react-native/pull/19598 Differential Revision: D8310845 Pulled By: TheSavior fbshipit-source-id: 020c414a1062a637e97f9ee99bf8e5ba2d1fcf4f Update Danger token (#19606) Summary: Trivial. Closes https://github.com/facebook/react-native/pull/19606 Differential Revision: D8314419 Pulled By: hramos fbshipit-source-id: b298e265c2c87cdc01175b1a014f9003e0673f40 Remove unused include. (#19548) Summary: `LayoutableShadowNode.cpp` includes `"LayoutableShadowNode.h"` as well as `<fabric/core/LayoutContext.h>`. In turn, `LayoutContext.h` then includes `<fabric/core/LayoutableShadowNode.h>`. `LayoutContext.h` doesn't actually require `LayoutableShadowNode.h`, but this unnecessary inclusion can cause duplicate definition errors if the two include paths don't map to exactly the same file. This patch removes the unnecessary include. The CI's build system should cover the testing needed. [INTERNAL] [MINOR] [fabric] - Remove an unnecessary include in fabric/core/layout. Closes https://github.com/facebook/react-native/pull/19548 Differential Revision: D8313337 Pulled By: shergin fbshipit-source-id: 2e01e29ff25131543d9a8601483c2e716c7437be Fix ReactImagePropertyTest SoLoader failures (#19607) Summary: Fixes #18637 & #19309 <!-- Required: Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos! --> Check Android `ReactImagePropertyTest` tests pass. <!-- Does this PR require a documentation change? Create a PR at https://github.com/facebook/react-native-website and add a link to it here. --> <!-- Required. Help reviewers and the release process by writing your own release notes. See below for an example. --> [ANDROID] [BUGFIX] [Unit Tests] - Fix ReactImagePropertyTest SoLoader failure <!-- **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [ {Component} ] [ INTERNAL ] [ ENHANCEMENT ] [ {Filename} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> Closes https://github.com/facebook/react-native/pull/19607 Differential Revision: D8325415 Pulled By: hramos fbshipit-source-id: 598baa3499646bb50da065815c19bb9f76bf6c87 Fixed concurrency issue in remote debugger Reviewed By: rafeca Differential Revision: D8316215 fbshipit-source-id: 70b5000a9bf09897bb9b9d505bfc5dcc7c4c3a41 Fix NullPointerException when emiting event using UIManagerModule Reviewed By: achen1 Differential Revision: D8321766 fbshipit-source-id: ae5052c83f46e08d540b90bf5b71c68f354c566d QuickPerformanceLogger.js: markerPoint + iOS/Android JS binding Reviewed By: alexeylang Differential Revision: D8125546 fbshipit-source-id: bb02921c7d89faba64001bff3b9aaf13f64a7f8b Fabric: Using Size instead of Point as textShadowOffset's type Summary: The current implementation of React Native uses `Size` as the underlying type of `textShadowOffset` which is clearly terribly wrong (especially because negative size values makes no sense). This mistake was borrowed from `NSShadow`, I believe. I don't have time to fix this in every implementation of RN now, so let's use `Size` in Fabric as well. Reviewed By: fkgozali Differential Revision: D8246714 fbshipit-source-id: 1f0bf9b9dfa83802ef3faef2971fed5510494bfd Fabric: Using exact UIFontWeight* constants instead of CGFloat Summary: SUDDENLY, `-[UIFont systemFontOfSize:weight:]` returns incorrect result if `weight` is not exactly equal to any of built-in constants. Reviewed By: fkgozali Differential Revision: D8246712 fbshipit-source-id: 13d59cc8d66a4494437f28d791fd93fa83ebe6fb Fabric: Data model of Touch Events Summary: The data model of Touch events and payload serialization. The implementation mimics W3C standard and current React Native implementation. Reviewed By: fkgozali Differential Revision: D8246711 fbshipit-source-id: 955b2068674f290d8bdb82da1ebfb796dd32971b Fabric: Introducing RCTSurfaceTouchHandler Summary: RCTSurfaceTouchHandler is a complete rewrite of RCTTouchHandler which uses direct Fabric-specific event dispatching pipeline and several new approaches to managing active events (such as high-performant C++ collections, better management of identifier pool, and so on). Besides that, the new implementation is much more W3C compliant that it used to be (see old TODOs near `receiveTouches()` implementation in Javascript). So, touch events work now! Reviewed By: fkgozali Differential Revision: D8246713 fbshipit-source-id: 218dc15cd8f982237de7e2497ff36a7bfe6d37cc Fabric: `convertRawProp` was extended to accept an optional default value Summary: During transforming raw prop (`rawProps[<prop>]`) to typed props (`MyProps.<prop>`) we can face three different cases: * `rawProps` collection has proper serialized value for the key. In this case, we have to set a new value of the typed prop converting value using `fromDynamic`. * `rawProps` collection does not have value for the key. In this case, we have to copy a value from source prop (`sourceValue`). * `rawProps` collection has `null` value for the key. This is the special case which means that the prop was removed from the particular component instance and we have to reset it to some *default* value (which is *not* the same as `sourceValue`). Now the default value of the `defaultValue` (sic!) argument is a default value of the type of the value (which may be different from logical default value). We didn't handle the last case previously and this caused crashes (and unexpected behavior) because `fromDynamic` often cannot handle `null` value. And yes, all this mean that we also have to update all `convertRawProp` call sites where logical default values are not equal to type-specific default values. This is a potential error-prone place, especially because now we have to specify logical default values in two places (in a prop declaration and in a parameterized constructor). And seems there is no way to avoid that without performance loss (because both of those places are basically constructors). My hope is that codegen (where default values are also defined in JavaScript) will help with it eventually. Reviewed By: fkgozali Differential Revision: D8247652 fbshipit-source-id: 2cbe65f5f5cccd7a0d34aaa19e385aacebfe8cb1 Bump eslint-plugin-react in FBSource Reviewed By: yungsters Differential Revision: D8247892 fbshipit-source-id: 4072e65ccf2fdc654f58087a16b4c7709ce393f8 have circle ci use xcode 9.4 (#19629) Summary: Circle CI just released Xcode 9.4 https://discuss.circleci.com/t/xcode-9-4-availability-on-circleci/22648/5 Make sure react native still works with Xcode 9.4. None [IOS][MINOR] Upgrade CI Closes https://github.com/facebook/react-native/pull/19629 Differential Revision: D8343236 Pulled By: hramos fbshipit-source-id: 2266aeafc9a1b1c77ad842f06c9a137bb05b135d Disallow requiring from invariant/warning (#19634) Summary: In this repo we have to require from fbjs/lib/invariant and issues occur when we require directly from invariant/warning. Flow doesn't complain about those requires right now because we have a transitive dependency on invariant and warning causing them to happen to be at the root of node_modules. This change blacklists requiring directly from invariant and warning using Flow. janicduplessis opened a pull request to do this with ESLint back in 2017: https://github.com/facebook/react-native/pull/13014 Closes https://github.com/facebook/react-native/pull/19634 Reviewed By: hramos Differential Revision: D8343060 Pulled By: TheSavior fbshipit-source-id: 9cfc7915b2fb68a567355fc2f5edc4dfcd46f4af Fabric: All *EventHandlers were renamed to *EventEmitter Summary: Using `EventHandlers` name was a bad idea, and I cannot tolerate it anymore. The worst part of it is that when you have a collection of `EventHandlers` objects you cannot use plural word to describe it because `EventHandlers` is an already plural word. And, this object is actually an event emitter, the thing on which we call events. Reviewed By: fkgozali Differential Revision: D8247723 fbshipit-source-id: b3303a4b9529bd6d32bb8ca0378287ebefaedda8 Add MIT License Header Summary: When a third party library is vendored, both the original copyright header as well as React Native's header are required. Reviewed By: fkgozali Differential Revision: D8284116 fbshipit-source-id: 1748eb011c843a87e9ed421597571b66334edfd2 Migrate PickerIOS to ES6 Class Reviewed By: sahrens Differential Revision: D8343380 fbshipit-source-id: 9432f0810c67034f20b44ba9f4955d4ffd2ef1d2 Fix some typos in dumpReactTree.js (#19636) Summary: Simple doc fixes Closes https://github.com/facebook/react-native/pull/19636 Differential Revision: D8344481 Pulled By: TheSavior fbshipit-source-id: b6fa064f70793bdaf1d6346b2775373b74c2ae3b iOS: fix fabric core test Reviewed By: shergin Differential Revision: D8344613 fbshipit-source-id: 10c604e7fbe2ff3b8c47babedea12a197c0c56b2 Switch to Platform.isTV to pass Android Flow Reviewed By: sahrens Differential Revision: D8345911 fbshipit-source-id: 9af7a25127e7c35844a6c59b267a77cf8adba535 Passing forwardedRef to Slider Reviewed By: sahrens Differential Revision: D8345883 fbshipit-source-id: d2affdba14d38593541e591fe72006c76fca166f Enable Flow for bezier Reviewed By: sahrens Differential Revision: D8346102 fbshipit-source-id: bb1a2eccb5472bf6f3fe113303ad96cf3f386cab Don't pass additional args to requireNativeComponent in .android.js files Reviewed By: sahrens Differential Revision: D8345921 fbshipit-source-id: 187048ad4c1b361f0b99b993052bdcaf47a266db Fix iOS e2e tests: bump react-native-babel-preset to ^5 (#19625) Summary: We opt in to version ^5 of the React Native Babel Preset, as required after the bump to Babel 7. This fixes the Objective-C end-to-end test failure in master. (Fixes #19538) See https://github.com/facebook/react-native/commit/34bd776af2f2529009188fced91083203a48fd40#commitcomment-29024085 for prior discussion. There have already been several changes made to the repo during the transition to Babel 7. This PR brings all tests back to green and allows us to move forward with the 0.56 branch cut. We also bump our tests to use Xcode 9.4.0 and iOS 11.4, the latest stable versions of both. Once the 0.56 branch makes it to stable, we can change `react-native-babel-preset@latest` on npm to point to `[email protected]` (or newer), and undo the change made to `init.js` we made as part of this diff. Wait for Circle CI to run: https://circleci.com/workflow-run/e39a66d7-bf8a-4b31-a22f-eef30a2c53bc [GENERAL] [BREAKING] [Babel] - Bump React Native Babel Preset version used by RN CLI to Babel v7 compliant release Closes https://github.com/facebook/react-native/pull/19625 Reviewed By: TheSavior Differential Revision: D8343861 Pulled By: hramos fbshipit-source-id: 42644d5b0bfb40a8bc592ae3461c5008deef8232 Upgrade to Flow v0.74.0 Reviewed By: panagosg7 Differential Revision: D8322344 fbshipit-source-id: 1208528009785f7f797201777287af525d0a9ca1 Open source Flow definition for Jest Reviewed By: sahrens Differential Revision: D8347198 fbshipit-source-id: 0b6194bfd14bad09db7dcd462f0bf342c9c6fe44 Add back deprecated getParent methods for non-breaking API change (#775) Summary: I'm not totally sure what I'm doing so if this needs changes let me know. Closes https://github.com/facebook/yoga/pull/775 Reviewed By: emilsjolander Differential Revision: D8331892 Pulled By: passy fbshipit-source-id: eb1023e666322d2472e4081fd4a4e72a7b43d049 Trigger onFocus/onBlur instead of onPressIn/onPressOut (eventually, but for now just deprecate) (#18470) Summary: Currently on iOS and Android focus/blur events trigger onPressIn/onPressOut. Based on discussions with people are several companies who use react-native we're proposing instead triggering new events onFocus/onBlur. Initial discussion on Slack with some from the core team on Slack seemed positive. Couple reasons: * The current API behavior overloads onPressIn/onPressOut. That means on platforms like react-native-web, if focus/blur support was added (as we're hoping for), even though onPressIn/onPressOut would be useful as the name describes, you wouldn't be able to distinguish between it and browser element focus/blur events. * The names aren't as self-documenting/intuitive as onFocus/onBlur, especially for react-dom users. There aren't any current tests around this, but I intend to add them if we solidify the API. There's also an option question on the transition--do we deprecate the existing API with a warning? This PR just deprecates them, though it will on any TV platform when something becomes focused regardless of whether they use the API or not. This isn't ideal. It's not clear if there are alternatives or if just right away breaking the API for TV users is the correct solution, if we can get consensus between the few parties who are using it. *** I'm interested to hear counter points or prior discussions. Cc/ matthargett dlowder-salesforce rozele Closes https://github.com/facebook/react-native/pull/18470 Differential Revision: D8368109 Pulled By: hramos fbshipit-source-id: 22587b82e091645e748b6c2d721fdff06d54837f Jest: Upgrade Flow Definition in RN + Metro Reviewed By: sahrens Differential Revision: D8371076 fbshipit-source-id: 12d03c545ca190a5fda1ff319e5ea906173d2241 RN: A wild YellowBox has appeared! Summary: Replaces the existing `YellowBox` with a modern one. Here are the notable changes: - Sort warnings by recency (with most recent on top). - Group warnings by format string if present. - Present stack traces similar to RedBox. - Show status of loading source maps. - Support inspecting each occurrence of a warning. - Fixed a bunch of edge cases and race conditions. Reviewed By: TheSavior Differential Revision: D8345180 fbshipit-source-id: b9e10d526b262c3985bbea639ba2ea0e7cad5081 fix forwardRef displayName on Text and View Reviewed By: TheSavior Differential Revision: D8342852 fbshipit-source-id: 5af80edfd5de5b6d6ea6fdc24abf8931f767c812 Fix more forwardRef displayNames Reviewed By: TheSavior Differential Revision: D8342904 fbshipit-source-id: b6e53da7305d71635528a42e80910f4a9db0455c Upgrade react-test-render to handle React.forwardRef Reviewed By: TheSavior Differential Revision: D8346704 fbshipit-source-id: fc6686fab12a429780fb16e4129e8987529b13af iOS: Fixed some props conversion errors Summary: * numbers in JS are doubles in native land, since there's no notion of int or int64 in JS - so simply convert numbers to int instead of assuming it's int * the parsing of Yoga props with `'...%'` string value has a bug: it should be copying the number instead of the `%` Reviewed By: shergin Differential Revision: D8370873 fbshipit-source-id: 44e9e3f0530c000c963e8e9ca66e8b0a48d80bcd Flow: textShadownOffest needs to be stricter Summary: `width` and `height` are required for this style prop, for the sake of consistency (and Fabric). Callsites should set one of them to 0 instead of not specifying it. Reviewed By: TheSavior, shergin Differential Revision: D8371064 fbshipit-source-id: b0ffd6b6543ac5456a3708382966e7b3df241f7e Revert D8346704: Upgrade react-test-render to handle React.forwardRef Differential Revision: D8346704 Original commit changeset: fc6686fab12a fbshipit-source-id: 4d1a9d109ef5be93c40df2701f35966bf441eb0a Revert D8342904: [StrictMode] Fix more forwardRef displayNames Differential Revision: D8342904 Original commit changeset: b6e53da7305d fbshipit-source-id: abf5fa6ccb16058f20cbb569ecfc790fad017133 fix No bundle url present in iOS (#19643) Summary: fix No bundle url present in iOS. Related issue: https://github.com/facebook/react-native/issues/14118, https://github.com/facebook/react-native/issues/12754. Pass all current ci none [GENERAL] [BUGFIX] [iOS] - fix No bundle url present in iOS Closes https://github.com/facebook/react-native/pull/19643 Differential Revision: D8374583 Pulled By: hramos fbshipit-source-id: 62d621f431d2067825dc701f87044ecb1d720f14 Fixed comparison on possible null object (#19675) Summary: Motivation: getting NPE on BlobModule part <img width="1718" alt="screen shot 2018-06-12 at 3 03 48 pm" src="https://user-images.githubusercontent.com/4340636/41292212-31e0acc8-6e52-11e8-916a-dd6fc2bb695a.png"> Should still build and pass all tests since project settings changes should be safe changes. <!-- Required: Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Bonus points for screenshots and videos! --> No documentation change is required <!-- Does this PR require a documentation change? Create a PR at https://github.com/facebook/react-native-website and add a link to it here. --> <!-- Required. Help reviewers and the release process by writing your own release notes. See below for an example. --> [ANDROID][BUGFIX][BlobModule] safe equals checks <!-- **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [ {Component} ] [ INTERNAL ] [ ENHANCEMENT ] [ {Filename} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> Closes https://github.com/facebook/react-native/pull/19675 Differential Revision: D8380228 Pulled By: hramos fbshipit-source-id: 1d3caefdb7a7d638228490ef7b3771617745d26f Implement console group APIs (#18555) Summary: Thank you for sending the PR! We appreciate you spending the time to work on these changes. Help us understand your motivation by explaining why you decided to make this change. React Native provides an implementation of the Web "Console" API, which is a powerful mechanism for debugging and analyzing RN apps. However, one subset of the Console API that RN does not provide is the "grouping" functions, namely `console.group` and `console.groupEnd`. These functions provide a useful way to see how an application behaves within a different parts of an application hierarchy. I modified the "RNTester" app to create a console group each time an example is tapped, and the group is ended when the "Back" button is tapped. Here is an example of the grouping as seen in the Xcode console. <img width="651" alt="console grouping" src="https://user-images.githubusercontent.com/445421/37882070-d2ae7860-306d-11e8-8cf4-be843a864f43.png"> https://github.com/facebook/react-native-website/pull/270 [GENERAL] [ENHANCEMENT] [console.js] - Add `console.group()` and `console.groupEnd()` APIs, matching the Web Console API. Closes https://github.com/facebook/react-native/pull/18555 Differential Revision: D7992131 Pulled By: hramos fbshipit-source-id: 0d28896292563922240ae2100ed49e35b6d1f102 Bump soloader to 0.5.0 (#19676) Summary: Closes https://github.com/facebook/react-native/pull/19676 0.5.0 adds compatibility for Android P. Reviewed By: mdvacca Differential Revision: D8379610 fbshipit-source-id: cbef6c2e5e82e2d9e17756b00d210fecb04e8a40 Expose getResolverMainFields() config param Reviewed By: mjesun Differential Revision: D8380198 fbshipit-source-id: 3d5b7a5873095db2b90a23b5054fb94579df3f1a Bump [email protected] Reviewed By: mjesun, davidaurelio Differential Revision: D8380199 fbshipit-source-id: 6b9e3aa343e8d0526a3c42d5ea266c44428d31f8 YellowBox: Apply SafeAreaView in Header Summary: Uses `SafeAreaView` in the YellowBox inspector header so that it does not collide with the status bar. Reviewed By: sahrens Differential Revision: D8374861 fbshipit-source-id: e67358ac9268db8291cacf79df402f3bd5a2173d use android build-tools 26.0.2 and set compileSdk to 26 (#19662) Summary: Android Target API Level 26 will be required starting from August 2018, it's so soon 😄.Read https://android-developers.googleblog.com/2017/12/improving-app-security-and-performance.html This PR uses android build tools 26.0.2, support library 26.1.0 (with android lifecycle) and setting compileSdkVersion to 26, but leaving minSdkVersion and targetSdkVersion intact, which will make targeting 26 easy. Circle CI: https://circleci.com/gh/dulmandakh/react-native/209 Everything will build and work just fine. [ANDROID] [ENHANCEMENT] [TOOLS] - Use android build-tools 26.0.2 and set compileSdk to 26, and use support library version 26.1.0. Closes https://github.com/facebook/react-native/pull/19662 Differential Revision: D8398855 Pulled By: hramos fbshipit-source-id: a4066eb04cb5f947efe1f3202b638c1092b79aae Support animated values for border dimensions Summary: The flow types for these were too restrictive. Fixes https://github.com/facebook/react-native/issues/19093 Reviewed By: yungsters Differential Revision: D8409550 fbshipit-source-id: e4774e8856efc998ff1fa6cdcbe7b0cb6db2c4e3 YellowBox: Define in __DEV__ Only Summary: This makes it so that `YellowBox` and its dependencies are completely stripped from production bundles. Reviewed By: sahrens Differential Revision: D8402545 fbshipit-source-id: 6993521280a02dfe5eab8863d12c46781f35444f - Keyboard layout now updates when changing keyboardType while it has focus (#19027) Summary: This PR makes sure that changing the `keyboardType` props of `<TextInput>` is reflected while the text field has focus. It is something that is also discusses in #13782. The workaround mentioned in that issue using `key` causes the TextInput to re-render itself which has some undesired side-effects. Fixes #13782 ```javascript export default class KeyboardTypeApp extends Component { state = { keyboardType: 'default' }; toggleKeyboardType = () => { this.setState({ keyboardType: this.state.keyboardType === 'default' ? 'numeric' : 'default' }); } render() { return ( <View style={{ padding: 40 }}> <TextInput autoFocus value="Press Toggle :)" keyboardType={this.state.keyboardType} /> <Button title="Toggle" onPress={this.toggleKeyboardType} /> </View> ); } } ``` ![video](https://user-images.githubusercontent.com/706368/39268429-3e331440-48d0-11e8-947c-7d334e3cec50.gif) <!-- Does this PR require a documentation change? Create a PR at https://github.com/facebook/react-native-website and add a link to it here. --> [IOS] [ENHANCEMENT] [TextInput] - Keyboard layout now updates when changing `keyboardType` while it has focus <!-- **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [ {Component} ] [ INTERNAL ] [ ENHANCEMENT ] [ {Filename} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> Closes https://github.com/facebook/react-native/pull/19027 Differential Revision: D8416007 Pulled By: PeteTheHeat fbshipit-source-id: c4f89ab3dc0819bca52feddbc9c7a9f62fd96794 Bumping Metro to 0.39.1 Reviewed By: rafeca Differential Revision: D8418105 fbshipit-source-id: 66032deb53f46a388b81233e8d00d7af6a2c7fa7 improve NativeModuleRegistryBuilder.java (#16402) Summary: I met the error `Native module xyz tried to override xyz for module name xyzModuleName. If this was your intention...` after something went wrong during `react-native link` - one module somehow ended up being included twice in the `getPackages` method, as in: ```java Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new WowPackage(), new WowPackage(), ``` Since I have > 20 native modules it took me a little while to find out what the problem was. The improved error message should make the problem clearer to anybody who may encounter it. I did try to refactor the code a little more, by extracting the whole part of: ```java String name = moduleHolder.getName(); if (namesToType.containsKey(name)) { Class<? extends NativeModule> existingNativeModule = namesToType.get(name); if (!moduleHolder.getCanOverrideExistingModule()) { throw new IllegalStateException(getModuleOverridingExceptionMessage( type.getSimpleName(), existingNativeModule.getSimpleName(), name )); } mModules.remove(existingNativeModule); } namesToType.put(name, type); mModules.put(type, moduleHolder); ``` out into a separate method since there were two places where nearly identical code was written. I have built RN from source and used it in a very simple app with RN vector icons (the package creates a native module as can be seen [here](https://github.com/oblador/react-native-vector-icons/blob/master/android/src/main/java/com/oblador/vectoricons/VectorIconsPackage.java#L19)). After including the module twice, ie. ```java Override protected List<ReactPackage> getPackages() { return Arrays.<ReactPackage>asList( new MainReactPackage(), new VectorIconsPackage(), new VectorIconsPackage() ); } ``` I get the improved error description, as seen in the screenshot. <img src="https://user-images.githubusercontent.com/1566403/36340960-3289d9d0-13e7-11e8-8d17-e1651da17841.png" height="500"> [ANDROID] [MINOR] [NativeModuleRegistryBuilder] - Improve error message and refactor putting native modules to module maps Closes https://github.com/facebook/react-native/pull/16402 Differential Revision: D8421392 Pulled By: hramos fbshipit-source-id: 719bd37b4681933d35858621b402ae73dd460a5b YellowBox: Restore ES5 Compatibility Reviewed By: sahrens Differential Revision: D8421561 fbshipit-source-id: c2b8d430f4d0c9ce0d5177f0af5eb5f404916024 Publish releases automatically, update docs (#19715) Summary: Now that tests are green, we can return to automatic publishing to npm based on git tags. As long as all tests are passing, deploying a new release of React Native is as easy as tagging a commit. I've updated `Releases.md` to reflect today's release process. Future Work: Include information about updating the website, as this is no longer done automatically. Closes https://github.com/facebook/react-native/pull/19715 Differential Revision: D8429834 Pulled By: hramos fbshipit-source-id: 2c6f2c80ac43c4e6d20c01e06ba14a7e4b16180d Feature/add decimal pad to android (#19714) Summary: For a current use-case we need the a keyboard with characters 0-9 and a decimal point (or comma depending on language settings) This exists on iOS as UIKeyboardType "decimalPad" and this is what react-native maps to for both "numeric" and "decimal-pad". This also exists on Android as inputType "numberDecimal", but is currently not accessible through react-native. This PR maps the value "decimal-pad" of the keyboardType property of TextInput to the Android inputType "numberDecimal", effectively making "decimal-pad" cross platform without breaking anything. * https://facebook.github.io/react-native/docs/textinput.html#keyboardtype * https://developer.apple.com/documentation/uikit/uikeyboardtype * https://developer.android.com/reference/android/widget/TextView#attr_android:inputType There is this bug in some Samsung keyboards where both the - sign and decimal sign disappear when the keyboardType is set to "number" and both the "signed" and "decimal" flags are set. (Like is the case when using the react-native keyboardType prop "numeric".) https://androidforums.com/threads/numeric-soft-keyboard-missing-minus-sign-in-android-8-0-samsung-a5.1272628/ For developers that need decimal numbers but not negative ones, using "decimal-pad" will provide a workaround. I reproduced this on a Samsung A5 only, but maybe other phones have this exact issue. https://github.com/facebook/react-native/issues/12988 https://github.com/facebook/react-native/issues/12977 https://github.com/facebook/react-native/issues/17473 https://github.com/facebook/react-native/issues/17474 * Added testcase consistent with existing keyboardType tests * Also added testcase for the related, but missing number-pad This PR follows the same approach as the recently merged PR introducing "number-pad" https://github.com/facebook/react-native/pull/18350/commits/b638847a46491bd75e7ce7928c73f7cb78399195 Documentation PR: https://github.com/facebook/react-native-website/pull/405 [ANDROID] [ENHANCEMENT] [TextInput] - Added "decimal-pad" keyboard type Closes https://github.com/facebook/react-native/pull/19714 Differential Revision: D8429185 Pulled By: mdvacca fbshipit-source-id: 6b56da2088f2be427ebffa04c4e17c91ffb9f7d9 add google maven repo in android project template (#19712) Summary: This PR will add Google maven repo to RN project template that contains com.android.support:appcompat-v7:26.1.0, thus fixes `react-native run-android` using version 0.56.0-rc.1 CI is Green - https://circleci.com/gh/dulmandakh/react-native/235 new Android projects will build and run just fine. Closes https://github.com/facebook/react-native/pull/19712 Differential Revision: D8433730 Pulled By: hramos fbshipit-source-id: b7d5a1cd5a97b1c4aad2a307158d6dbfcf9a42a5 bump [email protected], [email protected], [email protected] (#19697) Summary: bump [email protected], [email protected], [email protected], as we landed build tools 26.0.2 with https://github.com/facebook/react-native/commit/065c5b6590de18281a8c592a04240751c655c03c Will improve Android build performance. Everything will work as normal, but build faster. <!-- Required. Help reviewers and the release process by writing your own release notes. See below for an example. --> [ANDROID] [ENHANCEMENT] [TOOLS] - bump [email protected], [email protected], [email protected] Closes https://github.com/facebook/react-native/pull/19697 Differential Revision: D8433743 Pulled By: hramos fbshipit-source-id: da72aeb314bed7f63807a0c69bebd24c633cc807 Update GitHub Issue templates (#19723) Summary: Now that we have templates for everything we want to handle in the repo, the bot will go back to automatically closing issues that do not use one of the provided templates. We have an escape valve for generic issues ("For Discussion"), so anyone who gets their issue closed automatically by the bot is unlikely to have read our instructions. Closes https://github.com/facebook/react-native/pull/19723 Differential Revision: D8435415 Pulled By: hramos fbshipit-source-id: 41db33cefce1367ad8f3d9440b7bba27565679cb add RNTester to ci (#19673) Summary: * Current ci is missing an important part to test the whole part. With this we can make sure the js and android part compiles. * Ensure the current android proguard rules is okay. The `my-release-key.keystore` is just a copy of debug.keystore in `react-native/keystores`. Pass all ci. none [GENERAL] [ENHANCEMENT] [CI] - Add RNTester to ci Closes https://github.com/facebook/react-native/pull/19673 Differential Revision: D8435419 Pulled By: hramos fbshipit-source-id: d3d92a5d1b8477c1f298643cc96695769e5c93ea iOS: Fixed the bug where a Backspace event was emitted when entering characters after clearing a text in TextInput by an empty string (#18627) Summary: The bug #18374 was caused by the loose condition to execute `stringByReplacingCharactersInRange` in the method `textInputShouldChangeTextInRange` . As a result, `findMismatch` wrongly returning `true` which ends up the Backspace event being fired in another `textInputShouldChangeTextInRange` call in `textInputDidChange`. <!-- Required: Write your motivation here. If this PR fixes an issue, type "Fixes #issueNumber" to automatically close the issue when the PR is merged. --> 1. Pass all the tests by `yarn run test` 2. Run the following code and type any text. (This code is brought from #18374. Thank you michalpetrov!!) And then verify that 'Backspace' events are not emitted after clearing text and entering any letters. ```javascript type Props = {}; type State = { text: string, keys: string }; export default class App extends Component<Props, State> { state = {text: '', keys: ''} render() { return ( <View style={styles.container}> <TextInput style={styles.textInput} value={this.state.text} onChangeText={this.onChangeText} onKeyPress={this.onKeyPress}/> <Button title="Clear" onPress={this.onClear}/> <Text>Text: {this.state.text}</Text> <Text>Keys: {this.state.keys}</Text> </View> ); } onChangeText = (text: string) => { this.setState({text}) } onKeyPress = ({ nativeEvent }: Object) => { this.setState({keys: this.state.keys + nativeEvent.key + ', '}) } onClear = () => { this.setState({text: '', keys: ''}) } } ``` <!-- Does this PR require a documentation change? Create a PR at https://github.com/facebook/react-native-website and add a link to it here. --> <!-- Required. Help reviewers and the release process by writing your own release notes. See below for an example. --> [IOS] [BUGFIX] [TextInput] - Fixed the bug where Backspace event was emitted when entering a character after clearing a text in TextInput by an empty string <!-- **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI ] [-------------] LOCATION [ DOCS ] [ BREAKING ] [-------------] [ GENERAL ] [ BUGFIX ] [ {Component} ] [ INTERNAL ] [ ENHANCEMENT ] [ {Filename} ] [ IOS ] [ FEATURE ] [ {Directory} ] |-----------| [ ANDROID ] [ MINOR ] [ {Framework} ] - | {Message} | [----------] [-------------] [-------------] |-----------| EXAMPLES: [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see --> Closes https://github.com/facebook/react-native/pull/18627 Differential Revision: D8436331 Pulled By: hramos fbshipit-source-id: ec75a6ca926061cbf7cb106db652f2b4a71c9a0c Refactor Log to Flog in Fabric Reviewed By: shergin Differential Revision: D8363593 fbshipit-source-id: fb4104b66ef3d50d4101c39a1bf4515e6d0ecd19 Adding UIManager performance counters in Fabric Reviewed By: fkgozali Differential Revision: D8381255 fbshipit-source-id: d817557c8a3033d0d7ae47e5ea0a21d224279e29 Add systrace logging for Fabric android Reviewed By: fkgozali Differential Revision: D8387339 fbshipit-source-id: 2e202566541cc25fb6b8773a94e607e8b40fb0ce Tightening some Image Flow Types Reviewed By: yungsters Differential Revision: D7270059 fbshipit-source-id: 3b9727363aeb6910fbbdc613a70d9e8cac97b3b1 ios: expose surfaceForRootTag: up the chain Summary: The app needs to find the surface by rootTag at some point. Reviewed By: shergin Differential Revision: D8391957 fbshipit-source-id: b0bb107b7be882071890afb46de17b50e7ee060d Keep UIManagerModule as a default renderer Reviewed By: fkgozali Differential Revision: D8439626 fbshipit-source-id: d761d977c9e6dab38f21e18da72b045483431f79 Checkbox to inherit from AppCompatCheckBox (#18318) Summary: The checkbox components inherits from `android.widget.CheckBox`. `AppCompatCheckBox` offers better appearance and support for advanced features (eg. tinting) on older APIs. ~~However, the build fails for some reason; If somebody could shed some light on this, I'd appreciate it.~~ Thanks for the comment, I was being blind and somehow ignored the BUCK file. I have created a simple app with a checkbox. Screenshot from android 4.1 (current master): <img src="https://user-images.githubusercontent.com/1566403/37357997-2d34bdb8-26ea-11e8-8c77-709a4f96c6bf.png" width="300" /> Screenshot after applying the change, also android 4.1: <img src="https://user-images.githubusercontent.com/1566403/37358016-3c28fb86-26ea-11e8-8dca-3a92e41450c9.png" width="300" /> https://github.com/facebook/react-native/pull/18300 (this PR is needed to support tinting on older android api levels) [ANDROID] [ENHANCEMENT] [Checkbox] - Checkbox inherits from AppCompatCheckBox Closes https://github.com/facebook/react-native/pull/18318 Differential Revision: D7268393 Pulled By: hramos fbshipit-source-id: 01cb2819f4d56c4e0f94cdd1fb5e1a90667a398a Bump Metro dep in RN preset to 39.1, preset to 5.0.2 Reviewed By: rubennorte Differential Revision: D8445528 fbshipit-source-id: e8937509bb1384a2d62e880c860306d8c86dab92 Revert "Bump soloader to 0.5.0 (#19676)" (#19739) Summary: This reverts commit e3c5524bc65026a4c3d062cb05cee85b6d835286. Closes https://github.com/facebook/react-native/pull/19739 Differential Revision: D8446714 Pulled By: hramos fbshipit-source-id: 1b0e78fe57e9864faafcc766364bd76a1ba5bd03 Bugfix/ci lint proguard (#19724) Summary: * avoid lint to interrupt ci * add proguard rules pass all ci none [GENERAL] [ENHANCEMENT] [CI] - Fix lint and proguard Closes https://github.com/facebook/react-native/pull/19724 Differential Revision: D8446721 Pulled By: hramos fbshipit-source-id: b21c5418210b27dda6a7194995a25df39af0c92a fix permission requests on pre-M android (#19734) Summary: On pre-M devices, `PermissionsAndroid.request` currently returns a boolean, whereas on newer, it returns GRANTED, DENIED or other constants defined in `PermissionsModule.java` given the example form the [docs](https://facebook.github.io/react-native/docs/permissionsandroid.html) which I guess many people use, this will lead to code that does not work before M (it will tell you that permissions are not given even if they are in the manifest). I believe the author of [this](https://github.com/facebook/react-native/commit/51efaab1209a41254c90dcba596d49e3cbc2d925) forgot to change the resolved value in this one place but changed it in other places, eg [here](https://github.com/facebook/react-native/commit/51efaab1209a41254c90dcba596d49e3cbc2d925#diff-2a74096453bc8faa5d4a1599ad0ab33fL99). The docs are written correctly: > On devices before SDK version 23, the permissions are automatically granted if they appear in the manifest, so check and request should always be true. but the code is not right because we'd need to check for `if (granted === PermissionsAndroid.RESULTS.GRANTED || granted === true) {` Also, the behavior is done correctly in [requestMultiplePermissions](https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java#L148) so returning a boolean is an inconsistency. I tested this locally. The code is the same as on line [148](https://github.com/facebook/react-native/blob/26684cf3adf4094eb6c405d345a75bf8c7c0bf88/ReactAndroid/src/main/java/com/facebook/react/modules/permissions/PermissionsModule.java#L148) where it is done correctly. [ANDROID] [BUGFIX] [PermissionAndroid] - return GRANTED / DENIED instead of true / false on pre-M android <!-- **INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.** CATEGORY [----------] TYPE [ CLI …
facebook-github-bot
pushed a commit
that referenced
this pull request
Oct 27, 2020
Summary: This sync includes the following changes: - **[eaaf4cbce](facebook/react@eaaf4cbce )**: 17.0.1 //<Dan Abramov>// - **[6f62abb58](facebook/react@6f62abb58 )**: Remove usage of Array#fill ([#20071](facebook/react#20071)) //<Dan Abramov>// - **[40cfe1f48](facebook/react@40cfe1f48 )**: Update CHANGELOG.md //<Dan Abramov>// - **[f021a983a](facebook/react@f021a983a )**: Bump versions for 17 ([#20062](facebook/react#20062)) //<Dan Abramov>// - **[d1bb4d851](facebook/react@d1bb4d851 )**: Profiler: Include ref callbacks in onCommit duration ([#20060](facebook/react#20060)) //<Brian Vaughn>// - **[c59c3dfe5](facebook/react@c59c3dfe5 )**: useRef: Warn about reading or writing mutable values during render ([#18545](facebook/react#18545)) //<Brian Vaughn>// - **[7b6cac952](facebook/react@7b6cac952 )**: Improved Profiler commit hooks test ([#20053](facebook/react#20053)) //<Brian Vaughn>// - **[dfb6a4033](facebook/react@dfb6a4033 )**: [Fast Refresh] Fix crashes caused by rogue Proxies ([#20030](facebook/react#20030)) ([#20039](facebook/react#20039)) //<Kai Riemann>// - **[37cb732c5](facebook/react@37cb732c5 )**: Use bitwise OR to define flag masks ([#20044](facebook/react#20044)) //<Andrew Clark>// - **[eb3181e77](facebook/react@eb3181e77 )**: Add Visibility flag for hiding/unhiding trees ([#20043](facebook/react#20043)) //<Andrew Clark>// - **[0dd809bdf](facebook/react@0dd809bdf )**: Remove last schedulePassiveEffectCallback call ([#20042](facebook/react#20042)) //<Andrew Clark>// - **[8df7b7911](facebook/react@8df7b7911 )**: Remove Passive flag from "before mutation" phase ([#20038](facebook/react#20038)) //<Andrew Clark>// - **[c57fe4a2c](facebook/react@c57fe4a2c )**: ReactIs.isValidElementType Unit Test extended with PureComponent case ([#20033](facebook/react#20033)) //<adasq>// - **[02da938fd](facebook/react@02da938fd )**: Don't double-invoke effects in legacy roots ([#20028](facebook/react#20028)) //<Brian Vaughn>// - **[d95c4938d](facebook/react@d95c4938d )**: [EventSystem] Revise onBeforeBlur propagation mechanics ([#20020](facebook/react#20020)) //<Dominic Gannaway>// - **[f46a80ae1](facebook/react@f46a80ae1 )**: Update outdated links and fix two broken links ([#19985](facebook/react#19985)) //<Saikat Guha>// - **[0a4c7c565](facebook/react@0a4c7c565 )**: [Flight] Don't warn for key, but error for ref ([#19986](facebook/react#19986)) //<Sebastian Markbåge>// - **[993ca533b](facebook/react@993ca533b )**: Enable eager listeners statically ([#19983](facebook/react#19983)) //<Dan Abramov>// - **[40c52de96](facebook/react@40c52de96 )**: [Flight] Add Runtime Errors for Non-serializable Values ([#19980](facebook/react#19980)) //<Sebastian Markbåge>// - **[1992d9730](facebook/react@1992d9730 )**: Revert "Temporarily disable Profiler commit hooks flag ([#19900](facebook/react#19900))" ([#19960](facebook/react#19960)) //<Brian Vaughn>// - **[44d39c4d7](facebook/react@44d39c4d7 )**: Removed skip-error-boundaries modifications from old fork ([#19961](facebook/react#19961)) //<Brian Vaughn>// - **[cc77be957](facebook/react@cc77be957 )**: Remove unnecessary error overriding in ([#19949](facebook/react#19949)) //<Paul Doyle>// - **[97625272a](facebook/react@97625272a )**: Debug tracing tests for CPU bound suspense ([#19943](facebook/react#19943)) //<Brian Vaughn>// - **[43363e279](facebook/react@43363e279 )**: Fix codestyle for typeof comparison ([#19928](facebook/react#19928)) //<Eugene Maslovich>// - **[5427b4657](facebook/react@5427b4657 )**: Temporarily disable Profiler commit hooks flag ([#19900](facebook/react#19900)) //<Brian Vaughn>// - **[1faf9e3dd](facebook/react@1faf9e3dd )**: Suspense for CPU-bound trees ([#19936](facebook/react#19936)) //<Andrew Clark>// - **[7f08e908b](facebook/react@7f08e908b )**: Fix missing context to componentDidMount() when double-invoking lifecycles ([#19935](facebook/react#19935)) //<Brian Vaughn>// - **[9198a5cec](facebook/react@9198a5cec )**: Refactor layout effect methods ([#19895](facebook/react#19895)) //<Brian Vaughn>// - **[ba82eea38](facebook/react@ba82eea38 )**: Remove disableSchedulerTimeoutInWorkLoop flag ([#19902](facebook/react#19902)) //<Andrew Clark>// - **[c63741fb3](facebook/react@c63741fb3 )**: offscreen double invoke effects ([#19523](facebook/react#19523)) //<Luna Ruan>// - **[c6917346f](facebook/react@c6917346f )**: Fixed broken Profiler test ([#19894](facebook/react#19894)) //<Brian Vaughn>// - **[87c023b1c](facebook/react@87c023b1c )**: Profiler onRender only called when we do work ([#19885](facebook/react#19885)) //<Brian Vaughn>// - **[81aaee56a](facebook/react@81aaee56a )**: Don't call onCommit et al if there are no effects ([#19863](facebook/react#19863)) //<Andrew Clark>// - **[7355bf575](facebook/react@7355bf575 )**: Consolidate commit phase hook functions ([#19864](facebook/react#19864)) //<Andrew Clark>// - **[bc6b7b6b1](facebook/react@bc6b7b6b1 )**: Don't trigger lazy in DEV during element creation ([#19871](facebook/react#19871)) //<Dan Abramov>// - **[a774502e0](facebook/react@a774502e0 )**: Use single quotes in getComponentName return ([#19873](facebook/react#19873)) //<Gustavo Saiani>// - **[8b2d3783e](facebook/react@8b2d3783e )**: Use Passive flag to schedule onPostCommit ([#19862](facebook/react#19862)) //<Andrew Clark>// - **[50d9451f3](facebook/react@50d9451f3 )**: Improve DevTools editing interface ([#19774](facebook/react#19774)) //<Brian Vaughn>// - **[6fddca27e](facebook/react@6fddca27e )**: Remove passive intervention flag ([#19849](facebook/react#19849)) //<Dan Abramov>// - **[36df9185c](facebook/react@36df9185c )**: chore(docs): Removed outdated comment about fb.me link ([#19830](facebook/react#19830)) //<Adnaan Bheda>// - **[16fb2b6f9](facebook/react@16fb2b6f9 )**: Moved resetChildLanes into complete work ([#19836](facebook/react#19836)) //<Brian Vaughn>// - **[cc581065d](facebook/react@cc581065d )**: [email protected] //<Dan Abramov>// - **[0044805c8](facebook/react@0044805c8 )**: Update CHANGELOG.md //<Dan Abramov>// - **[0f70d4dd6](facebook/react@0f70d4dd6 )**: Consider components in jsx as missing dependencies in typescript-eslint/[email protected] ([#19815](facebook/react#19815)) //<Sebastian Silbermann>// - **[84558c61b](facebook/react@84558c61b )**: Don't visit passive effects during layout phase ([#19809](facebook/react#19809)) //<Andrew Clark>// - **[ad8a0a8cd](facebook/react@ad8a0a8cd )**: [email protected] //<Dan Abramov>// - **[77544a0d6](facebook/react@77544a0d6 )**: Update CHANGELOG.md //<Dan Abramov>// - **[ed4fdfc73](facebook/react@ed4fdfc73 )**: test(eslint-plugin-react-hooks): Run with TS parsers >= 2.x ([#19792](facebook/react#19792)) //<Sebastian Silbermann>// - **[cd75f93c0](facebook/react@cd75f93c0 )**: eslint-plugin-react-hooks: fix compatibility with typescript-eslint/[email protected]+ ([#19751](facebook/react#19751)) //<Matthias Schiffer>// - **[781212aab](facebook/react@781212aab )**: Remove double space in test name ([#19762](facebook/react#19762)) //<Gustavo Saiani>// - **[e7b255341](facebook/react@e7b255341 )**: Internal `act`: Flush timers at end of scope ([#19788](facebook/react#19788)) //<Andrew Clark>// - **[d17086c7c](facebook/react@d17086c7c )**: Decouple public, internal act implementation ([#19745](facebook/react#19745)) //<Andrew Clark>// - **[d38ec17b1](facebook/react@d38ec17b1 )**: [Flight] Set dispatcher for duration of performWork() ([#19776](facebook/react#19776)) //<Joseph Savona>// - **[4f3f7eeb7](facebook/react@4f3f7eeb7 )**: Bugfix: Effect clean up when deleting suspended tree ([#19752](facebook/react#19752)) //<Andrew Clark>// - **[7baf9d412](facebook/react@7baf9d412 )**: Combine Flags and SubtreeFlags types ([#19775](facebook/react#19775)) //<Andrew Clark>// - **[166544360](facebook/react@166544360 )**: Rename effect fields ([#19755](facebook/react#19755)) //<Andrew Clark>// - **[708fa77a7](facebook/react@708fa77a7 )**: Decrease expiration time of input updates ([#19772](facebook/react#19772)) //<Andrew Clark>// - **[36df483af](facebook/react@36df483af )**: Add feature flag to disable scheduler timeout in work loop ([#19771](facebook/react#19771)) //<Ricky>// - **[bcc0aa463](facebook/react@bcc0aa463 )**: Revert "Revert "Remove onScroll bubbling flag ([#19535](facebook/react#19535))" ([#19655](facebook/react#19655))" ([#19761](facebook/react#19761)) //<Dan Abramov>// - **[99cae887f](facebook/react@99cae887f )**: Add failing test for passive effect cleanup functions and memoized components ([#19750](facebook/react#19750)) //<Brian Vaughn>// - **[2cfd73c4d](facebook/react@2cfd73c4d )**: Fix typo in comment (Noticable→Noticeable) ([#19737](facebook/react#19737)) //<Ikko Ashimine>// - **[53e622ca7](facebook/react@53e622ca7 )**: Fix instances of function declaration after return ([#19733](facebook/react#19733)) //<Bhumij Gupta>// - **[b7d18c4da](facebook/react@b7d18c4da )**: Support Babel's envName option in React Refresh plugin ([#19009](facebook/react#19009)) //<Kevin Weber>// - **[1f38dcff6](facebook/react@1f38dcff6 )**: Remove withSuspenseConfig ([#19724](facebook/react#19724)) //<Andrew Clark>// - **[1396e4a8f](facebook/react@1396e4a8f )**: Fixes eslint warning when node type is ChainExpression ([#19680](facebook/react#19680)) //<Pascal Fong Kye>// - **[a8500be89](facebook/react@a8500be89 )**: Add `startTransition` as a known stable method ([#19720](facebook/react#19720)) //<Andrew Clark>// - **[380dc95de](facebook/react@380dc95de )**: Revert "Append text string to <Text> error message ([#19581](facebook/react#19581))" ([#19723](facebook/react#19723)) //<Timothy Yung>// - **[ddd1faa19](facebook/react@ddd1faa19 )**: Remove config argument from useTransition ([#19719](facebook/react#19719)) //<Andrew Clark>// - **[92fcd46cc](facebook/react@92fcd46cc )**: Replace SuspenseConfig object with an integer ([#19706](facebook/react#19706)) //<Andrew Clark>// - **[b754caaaf](facebook/react@b754caaaf )**: Enable eager listeners in open source ([#19716](facebook/react#19716)) //<Dan Abramov>// - **[c1ac05215](facebook/react@c1ac05215 )**: [Flight] Support more element types and Hooks for Server and Hybrid Components ([#19711](facebook/react#19711)) //<Dan Abramov>// - **[1eaafc9ad](facebook/react@1eaafc9ad )**: Clean up timeoutMs-related implementation details ([#19704](facebook/react#19704)) //<Andrew Clark>// - **[8da0da093](facebook/react@8da0da093 )**: Disable timeoutMs argument ([#19703](facebook/react#19703)) //<Andrew Clark>// - **[60ba723bf](facebook/react@60ba723bf )**: Add SuspenseList to devTools ([#19684](facebook/react#19684)) //<Ben Pernick>// - **[5564f2c95](facebook/react@5564f2c95 )**: Add React.startTransition ([#19696](facebook/react#19696)) //<Ricky>// - **[c4e0768d7](facebook/react@c4e0768d7 )**: Remove unused argument from `finishConcurrentRender` ([#19689](facebook/react#19689)) //<inottn>// - **[848bb2426](facebook/react@848bb2426 )**: Attach Listeners Eagerly to Roots and Portal Containers ([#19659](facebook/react#19659)) //<Dan Abramov>// - **[d2e914ab4](facebook/react@d2e914ab4 )**: Remove remaining references to effect list ([#19673](facebook/react#19673)) //<Andrew Clark>// - **[d6e433899](facebook/react@d6e433899 )**: Use Global Render Timeout for CPU Suspense ([#19643](facebook/react#19643)) //<Sebastian Markbåge>// - **[64ddef44c](facebook/react@64ddef44c )**: Revert "Remove onScroll bubbling flag ([#19535](facebook/react#19535))" ([#19655](facebook/react#19655)) //<Dan Abramov>// - **[dd651df05](facebook/react@dd651df05 )**: Keep onTouchStart, onTouchMove, and onWheel passive ([#19654](facebook/react#19654)) //<Dan Abramov>// - **[b8fa09e9e](facebook/react@b8fa09e9e )**: provide profiling bundle for react-reconciler ([#19559](facebook/react#19559)) //<Julien Gilli>// - **[23595ff59](facebook/react@23595ff59 )**: Add missing param to safelyCallDestroy() ([#19638](facebook/react#19638)) //<Brian Vaughn>// - **[ee409ea3b](facebook/react@ee409ea3b )**: change destroy to safelyCallDestroy ([#19605](facebook/react#19605)) //<Luna Ruan>// - **[bcca5a6ca](facebook/react@bcca5a6ca )**: Always skip unmounted/unmounting error boundaries ([#19627](facebook/react#19627)) //<Brian Vaughn>// - **[1a41a196b](facebook/react@1a41a196b )**: Append text string to <Text> error message ([#19581](facebook/react#19581)) //<Timothy Yung>// - **[e4afb2fdd](facebook/react@e4afb2fdd )**: [email protected] //<Dan Abramov>// - **[ced05c46c](facebook/react@ced05c46c )**: Update CHANGELOG.md //<Dan Abramov>// - **[702fad4b1](facebook/react@702fad4b1 )**: refactor fb.me redirect link to reactjs.org/link ([#19598](facebook/react#19598)) //<CY Lim>// - **[49cd77d24](facebook/react@49cd77d24 )**: fix: leak strict mode with UMD builds ([#19614](facebook/react#19614)) //<Toru Kobayashi>// - **[ffb749c95](facebook/react@ffb749c95 )**: Improve error boundary handling for unmounted subtrees ([#19542](facebook/react#19542)) //<Brian Vaughn>// - **[9b35dd2fc](facebook/react@9b35dd2fc )**: Permanently removed component stacks from scheduling profiler data ([#19615](facebook/react#19615)) //<Brian Vaughn>// - **[3f8115cdd](facebook/react@3f8115cdd )**: Remove `didTimeout` check from work loop //<Andrew Clark>// - **[9abc2785c](facebook/react@9abc2785c )**: Remove wasteful checks from `shouldYield` //<Andrew Clark>// - **[1d5e10f70](facebook/react@1d5e10f70 )**: [eslint-plugin-react-hooks] Report constant constructions ([#19590](facebook/react#19590)) //<Jordan Eldredge>// - **[dab0854c5](facebook/react@dab0854c5 )**: Move commit passive unmount/mount to CommitWork ([#19599](facebook/react#19599)) //<Sebastian Markbåge>// - **[ccb6c3945](facebook/react@ccb6c3945 )**: Remove unused argument ([#19600](facebook/react#19600)) //<inottn>// - **[629125555](facebook/react@629125555 )**: [Scheduler] Re-throw unhandled errors ([#19595](facebook/react#19595)) //<Andrew Clark>// - **[b8ed6a1aa](facebook/react@b8ed6a1aa )**: [Scheduler] Call postTask directly ([#19551](facebook/react#19551)) //<Andrew Clark>// - **[ce37bfad5](facebook/react@ce37bfad5 )**: Remove resolutions from test renderer package.json ([#19577](facebook/react#19577)) //<Dan Abramov>// - **[2704bb537](facebook/react@2704bb537 )**: Add ReactVersion to SchedulingProfiler render scheduled marks ([#19553](facebook/react#19553)) //<Kartik Choudhary>// - **[0c52e24cb](facebook/react@0c52e24cb )**: Support inner component _debugOwner in memo ([#19556](facebook/react#19556)) //<Brian Vaughn>// - **[0cd9a6de5](facebook/react@0cd9a6de5 )**: Parallelize Jest in CI ([#19552](facebook/react#19552)) //<Andrew Clark>// - **[a63893ff3](facebook/react@a63893ff3 )**: Warn about undefined return value for memo and forwardRef ([#19550](facebook/react#19550)) //<Brian Vaughn>// - **[32ff42868](facebook/react@32ff42868 )**: Add feature flag for setting update lane priority ([#19401](facebook/react#19401)) //<Ricky>// - **[5bdd4c8c6](facebook/react@5bdd4c8c6 )**: Remove unused argument from call to jest method ([#19546](facebook/react#19546)) //<Gustavo Saiani>// - **[a5fed98a9](facebook/react@a5fed98a9 )**: Register more node types that are used later as JSXIdentifiers ([#19514](facebook/react#19514)) //<Mateusz Burzyński>// - **[f77c7b9d7](facebook/react@f77c7b9d7 )**: Re-add discrete flushing timeStamp heuristic (behind flag) ([#19540](facebook/react#19540)) //<Dominic Gannaway>// Changelog: [general] [feature] Upgrade to React 17 Reviewed By: cpojer Differential Revision: D24491201 fbshipit-source-id: c947da9dcccbd614e9dc58f3339b63e24829aca7
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Bug
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Import Started
This pull request has been imported. This does not imply the PR has been approved.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug in
deepFreezeAndThrowOnMutationInDev
which did not take into account that objects passed to it may have been created withObject.create(null)
and thus may not have a prototype. Such objects don't have the methodshasOwnProperty
,__defineGetter__
, or__defineSetter__
on the instance.I ran into an unrecoverable error in React Native when passing this type of object across the bridge because
deepFreezeAndThrowOnMutationInDev
attempts to callobject.hasOwnProperty(key)
,object.__defineGetter__
andobject__defineSetter__
on objects passed to it. But my object instance does not have these prototype methods.Changes:
Object.prototype.hasOwnProperty
as aconst
(pattern used elsewhere in React Native)object.hasOwnProperty(key)
to usehasOwnProperty.call(object, key)
(Per ESLint rule here)object.__defineGetter__
andobject.__defineSetter__
to instead useObject.defineProperty
to define get and set methods on the object. (Per guidance on MDN)deepFreezeAndThrowOnMutationInDev-test
to verify the fix.Test Plan
I tried to create a reproducible example to post to Snack by passing prototype-less objects to a
Text
component, in various ways, but they appear to be converted to plain objects before crossing the bridge and therefore they do not throw an error.However, I was able to create a new test to reproduce the issue. I added the following test to
deepFreezeAndThrowOnMutationInDev-test
:The changes in this PR include this new test.
ESLint test produced no change in Error count (3) or Warnings (671)
Related PRs
N/A
Other areas with possibly the same issue:
react-native/Libraries/vendor/core/mergeInto.js
Line 50 in c6b96c0
react-native/Libraries/ReactNative/requireNativeComponent.js
Line 134 in 8dc3ba0
Release Notes
[GENERAL] [BUGFIX] [Libraries/Utilities/deepFreezeAndThrowOnMutationInDev] -Fix for compatibility with objects without a prototype.