Граф коммитов

385 Коммитов

Автор SHA1 Сообщение Дата
Saad Najmi fdcec4d55b
Match package.json dependencies with RN Core + prettier (#1333)
* update package.json files and yarn lock

* yarn prettier --fix

* Fix remaining yarn lint issues

* Fix integration CI
2022-08-05 16:46:51 -07:00
Adam Gleitman 632e63976c Merge commit 'd3a0c4129d6a5a7beced4e9aa62b2da4e3f4fed4' into 0.68-merge-latest 2022-06-13 15:00:24 -07:00
Adam Gleitman db65cc2e56 Merge commit '0b48ef7ca8a463d8a61da409f0e71239a143d379' into 0.68-merge-latest 2022-06-10 16:49:45 -07:00
Adam Gleitman 8f83923af7 Merge commit 'e22b760e594db97c22b34084a1770ac3a40c0ccf' into 0.68-merge-latest 2022-06-09 17:28:16 -07:00
Adam Gleitman aa8381cf98 nit: fix script name in ReactNativeVersion.js 2022-06-08 15:37:25 -07:00
Adam Gleitman 27e1d1b801 Merge commit 'fd3d949abe46daebb9ccc4b84be9728222d2ddcb' into 0.68-merge-latest 2022-06-08 15:18:15 -07:00
Adam Gleitman 422aec5313 Merge commit 'd123a6fae46cedafeae851cea968b2179674d9d4' into 0.68-merge-latest 2022-05-25 17:57:27 -07:00
Adam Gleitman e833eb42f8 Merge commit 'b27a83b084600f0191c20c7809424bf733a6734b' into 0.68-merge-latest 2022-05-25 16:18:25 -07:00
Adam Gleitman a5a555dad1 Run `yarn lint --fix` after prettier update 2022-05-23 11:02:16 -07:00
Adam Gleitman eaf8a9214d Merge commit 'ebb26cf2e420616c8bf01a5148ca4f8419b238d3' into 0.68-merge-latest 2022-05-23 10:51:35 -07:00
Adam Gleitman 562d288f90 Merge commit 'ed8e5e51516a81158d64dbbf39be3bff9796cc46' into 0.67-merge-latest 2022-05-05 07:37:32 -07:00
Adam Gleitman 5101cc7b9f Merge commit 'e60ad0837e16389a5c71b2189360278c2ee9364c' into 0.67-merge-latest 2022-04-22 16:53:27 -07:00
Saad Najmi cf2105fa49
Remove hardcoded 0.6x.x version numbers from main branch (#944)
* Revert "[0.63.3] Bump version numbers"

This reverts commit 7100756bb8.

* react-native->react-native-macos

* test undoing template change once more

* Add back template change.

* add comments
2022-02-07 14:56:16 -06:00
Chiara Mooney 3d1d4ee457 Update RN Version Expected Structure (#32892)
Summary:
Current syntax options for RN version values break Windows. Following change to nightly build format to be 0.0.0-X-X-X, prerelease value is now a string (X-X-X).

https://github.com/microsoft/react-native-windows/issues/9223

## Changelog

[General] [Fixed] - Fix RN version syntax to match new nightly build structure.

Pull Request resolved: https://github.com/facebook/react-native/pull/32892

Reviewed By: cortinico

Differential Revision: D33712950

Pulled By: lunaleaps

fbshipit-source-id: 9e47cae34930ee624a863c832430962354ebb5be
2022-01-25 22:23:30 -08:00
HeyImChris 793ebb8ba8
Merge 0.66 into master (#951)
* Rename immediate to ReactNativeMicrotask in Bridge

Summary:
Changelog: [Internal]

This diff replaced all the internal occurrences of "Immediate" with
"ReactNativeMicrotask" in the legacy bridge and then polyfilled the
original immediate APIs during the timer setup phases as aliases of them.

Note that this diff is part of a larger refactoring.

Reviewed By: RSNara

Differential Revision: D29785430

fbshipit-source-id: 7325d2a7358a6c9baa3e9abb8acf90414de5072f

* Implement View.removeClippedSubviews prop

Summary:
Changelog: [internal]

Fabric didn't have prop [removeClippedSubviews](https://reactnative.dev/docs/view#removeclippedsubviews) implemented. This diff adds it. It is

Reviewed By: JoshuaGross

Differential Revision: D29906458

fbshipit-source-id: 5851fa41d7facea9aab73ca131b4a0d23a2411ea

* Add "Use Native Driver" control to RNTester Animated Composing example

Summary: Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D29832704

fbshipit-source-id: dfd37d08d0f25fe86716a21682648894e8adad8b

* docs: Fix dead links in README for rn-tester (#31901)

Summary:
Part of https://github.com/facebook/react-native/issues/31788

~Updated link in README that was pointing to master branch to main branch~

Realized that link in rn-tester README and ReactAndroid README leads to a dead link, so I've fixed the links

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[INTERNAL] [FIXED] - Fix dead links in README

Pull Request resolved: https://github.com/facebook/react-native/pull/31901

Test Plan: - [ ] Updated link directs you to appropriate page

Reviewed By: PeteTheHeat

Differential Revision: D29933044

Pulled By: GijsWeterings

fbshipit-source-id: c1f301626acbb2995d74f78d8bc19214c70e9319

* docs: update links to forwarded page (#31903)

Summary:
Some of the links in `CONTRIBUTING.md` redirects you to a different page.
I've fixed the links so each link would directly send users to the appropriate page.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[INTERNAL] [Changed] - update links in CONTRIBUTING.md

Pull Request resolved: https://github.com/facebook/react-native/pull/31903

Test Plan: - [ ] Change links shows the appropriate content

Reviewed By: lunaleaps

Differential Revision: D29933105

Pulled By: GijsWeterings

fbshipit-source-id: b5be74181f8a8e88d8f43e44c469337b7393dedf

* Remove redundant warnings for RCTMountingManager

Summary:
Changelog: [internal]

The warnings are in-actionable for product engineers.

Reviewed By: JoshuaGross

Differential Revision: D29911438

fbshipit-source-id: f0f81588e8cbe88059e531c8be302ab19b8eb83f

* Ignore when a text string or number is supplied as a child.

Summary:
Currently, React Native throws an invariant violation error when a text string or number is supplied as a child. This is undesirable because core library components should be fault-tolerant and degrade gracefully (with soft errors, if relevant).

This change will work when a change in the host configs are landed (https://github.com/facebook/react/pull/21953).

Changelog: [internal]

Reviewed By: yungsters, sammy-SC

Differential Revision: D29894182

fbshipit-source-id: 827ff299991a476b57981382d196c7ee1396ec28

* React Native sync for revisions cae6350...419cc9c

Summary:
This sync includes the following changes:
- **[419cc9c37](https://github.com/facebook/react/commit/419cc9c37 )**: Fix: Hide new/updated nodes in already hidden tree ([#21929](https://github.com/facebook/react/pull/21929)) //<Andrew Clark>//
- **[4758e4533](https://github.com/facebook/react/commit/4758e4533 )**: React Native: Export getInspectorDataForInstance API ([#21572](https://github.com/facebook/react/pull/21572)) //<Brian Vaughn>//
- **[ae5d26154](https://github.com/facebook/react/commit/ae5d26154 )**: Fix: LegacyHidden should not toggle effects ([#21928](https://github.com/facebook/react/pull/21928)) //<Andrew Clark>//
- **[9ab90de60](https://github.com/facebook/react/commit/9ab90de60 )**: Clean-up: Move Offscreen logic from Suspense fiber ([#21925](https://github.com/facebook/react/pull/21925)) //<Andrew Clark>//
- **[3f62dec84](https://github.com/facebook/react/commit/3f62dec84 )**: Typo fix ([#21729](https://github.com/facebook/react/pull/21729)) //<Deniz Susman>//
- **[5579f1dc8](https://github.com/facebook/react/commit/5579f1dc8 )**: Update test comments with explanations ([#21857](https://github.com/facebook/react/pull/21857)) //<Ricky>//
- **[262ff7ad2](https://github.com/facebook/react/commit/262ff7ad2 )**: Refactor "disappear" logic into its own traversal ([#21901](https://github.com/facebook/react/pull/21901)) //<Andrew Clark>//
- **[34600f4fa](https://github.com/facebook/react/commit/34600f4fa )**: Refactor "reappear" logic into its own traversal ([#21898](https://github.com/facebook/react/pull/21898)) //<Andrew Clark>//
- **[310187264](https://github.com/facebook/react/commit/310187264 )**: Clean up flushSync flow types ([#21887](https://github.com/facebook/react/pull/21887)) //<Ricky>//
- **[a97b5ac07](https://github.com/facebook/react/commit/a97b5ac07 )**: [Bugfix] Don't hide/unhide unless visibility changes ([#21875](https://github.com/facebook/react/pull/21875)) //<Andrew Clark>//
- **[81346764b](https://github.com/facebook/react/commit/81346764b )**: Run persistent tests in more configurations in CI ([#21880](https://github.com/facebook/react/pull/21880)) //<Andrew Clark>//
- **[9090257e6](https://github.com/facebook/react/commit/9090257e6 )**: fix: restore execution context after RetryAfterError completed ([#21766](https://github.com/facebook/react/pull/21766)) //<Sebastian Silbermann>//
- **[14bac6193](https://github.com/facebook/react/commit/14bac6193 )**: Allow components to render undefined ([#21869](https://github.com/facebook/react/pull/21869)) //<Ricky>//
- **[87b67d319](https://github.com/facebook/react/commit/87b67d319 )**: Enable scheduling profiler flag for react-dom profiling builds ([#21867](https://github.com/facebook/react/pull/21867)) //<Brian Vaughn>//
- **[464f27572](https://github.com/facebook/react/commit/464f27572 )**: Update link to flow ([#21862](https://github.com/facebook/react/pull/21862)) //<Ehsan Hosseini>//
- **[9f5224a9c](https://github.com/facebook/react/commit/9f5224a9c )**: Restore DevTools console message ([#21864](https://github.com/facebook/react/pull/21864)) //<Dan Abramov>//
- **[a4ecd85e8](https://github.com/facebook/react/commit/a4ecd85e8 )**: act: Batch updates, even in legacy roots ([#21797](https://github.com/facebook/react/pull/21797)) //<Andrew Clark>//
- **[c2c6ea1fd](https://github.com/facebook/react/commit/c2c6ea1fd )**: Capture suspense boundaries with undefined fallbacks ([#21854](https://github.com/facebook/react/pull/21854)) //<Ricky>//
- **[0f09f14ae](https://github.com/facebook/react/commit/0f09f14ae )**: Check if already rendering before flushing //<Andrew Clark>//
- **[54e88ed12](https://github.com/facebook/react/commit/54e88ed12 )**: Bugfix: Flush legacy sync passive effects at beginning of event ([#21846](https://github.com/facebook/react/pull/21846)) //<Andrew Clark>//
- **[cb8afda18](https://github.com/facebook/react/commit/cb8afda18 )**: Add test for #21837 ([#21842](https://github.com/facebook/react/pull/21842)) //<Andrew Clark>//
- **[f85f429d5](https://github.com/facebook/react/commit/f85f429d5 )**: Use `act()` in ReactFabric tests ([#21839](https://github.com/facebook/react/pull/21839)) ([#21841](https://github.com/facebook/react/pull/21841)) //<Andrew Clark>//
- **[84639ab53](https://github.com/facebook/react/commit/84639ab53 )**: Guard against reused fibers in React Native commands ([#21837](https://github.com/facebook/react/pull/21837)) //<Timothy Yung>//
- **[c549bc491](https://github.com/facebook/react/commit/c549bc491 )**: Revert "Use `act()` in ReactFabric tests ([#21839](https://github.com/facebook/react/pull/21839))" ([#21840](https://github.com/facebook/react/pull/21840)) //<Timothy Yung>//
- **[59d3aca68](https://github.com/facebook/react/commit/59d3aca68 )**: Use `act()` in ReactFabric tests ([#21839](https://github.com/facebook/react/pull/21839)) //<Timothy Yung>//
- **[9ccc25a0e](https://github.com/facebook/react/commit/9ccc25a0e )**: Reverting recent flushSync changes ([#21816](https://github.com/facebook/react/pull/21816)) //<Brian Vaughn>//
- **[ed6c091fe](https://github.com/facebook/react/commit/ed6c091fe )**: Replace unbatchedUpdates with flushSync ([#21776](https://github.com/facebook/react/pull/21776)) //<Andrew Clark>//
- **[32eefcb3c](https://github.com/facebook/react/commit/32eefcb3c )**: Replace flushDiscreteUpdates with flushSync ([#21775](https://github.com/facebook/react/pull/21775)) //<Andrew Clark>//
- **[ab390c65e](https://github.com/facebook/react/commit/ab390c65e )**: ReactDebugHooks optionally includes fileName, and line/column numbers ([#21781](https://github.com/facebook/react/pull/21781)) //<Brian Vaughn>//
- **[c96761c7b](https://github.com/facebook/react/commit/c96761c7b )**: Delete batchedEventUpdates ([#21774](https://github.com/facebook/react/pull/21774)) //<Andrew Clark>//
- **[3e8c86c1c](https://github.com/facebook/react/commit/3e8c86c1c )**: fix: maxYieldInterval should not compare with currentTime directly in Scheduler-shouldYieldToHost //<郭帅彬>//
- **[d483463bc](https://github.com/facebook/react/commit/d483463bc )**: Updated scripts and config to replace "master" with "main" branch ([#21768](https://github.com/facebook/react/pull/21768)) //<Brian Vaughn>//

Changelog:
[General][Changed] - React Native sync for revisions cae6350...419cc9c

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross

Differential Revision: D29913856

fbshipit-source-id: 58e4903766a312a64a17cfba0b0f684cf4bcacb0

* Remove option to make measure calls asynchronous

Summary:
Changelog: [internal]

Making measure calls asynchronous in Fabric regresses core metrics, let's remove the option.

Reviewed By: JoshuaGross

Differential Revision: D29909385

fbshipit-source-id: eea3fefc8da757c8db82cb0af340650e2ce6a947

* Fix android view dimensions

Summary:
This diff fixes the Android View dimensions in VR

PixelUtil.toSPFromPixel and PixelUtil.getDisplayMetricDensity() are both using getScreenDisplayMetrics() to perform conversion of dimensions. This is not correct because we should take into consideration the density of the Context / Activity instead of the Screen. This problem didn't raise before in Fabric Android because it seems that android OS on phones usually share the scale between the screen and the Activity?

These two methods are only used in Fabric and they were introduced by D9583972 (5c0da011cb) and D9173758 (8b5e3fc16b)

As part of this diff I'm also deleting the method toSPFromPixel in favor of toDIPFromPixel because I noticed the usages of these methods are meant to use toDIPFromPixel()

changelog: [Internal] internal

Reviewed By: JoshuaGross

Differential Revision: D29864944

fbshipit-source-id: a0a093c120bde21a6cf9e1043a83c31e870d4368

* Refactor DevServerHelper to separate checking if packager running

Summary:
Changelog: [Internal]
Separate the functionality of the  isPackagerRunning() function into a new class PackagerStatusCheck with the intention of being able to use this without needing a DevServerHelper

Reviewed By: makovkastar, ShikaSD

Differential Revision: D29933318

fbshipit-source-id: d708bb987b08634015d6ee6b6c8989faba416c5a

* Introduce queueMicrotask API

Summary:
Changelog:
[General][Added] - Add global.queueMicrotask

`queueMicrotask` is a relatively recent API defined in the WHATWG HTML spec
and it's been widely adopted by all web browsers and Node.js.

This diff introduced it to React Native by polyfilling it via a lazily-allocated
resolved Promise, or calling directly into a fast path provided by Hermes.

Reviewed By: RSNara

Differential Revision: D29838852

fbshipit-source-id: 8c4378b1b713fb8b0da5e67f92ba2ea9838766f7

* Shim Immediate APIs when Promise is queueing to JSVM

Summary:
Changelog: [Internal]

Historically, Immediate API is implemented upon the React Native's
internal microtask-y queue (known as "immediate queue"), which
is the same queue Promise polyfill is operating on.

To make React Native suitable of using the built-in Promises from JSVMs,
which usually enqueues to the JSVM internal microtask queue and has no
access to React Native microtask-y queue, we need to migrate the
Immediate API to use the JSVM microtask queue as well to preserve the
semantics of code relies on the interleaving of promises and immediates.

To do that, this diff implement a shim layer for immediate APIs via the
new `global.queueMicrotask` API (which enqueues to JSVM) in JS, by wrapping
the immediate callback into a "microtask callback", which validate the
`immediate ID` against `clearedImmediate` Set before invoking it.

Reviewed By: RSNara

Differential Revision: D29845305

fbshipit-source-id: c2ed3fed426a5316b1e0dfbfaad51706d1765d4d

* Attempt to fix undefined instance handle in EventTarget

Summary:
changelog: [internal]

Completion block can retain `_eventEmitter` beyond existence of the component. To fix this, do not retain `_eventEmitter` by block but try to acquire it inside it.

Reviewed By: JoshuaGross

Differential Revision: D29969189

fbshipit-source-id: 456c42f816acc160f9d6bbd3f9c8c55d611940b2

* Makes "force" property available to Apple Pencil based events. (#31780)

Summary:
Fixes https://github.com/facebook/react-native/issues/31779

For more detailed explanation, see issue https://github.com/facebook/react-native/issues/31779

React Native touch handler events (onTouchStart, onTouchMoved, etc..) are intended to have "force" properties when used on devices which support pressure input (3D Touch & Apple Pencil events). However, due to a check in RCTForceTouchAvailable() function which checks for UITraitCollection's "forceTouchCapability" to be equal to UIForceTouchCapabilityAvailable, the check returns NO on iPad-based devices, due to iPad devices returning UIForceTouchCapabilityUnavailable at all times. This causes "force" values of Apple Pencils to never be passed on to React Native.
Since simply passing 0 as a value for force across the RN bridge for every touch event seemed like a change that might seem jarring to some, I decided that a simple additional boolean check if the touch event's type is UITouchTypePencil (this is the same as UITouchTypeStylus) should also suffice.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Fixed "force" property of touch events for Apple Pencil/Stylus devices.
[iOS] [Feature] - Added "altitudeAngle" property to touch events from Apple Pencil/Stylus devices.

Pull Request resolved: https://github.com/facebook/react-native/pull/31780

Test Plan:
The code compiles and runs, and trying a simple handler for a View like
````
  touchMove = (e: GestureResponderEvent) => {
    console.log(`pressure, altitude (${e.nativeEvent.force}, ${e.nativeEvent.altitudeAngle})`);
````
results in
<img width="424" alt="Screen Shot 2564-06-28 at 17 13 22" src="https://user-images.githubusercontent.com/5000572/123621055-0b563f00-d835-11eb-9eff-526ba27fdf7b.png">
and when pencil is oriented perpendicular to the screen and pressed with full force shows
<img width="412" alt="Screen Shot 2564-06-28 at 17 13 58" src="https://user-images.githubusercontent.com/5000572/123621139-1c06b500-d835-11eb-8207-68a49720d708.png">

Reviewed By: sammy-SC

Differential Revision: D29964102

Pulled By: sota000

fbshipit-source-id: 5a1f41d64c6fe325afbd2b9579eaf20a522e92dc

* Fix typo in VirtualizedList-test.js (#31756)

Summary:
occured -> occurred

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Fixed] - Fixed typo in VirtualizedList-test.js

Pull Request resolved: https://github.com/facebook/react-native/pull/31756

Test Plan: NONE

Reviewed By: lunaleaps

Differential Revision: D29975153

Pulled By: charlesbdudley

fbshipit-source-id: 966d90df0bf015b4a6a2e3b1bf88c66b61161a7a

* Pass context through to all prop parser (core changes)

Summary:
Unfortunately, parsing some props requires stateful context - namely, PlatformColor on Android. We explored several different options but they all seemed inferior to the approach of using ContextContainer, and most would require using global state.

By introducing this change everywhere as early as possible, we can avoid later pain. It is likely that some prop, on some platform, will require this mechanism. We'll be ready for it!

Because we can pass a constref of the ContextContainer through to all props and because the context and context data is never retained by prop parsers, perf and memory hit should be ~0.

This diff contains core changes only. Leaf changes to all props structs and conversions files will be in next diff(s).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D29838789

fbshipit-source-id: f5090e7f02eb6e8fbe0ef4dd201e7d12104a3e3c

* Pass context through to all prop parser (props structs changes)

Summary:
See previous diffs for context. This updates all of the relevant props structs.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D29855426

fbshipit-source-id: 30177c3380ef82ecf8f2a4321f128cfbe8a576e0

* Pass context through to all prop parser (conversions.h)

Summary:
See previous diffs for context. This updates all conversions.h files.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D29855425

fbshipit-source-id: d5751ddfc2724392e3a35f5e22bb68574e95e737

* Pass PropsParserContext to prop parsing layer

Summary: Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D29921232

fbshipit-source-id: ba045f545b564aedf1b287045a0e75428de30a0f

* Fix typo in Constants.h (#31049)

Summary:
controling -> controlling

## Changelog

[Internal] [Fixed] - Fixed typo in comment

Pull Request resolved: https://github.com/facebook/react-native/pull/31049

Test Plan: NONE

Reviewed By: lunaleaps

Differential Revision: D29980007

Pulled By: charlesbdudley

fbshipit-source-id: 419f28f08d74faa07db18a07ab41b62c41776344

* Daily `arc lint --take CLANGFORMAT`

Reviewed By: zertosh

Differential Revision: D29983521

fbshipit-source-id: bebd38e79180c544c8c1986605cc1af4b1f4df98

* Update Dimension.js typo (#29858)

Summary:
preferred instead of preffered

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[CATEGORY] [TYPE] - Message

Pull Request resolved: https://github.com/facebook/react-native/pull/29858

Reviewed By: charlesbdudley

Differential Revision: D29998754

Pulled By: sota000

fbshipit-source-id: f13fef58e9154ddf8087944d53e022fb9afa6b1b

* Make existential type an error in xplat

Summary:
This diff updates the xplat flowconfigs to make existential types an error.

Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D29967838

fbshipit-source-id: f08bbafe2a0269adb2c9afa4572b7a34fd254a4d

* Remove unused import (#30544)

Summary:
Remove unused import

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [performance] - Remove unused import

Pull Request resolved: https://github.com/facebook/react-native/pull/30544

Test Plan: Should build on CI

Reviewed By: lunaleaps

Differential Revision: D30000901

Pulled By: charlesbdudley

fbshipit-source-id: 3d3310917823b7af57564ca1ea397cd32cd0c4d5

* Updated TextInput autoCompleteType prop to autoComplete 1/2 (#26010)

Summary:
Fix for bug https://github.com/facebook/react-native/issues/26003 Rename TextInput prop "autoCompleteType" to "autoComplete".

## Changelog

[Android] [Changed] - Updated `autoCompleteType` prop of `TextInput` to `autoComplete`

Pull Request resolved: https://github.com/facebook/react-native/pull/26010

Test Plan:
Test Pass

PR for [Doc Update](https://github.com/facebook/react-native-website/pull/1184)

Reviewed By: mdvacca

Differential Revision: D29980220

Pulled By: lunaleaps

fbshipit-source-id: 3c9e7d3250b5f95b0dbd523fdb0d917a039cd6a9

* Implement PlatformColor in Fabric Android

Summary:
This diff implements PlatformColor in Fabric Android

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D29841461

fbshipit-source-id: 63a523626b021c634bc399e749b639b55730391a

* Allows to set individual (left,top,right,bottom) dotted/dashed borders (#29099)

Summary:
This issue:

fixes https://github.com/facebook/react-native/issues/24224 fixes https://github.com/facebook/react-native/issues/28695 fixes https://github.com/facebook/react-native/issues/23651 fixes https://github.com/facebook/react-native/issues/23475  fixes https://github.com/facebook/react-native/issues/22256 fixes https://github.com/facebook/react-native/issues/22226 fixes https://github.com/facebook/react-native/issues/19234 fixes  https://github.com/facebook/react-native/issues/18285  fixes https://github.com/facebook/react-native/issues/17344 fixes https://github.com/facebook/react-native/issues/17343 fixes https://github.com/facebook/react-native/issues/17251 fixes https://github.com/facebook/react-native/issues/12817 fixes https://github.com/facebook/react-native/issues/12403 fixes https://github.com/facebook/react-native/issues/11042 fixes https://github.com/facebook/react-native/issues/9343 fixes https://github.com/facebook/react-native/issues/8236 fixes https://github.com/facebook/react-native/issues/8105 fixes https://github.com/facebook/react-native/issues/7838 fixes https://github.com/facebook/react-native/issues/6721 fixes https://github.com/facebook/react-native/issues/5411 fixes https://github.com/facebook/react-native/issues/3159 fixes https://github.com/facebook/react-native/issues/2335 fixes https://github.com/facebook/react-native/issues/840 fixes https://github.com/facebook/react-native/issues/27133 fixes https://github.com/facebook/react-native/issues/28695

Allows to set individual (left,top,right,bottom) dotted/dashed borders.

If a single border is specified and the borderStyle is dotted or dashed, each border will be drawn with moveTo and lineTo taking in consideration of the border style and thickness.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Quickfix individual border style dotted or dashed rendering as solid

Pull Request resolved: https://github.com/facebook/react-native/pull/29099

Test Plan:
**<details><summary>CLICK TO OPEN TESTS RESULTS</summary>**
<p>

| **AFTER** | **AFTER** |
|:-------------------------:|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/84158300-05e05800-aa6c-11ea-96a3-40007b2ca611.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158309-07aa1b80-aa6c-11ea-973b-51e8e68b5808.png"  width="300" height="" /> |

| **AFTER** | **AFTER** |
|:-------------------------:|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/84158320-0d9ffc80-aa6c-11ea-9d7f-dfba49fbfe41.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158334-11cc1a00-aa6c-11ea-8422-cd5b9384f391.png"  width="300" height="" /> |

| **AFTER** | **AFTER** |
|:-------------------------:|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/84158556-4c35b700-aa6c-11ea-9a4d-eea791b3813a.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158574-51930180-aa6c-11ea-8e84-526cfb168f49.png"  width="300" height="" /> |

| **AFTER** | **AFTER** |
|:-------------------------:|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/84158586-55268880-aa6c-11ea-9540-51d79a8e4cb0.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158601-5952a600-aa6c-11ea-82e7-85d54b858f1a.png"  width="300" height="" /> |

| **AFTER** | **AFTER** |
|:-------------------------:|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/84158638-62dc0e00-aa6c-11ea-8765-ecba0d9d126f.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158652-67a0c200-aa6c-11ea-8336-e6eb8aa52e96.png"  width="300" height="" /> |

| **AFTER** | **AFTER** |
|:-------------------------:|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/84158690-738c8400-aa6c-11ea-9cf1-edec72d27cb7.png" width="300" height="" /> | <img src="https://user-images.githubusercontent.com/24992535/84158912-b6e6f280-aa6c-11ea-94a7-0ee0db685f38.png"  width="300" height="" /> |

</p>
</details>

Reviewed By: mdvacca

Differential Revision: D28688914

Pulled By: RSNara

fbshipit-source-id: 34781d63265dcf55e30f11c014e6b4a35d67dcbd

* Correct error message in getViewState method

Summary:
Changelog: [internal]

Here, getting `viewState` has failed, not its view property.

Reviewed By: mdvacca

Differential Revision: D30042652

fbshipit-source-id: 42831b577f17db1f64860e68be33870f5be27207

* Clean up RAIICallbackManager experiment

Summary:
This experiment was shipped in D27436402 (3d1afbbda3).

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30023039

fbshipit-source-id: 5f7335f2ddaf6f4e2d876a917aaff2cf3d906b5c

* Stop sharing LongLivedObjectCollection with the bridge

Summary:
## Context
Previously, when you'd call TurboModule methods with JavaScript callbacks, we'd [store the callbacks](https://www.internalfb.com/code/fbsource/[c503ff1b38621aebca87b2bbebeae088b01886c4]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/platform/ios/RCTTurboModule.mm?lines=173%2C248-249) into [this global LongLivedObjectCollection collection](https://www.internalfb.com/code/fbsource/[c503ff1b38621aebca87b2bbebeae088b01886c4]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleUtils.h?lines=65). Then, when React Native's JavaScript VM got torn down, we'd [clear the global collection](https://www.internalfb.com/code/fbsource/[e26f476ce208c578f05b1edb7639d1dad5612c7d]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/ReactCommon/TurboModuleBinding.cpp?lines=49), which would ensure that we deleted all held jsi::Functions, before deleting the jsi::Runtime.

## Problem
With bridgeless mode enabled, there can be two TurboModule systems. Further, it is possible to tear down bridgeless mode, or the bridge, without tearing down the other initialization infra. In this scenario, the jsi::Function for the other initialization infra would also get deleted, which could lead to mysterious problems.

## Fix
In this diff, I refactored the jsi::Function cleanup in the TurboModule system. Now, there are 3 modes:
- kGlobalScope: Everything works as it did before
- kRCTGlobalScopeUsingRetainJSCallback: We still use the global LongLivedObjectCollection, but we do it through invoking a block passed to every ObjCTurboModule by the TurboModuleManager. This group exists to assess the impact of having each TurboModule retain/use the block. I suspect this will be negligible, but it'd be good to have actual data to back this claim.
- kRCTTurboModuleManagerScope: Every TurboModule uses a LongLivedObjectCollection that is owned by its TurboModuleManager. This should effectively fix the problem I outlined above.

Changelog: [Internal]

Reviewed By: p-sun

Differential Revision: D30019833

fbshipit-source-id: da50d884c7e37190107f570d8ed70eeda7d9ae83

* Stop sharing LongLivedObjectCollection with the bridge

Summary:
This is the Android analogue to D30019833.

Changelog: [Internal]

Reviewed By: p-sun

Differential Revision: D30029295

fbshipit-source-id: 13df0dfb915697eeedcc527dcdb6c246e89afb0c

* setup fragment based tab bar navigation

Summary: `Changelog: [Android] [Changed] - Make ReactFragment variables protected instead of private, create getter for ReactDelegate`

Reviewed By: keoskate

Differential Revision: D29981436

fbshipit-source-id: 3e5df811cd07edccf37f72c9f917f9ea0882be0b

* Remove 'using namespace facebook::jni'

Summary:
Ez diff to remove 'using namespace facebook::jni'

changelog: [internal] internal

Reviewed By: sshic

Differential Revision: D30046080

fbshipit-source-id: 52100970a408d772854cc0783fa13edd0cc39235

* Add TODO to fix and enable 'generated_tests-codegen_testsAndroid'

Summary:
Add TODO to fix and enable 'generated_tests-codegen_testsAndroid'

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D30046143

fbshipit-source-id: dbeba6f1d51b32c069bda8bb9ca976014d299dae

* Move RNTester Buck library to GitHub (#31435)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31435

Moves the Facebook-internal Buck target definition for RNTester closer to the actual source files. This does not affect how RNTester is built in open source.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D27942209

fbshipit-source-id: 66c970a5464a9329597d155ceeca78fb7f4834e8

* Move react-native Buck library to GitHub

Summary:
Moves the Facebook-internal Buck target definition for React Native closer to the actual JS source files. This does not affect how React Native is built in open source.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D27942687

fbshipit-source-id: 328febb661ed6597feafdfd8efb2a95365325348

* Extract feature detection as an utilitiy module

Summary:
Changelog: [Internal]

This diff only extracted the `isNativeFunction` used in `setUpTimers`
into the `FeatureDetection` utility, but later we will add more functions
in it and reuse them in other places.

Reviewed By: RSNara

Differential Revision: D29986750

fbshipit-source-id: 6e48e38d92ceccb35eead3c52e00e1eecb81b5b0

* Conditionalize the Regenerator Setup

Summary:
Changelog: [Internal]

If generators are provided natively, that should suggest that the JS source
code did not go through the regenerator-transform (e.g. in Metro Hermes profile),
then there is no need to set up the regenerator runtime.

This should save some work during the Core initialization.

Reviewed By: motiz88

Differential Revision: D29986751

fbshipit-source-id: 129f5122e8e4c05535ee2aa5da6970a66843e8cd

* Protect against crashes when over-releasing a TouchEvent

Summary:
It seems that, possibly due to optimizations and refactoring elsewhere in the event system, some TouchEvents are being over-disposed.

This doesn't really pose a problem besides performance; and could even indicate that an Event was in a pool but never properly initialized. In these
cases it seems perfectly reasonable to silently continue, and to log a soft exception. This WILL still crash in debug mode, so we can gather more information
if we find a good repro; otherwise we will continue to get production data from this soft exception if it's an issue and we can investigate further.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D30061178

fbshipit-source-id: 05d1f60afc382ce0a202ac8f3de34770cf9a760d

* Co-locate Buck targets for JS polyfills with their sources

Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D30032230

fbshipit-source-id: 0d714b4e0a79a9c5c1c21e79f782635d8bd9c5f1

* chore: update Dimensions API Flow types (#31898)

Summary:
This small PR updates the Flow types used in Dimensions. The following changes has been made:
* generic types has been replaced with types from `NativeDeviceInfo` (which already were used in event subscription update)
* ~simplification of `DisplayMetricsAndroid` by spreading via intersection with `DisplayMetrics` type and removing shared properties~
  > I have tried both notations, but according to the lint, it looks like a Native Modules typing limitation which requires redundancy / code duplication in cases like this.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Changed] - update Dimensions API Flow types

Pull Request resolved: https://github.com/facebook/react-native/pull/31898

Test Plan: Running `yarn flow` in the workspace yields no errors.

Reviewed By: yungsters

Differential Revision: D29932940

Pulled By: GijsWeterings

fbshipit-source-id: bf97bb972964c585207e2450ccf71d932555e291

* Fix order of calls for Native Animated Module

Summary:
Changelog: [internal]

Make sure the order of call is preserved for `NativeAnimatedModule`. The order of calls to NativeAnimatedModule needs to be preserved because its internals depend on it. For example, if you `getValue` is called before `createAnimatedNode`, it causes a crash.

To resolve it, we need to enqueue `getValue` onto operationQueue.

Reviewed By: JoshuaGross

Differential Revision: D30035911

fbshipit-source-id: bbd698a96cada5d2b1312a1a689ca99b04a07cdc

* Merge BUCK file at Libraries/ into root

Summary:
Merges the Facebook-internal Buck target definitions in `Libraries/` into the BUCK file at the root of the repo (which is currently not synced to GitHub at all). This does not affect how React Native is built in open source.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D27967499

fbshipit-source-id: 39c51a544b3868242598072d24cb6cfb5a6e2d8c

* Fix Buck package boundary violation in core components schema

Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D29996246

fbshipit-source-id: e560c7261c4274da5219dc1e2d59d46b60e7549e

* Allow resolving view from FabricUIManager

Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30043188

fbshipit-source-id: d8675754b29fb58a28a06777f602098da6dbc27f

* Flush operations queue when animation starts

Summary:
changelog: [internal]

If nodesManager has the information if animated node is managed by Fabric, we can't decide if the operation queue should be flushed before it is flushed. Therefore, keep the information about animated nodes inside a set instead of nodesManager.

For simplicity, I will refer to class `RCTNativeAnimatedTurboModule` as *NativeAnimated* and to `RCTNativeAnimatedNodesManager` as *NodesManager*

Notice that each call to *NativeAnimated* is queued up in `_operations` or `_preOperations`. When the queues are flushed, only then methods are called on `RCTNativeAnimatedNodesManager`.

There are two mechanisms that flush operations.
One is triggered by `RCTMountingManager` before mounting operations are applied and after they are applied. This works fine but is important to paint the picture.

The second mechanism is inside `[RCTNativeAnimatedTurboModule startAnimatingNode]`. It flushes the queues for Fabric nodes only (not sure why Fabric nodes only, I couldn't find any explanation in old diffs). It checks with *NativeAnimated* if a node is managed by Fabric. Keep in mind, *NodesManager* only knows about the nodes when the queues have been flushed.

Exampe:
JavaScript calls methods on *NativeAnimated*.
For example:
1. `createNode`
2. `connectAnimatedNodeToView`
3. `startAnimatingNode`. (here, the queues should be flushed, since we are in Fabric)

All of these operations are queued up and for as long as `RCTMountingManager` executes mounting, all proceeds as expected.
But if those operations happen after mounting phase, `startAnimatingNode` will not flush the operations queues, because it can't tell if nodeTag is managed by fabric or it isn't. This is because *NodesManager* hasn't been notified about any new nodes.

Reviewed By: JoshuaGross, p-sun

Differential Revision: D30053890

fbshipit-source-id: b7fe24861d5300f9cfefa813a53df8330fa56d86

* iOS: Log error when invalid NSNull data is passed to RCTAsyncLocalStorage

Summary: Changelog: [Internal]

Differential Revision: D30081478

fbshipit-source-id: 7d425e71b020eaeb4eb1b33b500fbf5df7ea9c29

* fbshipit-source-id: 909b2667480ed96ae376896d966f6c27f5e73964

* Update OSS Buck definitions (#31948)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31948

Changelog: [Internal]

Adds necessary shims to bring our BUCK files closer to parsing/building correctly in open source. This is part of fixing the Buck-based tests on CircleCI which were broken by d4ee734f32.

Reviewed By: sammy-SC

Differential Revision: D30072866

fbshipit-source-id: 4aebd9f67dd0a102516603915d9a021032611279

* Update Android Dockerfile to include root BUCK file (#31950)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31950

Changelog: [Internal]

Adds the root BUCK file to the Docker image we use to test RNTester on CircleCI. See df9cd05621

Reviewed By: ShikaSD

Differential Revision: D30099261

fbshipit-source-id: 936c505a0f4e7b791743901a06fa3b14c40b183e

* Check for negative `numberOfLines` in TextView

Summary:
Negative `numberOfLines` prop is not supported by Android and causes a crash during layout measurement. This change adds a check in JS to catch the error earlier.

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D30047103

fbshipit-source-id: 4248a0f573c3b6facd25c7ae6ce007a357a1469b

* Fix NPE when hierarchy return null values

Summary:
This diff fixes a NullPointer that was being thorwn when hierarchy values are null

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D30095407

fbshipit-source-id: b0a13661b4506cf94eeb5d99923d4c12cba0f972

* Extend getInspectorDataForInstance to return props

Summary:
This diff extends the FabricUIManager.getInspectorDataForInstance to return the props of the React Native component associated to the view passed as a parameter.

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D30095406

fbshipit-source-id: 50fdba6636a1f5042dbc113e341c3cb2534a1b04

* Add documentation for FabricUIManager.getInspectorDataForInstance

Summary:
Add documentation for FabricUIManager.getInspectorDataForInstance

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D30095818

fbshipit-source-id: dfe8590598099e7581460ca45bc0e779690463a6

* chore: remove FlowFixMe (#29468)

Summary:
Removed FlowFixMe that has been fixed

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Removed FlowFixMe that has been fixed

Pull Request resolved: https://github.com/facebook/react-native/pull/29468

Test Plan: flow check passes

Reviewed By: JoshuaGross

Differential Revision: D29967702

Pulled By: lunaleaps

fbshipit-source-id: 541279287ba6f21c5c7290bcba7c282f092126ff

* Move RCT* Buck targets to GitHub

Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D30030454

fbshipit-source-id: 02a4c36f5c5ca519e4de3d1a3d79708d0d0b6d01

* Move integration test Buck targets to GitHub

Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D30032467

fbshipit-source-id: 56e293c821f02e78fe13f5e7f22bcb2b2050019a

* Move RNTester unit/integration test Buck targets to GitHub

Summary: Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D30032476

fbshipit-source-id: d1f9a39a6d2fc92f69b9ee931c2a0f3ba37687f6

* Move RCTTestApple into packages/rn-tester

Summary: Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30056021

fbshipit-source-id: 9012ca6934f95946ff157ca472aa6a6e84d7d7e9

* React Native sync for revisions 419cc9c...19092ac

Summary:
This sync includes the following changes:
- **[19092ac8c](https://github.com/facebook/react/commit/19092ac8c )**: Re-add old Fabric Offscreen impl behind flag ([#22018](https://github.com/facebook/react/pull/22018)) //<Andrew Clark>//
- **[215db465a](https://github.com/facebook/react/commit/215db465a )**: [Fabric] Add `flex: 1` to Offscreen view container ([#22019](https://github.com/facebook/react/pull/22019)) //<Andrew Clark>//
- **[8a37b0ef3](https://github.com/facebook/react/commit/8a37b0ef3 )**: typos fixed ([#21955](https://github.com/facebook/react/pull/21955)) //<Sinan Sonmez (Chaush)>//
- **[e3049bb85](https://github.com/facebook/react/commit/e3049bb85 )**: DevTools scheduling profiler: Add React component measures ([#22013](https://github.com/facebook/react/pull/22013)) //<Brian Vaughn>//
- **[27bf6f9a8](https://github.com/facebook/react/commit/27bf6f9a8 )**: Scheduling profiler UX changes ([#21990](https://github.com/facebook/react/pull/21990)) //<Brian Vaughn>//
- **[f0d354efc](https://github.com/facebook/react/commit/f0d354efc )**: [Fabric] Fix reparenting bug in legacy Suspense mount ([#21995](https://github.com/facebook/react/pull/21995)) //<Andrew Clark>//
- **[34308b5ad](https://github.com/facebook/react/commit/34308b5ad )**: Tidy up early bailout logic at start of begin phase ([#21852](https://github.com/facebook/react/pull/21852)) //<Andrew Clark>//
- **[321087d13](https://github.com/facebook/react/commit/321087d13 )**: [Fizz] Don't add aborted segments to the completedSegments list ([#21976](https://github.com/facebook/react/pull/21976)) //<Sebastian Markbåge>//
- **[4cc8ec64c](https://github.com/facebook/react/commit/4cc8ec64c )**: Separate unit tests for ReactFabricHostComponent ([#21969](https://github.com/facebook/react/pull/21969)) //<Timothy Yung>//
- **[d4d786493](https://github.com/facebook/react/commit/d4d786493 )**: Fix `ReactFabricHostComponent` methods if detached ([#21967](https://github.com/facebook/react/pull/21967)) //<Timothy Yung>//
- **[392253a77](https://github.com/facebook/react/commit/392253a77 )**: [Fabric] Use container node to toggle the visibility of Offscreen and Suspense trees ([#21960](https://github.com/facebook/react/pull/21960)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 419cc9c...19092ac

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross

Differential Revision: D30092460

fbshipit-source-id: 9f118db2419a9a5db26a9b873868f91ab88f2f89

* refactor!: drop deprecated `StatusBarIOS` (#31466)

Summary:
This component has been merged with `StatusBar` and deprecated since [Jun 24, 2019](a833778553)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[JavaScript] [Removed] - refactor!: drop deprecated `StatusBarIOS`

Pull Request resolved: https://github.com/facebook/react-native/pull/31466

Test Plan: Warning when user imports `StatusBarIOS`

Reviewed By: yungsters

Differential Revision: D30109324

Pulled By: lunaleaps

fbshipit-source-id: fa2d3aa2cf35206ed8a196e09f12af57d3b61ccc

* Fix OSS Buck parsing errors (#31957)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31957

Changelog: [Internal]

Some fixes for the GitHub shims for FB-internal Buck macros. Should fix the Buck-related breakages in the `test_android` and `test_docker` CI jobs.

Also adds license headers to some recently-added files that didn't have them.

Reviewed By: mdvacca

Differential Revision: D30114177

fbshipit-source-id: 88a24fa7130bd98dd60568566bde51fcfc89df60

* Fix Buck package boundary violation involving RCTEventDispatcher.h (#31965)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31965

Changelog: [Internal]

Reviewed By: GijsWeterings

Differential Revision: D30030580

fbshipit-source-id: 3b4140a831c7ad7282aae0ff79c54014dcd82615

* Remove package boundary exceptions in OSS Buck config

Summary: Changelog: [Internal]

Reviewed By: stepancheg

Differential Revision: D30102445

fbshipit-source-id: 571ab5dc41379e01d4482f64418f6383f660dbfa

* Update JSLoader.cpp (#29270)

Summary:
Since react-native-cli is deprecated, the correct command should be `npx react-native start`

Pull Request resolved: https://github.com/facebook/react-native/pull/29270

Reviewed By: sammy-SC

Differential Revision: D30017028

Pulled By: sota000

fbshipit-source-id: cfcf9e1d150f51750a4e86133bd3167506ee7348

* Warn when negative `numberOfLines` prop set on <Text/> component

Summary:
Updates previous variant that was crashing a surface to the non-crashing variant.
Now it prints error in console and modifies value to be 0.

Changelog: [General][Fixed] Clamp negative values for `numberOfLines` in <Text> component

Reviewed By: yungsters

Differential Revision: D30129658

fbshipit-source-id: fda47a262365573514d3e1e4bf8a26f6d30cdae0

* Make So loading inside generated TMM delegates less confusing

Summary:
## Rationale
Inlining the maybeLoadSoLibrary private static method makes following the So load chain from TurboModuleManagerDelegate through ReactPackageTurboModuleManagerDelegate to each app's TurboModuleManagerDelegate much easier to understand.

Changelog: [Internal]

Reviewed By: sshic

Differential Revision: D30082675

fbshipit-source-id: ff467d6ac8c792317dd9bdcd91844d3b480cbb60

* Add TODOs to unify component names between JS - Android - iOS - C++

Summary:
EZ diff that adds a few TODOs to unify component names between JS - Android - iOS - C++
see task: T97384889

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D30139942

fbshipit-source-id: 91f51d04e7e7ecba7f059f94a121be43d820647d

* Replace Paper -> old renderer

Summary:
Replace Paper -> old renderer

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D30139941

fbshipit-source-id: 3bb1e81a3df018aa669f3dba1de445107d70116c

* Fix Deadlock in RCTi18nUtil (iOS) (#31032)

Summary:
Note: PR to react-native-macos here https://github.com/microsoft/react-native-macos/pull/733

Internally in Microsoft code, we ran into a deadlock where the main queue and the UIManager queue were both trying to access `[RCTI18nUtil sharedInstance]`, and were blocked on each other. This is similar to an earlier issue with RCTScreenScale decsribed [here](https://github.com/facebook/react-native/issues/18096).

To summarize:
1- RCTShadowView (on the UIManager queue) and RCTView (on the main queue) both try to access `[RCTI18nUtil sharedInstance]`
2- The UIManager thread gets there first, and lazily initializes the sharedInstance. Meanwhile, the main thread is waiting on a lock possessed by the UIManager thread
3- As part of the initialization, we set an NSUserDefault, which seems to require the (blocked) main thread.
4- Deadlock.

For whatever reason, this only happens on debug. I did not figure out why, but I do know based on [this comment](https://github.com/facebook/react-native/issues/18096#issuecomment-368718081), that the UIManagerQueue should never block the main queue.

The fix is to not use NSUserDefaults, and simpy use atomic properties instead. We get the thread safety for free, and it also simplifies the code somewhat without changing the public API. The downside is values aren't persisted anymore, but I do not think that was necessary / intended.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - Fix deadlock on RCTi18nUtil

Pull Request resolved: https://github.com/facebook/react-native/pull/31032

Test Plan:
Ran the RTLExample in RNTester, and ensured switching to RTL still worked, and that setting forceRTL would still work after reloading the bundle.

https://user-images.githubusercontent.com/6722175/108775429-aefdae80-7526-11eb-9a89-3114f7ddc2af.mov

Reviewed By: javache

Differential Revision: D29522152

Pulled By: RSNara

fbshipit-source-id: 160840f63a7b1d6721b0fd8294fb11990a4509fa

* Codegen: Always prepare filesystem

Summary:
For any Pod that uses the codegen, create references to code-gen'd files in local filesystem regardless of Pod install status by invoking the same command used by `prepare_command` whenever `pod install` is run.

This works around the issue where CocoaPods may decide to skip running `prepare_command`. While this is expected CocoaPods behavior, external factors may result in the deletion of the original code-gen'd files in which case we need to make sure that running `pod install` will bring these files back.

See Test Plan for more details on how to reproduce the issue being fixed.

Fixes T97404254.

Changelog:

[Internal] Codegen invoked with every `pod install` regardless of pod install status

Differential Revision: D30116640

fbshipit-source-id: 81db5dff1d4c4f8ae22b5dbe822609c770789ac8

* - Bump CLI to ^6.0.0 (#31971)

Summary:
Upgrade CLI to the v6 stable. [Changelog](https://github.com/react-native-community/cli/releases/tag/v6.0.0)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fix] - Bump CLI to ^6.0.0

Pull Request resolved: https://github.com/facebook/react-native/pull/31971

Test Plan: cc kelset grabbou

Reviewed By: TheSavior

Differential Revision: D30158170

Pulled By: ShikaSD

fbshipit-source-id: 392e22cb112a830778149b4a2b4a19198facf42b

* Fix to make taps on views outside parent bounds work on Android (#29039)

Summary:
By default, Views in React Native have `overflow: visible`. When a child view is outside of the parent view's boundaries, it's visible on Android, but not tappable. This behaviour is incorrect, and doesn't match iOS behaviour.

- Taps on Views outside the bounds of a parent with `overflow: visible` (or unset) should register
- Taps on Views outside the bounds of a parent with `overflow: hidden` should continue to not register

Related issues:

- fixes https://github.com/facebook/react-native/issues/21455
- fixes https://github.com/facebook/react-native/issues/27061
- fixes https://github.com/facebook/react-native/issues/27232

### Fix

- Made `findTouchTargetView` not check that the touch was in the bounds of the immediate children, but instead
  - Check that the touch is in its own bounds when returning itself
  - Check that the touch for a child is in its own bounds only when `overflow: hidden` is set
- Modified related code to adjust to this change
- Added RNTesterApp test

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Allow taps on views outside the bounds of a parent with `overflow: hidden`

Pull Request resolved: https://github.com/facebook/react-native/pull/29039

Test Plan:
This can be tested with 2 examples added to the bottom of the PointerEvents page of the RNTesterApp:

| Before | After |
| --- | --- |
| ![Before](https://user-images.githubusercontent.com/2937410/83610933-19079b00-a535-11ea-8add-22daae0191e1.gif) | ![After](https://user-images.githubusercontent.com/2937410/83610583-8830bf80-a534-11ea-97e2-71e180a70343.gif) |

Reviewed By: ShikaSD

Differential Revision: D30104853

Pulled By: JoshuaGross

fbshipit-source-id: 644a109706258bfe829096354dfe477599e2db23

* Create slider accessibility delegate in createViewInstance (#31942)

Summary:
Recent change in https://github.com/facebook/react-native/pull/31865 made it so if `ReactSliderManager` is created on the react context creation thread it will crash with the following error. This happens because `ReactAccessibilityDelegate` tries to create a handler on a thread without a looper.

This seems to happen because react-native-reanimated tries to get the UIManager module during its initialization which will cause view managers to be created and explains why the crash probably does not happens in RNTester or using only RN bundled modules.

```
08-03 14:44:56.318 21206 21360 E AndroidRuntime: FATAL EXCEPTION: create_react_context
08-03 14:44:56.318 21206 21360 E AndroidRuntime: Process: com.th3rdwave, PID: 21206
08-03 14:44:56.318 21206 21360 E AndroidRuntime: java.lang.ExceptionInInitializerError
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.shell.MainReactPackage.createViewManagers(MainReactPackage.java:166)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.ReactInstanceManager.getOrCreateViewManagers(ReactInstanceManager.java:882)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.CoreModulesPackage.createUIManager(CoreModulesPackage.java:137)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.CoreModulesPackage.getModule(CoreModulesPackage.java:102)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:159)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.TurboReactPackage$ModuleHolderProvider.get(TurboReactPackage.java:147)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.bridge.ModuleHolder.create(ModuleHolder.java:191)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.bridge.ModuleHolder.getModule(ModuleHolder.java:156)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.bridge.NativeModuleRegistry.getModule(NativeModuleRegistry.java:153)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:486)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.bridge.CatalystInstanceImpl.getNativeModule(CatalystInstanceImpl.java:462)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.bridge.ReactContext.getNativeModule(ReactContext.java:176)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.swmansion.reanimated.NodesManager.<init>(NodesManager.java:153)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.swmansion.reanimated.ReanimatedModule.getNodesManager(ReanimatedModule.java:101)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.swmansion.reanimated.ReanimatedJSIModulePackage.getJSIModules(ReanimatedJSIModulePackage.java:17)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.th3rdwave.MainApplication$1$1.getJSIModules(MainApplication.java:135)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.ReactInstanceManager.createReactContext(ReactInstanceManager.java:1329)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.ReactInstanceManager.access$1100(ReactInstanceManager.java:136)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.ReactInstanceManager$5.run(ReactInstanceManager.java:1058)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at java.lang.Thread.run(Thread.java:923)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: Caused by: java.lang.RuntimeException: Can't create handler inside thread Thread[create_react_context,5,main] that has not called Looper.prepare()
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at android.os.Handler.<init>(Handler.java:227)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at android.os.Handler.<init>(Handler.java:129)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.uimanager.ReactAccessibilityDelegate$1.<init>(ReactAccessibilityDelegate.java:185)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.uimanager.ReactAccessibilityDelegate.<init>(ReactAccessibilityDelegate.java:184)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.views.slider.ReactSliderManager$ReactSliderAccessibilityDelegate.<init>(ReactSliderManager.java:281)
08-03 14:44:56.318 21206 21360 E AndroidRuntime: 	at com.facebook.react.views.slider.ReactSliderManager.<clinit>(ReactSliderManager.java:301)
```

To fix it I changed the delegate creation to be done in `createViewInstance` which will be called on main thread. This is also more in line with how other accessibility delegates are created for other view managers. Since Slider is probably not used a lot, creating more delegate instance won't be an issue.

Another alternative could be to initialize a Looper on the thread that creates the react context, but it seems more involved and probably not needed.

## Changelog

[Android] [Fixed] - Create slider accessibility delegate in createViewInstance

Pull Request resolved: https://github.com/facebook/react-native/pull/31942

Test Plan: Reproduced the crash in an app and made sure this patch fixes it.

Reviewed By: JoshuaGross

Differential Revision: D30167451

Pulled By: p-sun

fbshipit-source-id: 5327130064db52ac0086e1ae5541a1b3e3954f15

* Flush operations queue when animation starts in RCTNativeAnimatedModule

Summary:
changelog: [internal]

If nodesManager has the information if animated node is managed by Fabric, we can't decide if the operation queue should be flushed before it is flushed. Therefore, keep the information about animated nodes inside a set instead of nodesManager.

For simplicity, I will refer to class `RCTNativeAnimatedTurboModule` as *NativeAnimated* and to `RCTNativeAnimatedNodesManager` as *NodesManager*

Notice that each call to *NativeAnimated* is queued up in `_operations` or `_preOperations`. When the queues are flushed, only then methods are called on `RCTNativeAnimatedNodesManager`.

There are two mechanisms that flush operations.
One is triggered by `RCTMountingManager` before mounting operations are applied and after they are applied. This works fine but is important to paint the picture.

The second mechanism is inside `[RCTNativeAnimatedTurboModule startAnimatingNode]`. It flushes the queues for Fabric nodes only (not sure why Fabric nodes only, I couldn't find any explanation in old diffs). It checks with *NativeAnimated* if a node is managed by Fabric. Keep in mind, *NodesManager* only knows about the nodes when the queues have been flushed.

Exampe:
JavaScript calls methods on *NativeAnimated*.
For example:
1. `createNode`
2. `connectAnimatedNodeToView`
3. `startAnimatingNode`. (here, the queues should be flushed, since we are in Fabric)

All of these operations are queued up and for as long as `RCTMountingManager` executes mounting, all proceeds as expected.
But if those operations happen after mounting phase, `startAnimatingNode` will not flush the operations queues, because it can't tell if nodeTag is managed by fabric or it isn't. This is because *NodesManager* hasn't been notified about any new nodes.

Reviewed By: RSNara

Differential Revision: D30099010

fbshipit-source-id: d3fc021dd4346d1cbbda3b49ecd9d982c543e705

* Add Flow libdefs for `global`

Summary:
Changelog: [Internal]

Currently, `global` is typed as `any` and any `global` properties
accesses are untyped. This diff add a flow libdefs for the `global`
object as a start point.

Reviewed By: yungsters

Differential Revision: D30000895

fbshipit-source-id: ab6988d01921a3c2a3434b534b2f69083570fb6d

* Feat/dynamic color borders (#31140)

Summary:
Following up my issue https://github.com/facebook/react-native/issues/30377 I decided to have a look myself and contribute.

On iOS, border colors using `PlatformColor` or `DynamicColorIOS` do not update on the fly when the system appearance updates.
When the component mounts, the color is correct for the current appearance, but a component unmout/remount is required in order to see the color changing after a system appearance change.

Fixes https://github.com/facebook/react-native/issues/30377

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Added] - Added `PlatformColor` and `DynamicColorIOS` examples to RNTester

Pull Request resolved: https://github.com/facebook/react-native/pull/31140

Test Plan:
I added 2 border examples, one using `PlatformColor` and the other using `DynamicColorIOS`. I recorded the following before/after videos showing the effect of my changes:

https://user-images.githubusercontent.com/4186230/110828711-9c5dd600-8297-11eb-8bc8-bdc9054b6b44.mov

https://user-images.githubusercontent.com/4186230/110828800-b4cdf080-8297-11eb-9d23-07f69dc3a702.mov

Reviewed By: lunaleaps

Differential Revision: D30073335

Pulled By: charlesbdudley

fbshipit-source-id: 2990a6ed40dd08fc2b1f20e93d6f21ec3d8980da

* Cleanup warnings in the NDK build

Summary:
This diff is cleaning up some configurations in the `Android.mk` files
of the native build. Specifically I simplified some of the rules and removed
a duplicate file specification.

Changelog:
Internal - Cleanup warnings in the NDK build

Reviewed By: ShikaSD

Differential Revision: D30220715

fbshipit-source-id: a100953fe977879a6d28cb0a2ef4b3358fb7c774

* Back out "Flush operations queue when animation starts in RCTNativeAnimatedModule"

Summary:
Changelog: [internal]

Original commit changeset: d3fc021dd434

Reviewed By: motiz88

Differential Revision: D30223203

fbshipit-source-id: 8edf79e109858855d13a36fabab2bcae36180df2

* Fix Undefined symbol: __swift_FORCE_LOAD_$_swiftFileProvider when building with Xcode 13

Summary:
Changelog: Fix Xcode 13 build error in HelloWorld template

Error:
{F640400959}

Fix:
Embed `libswiftFileProvider.tbd` in app.

Reviewed By: hramos

Differential Revision: D30192423

fbshipit-source-id: 59dbde441e61bc6ab870e2324e5202f4772bee8e

* introduce RCTPlatformColorUtils

Summary:
Changelog: [Internal]

in this diff, we add the logic to handle converting PlatformColor strings to their corresponding RGBA values, using `UIColor`'s API as the source of truth of these colors.

functionality not covered yet:
- customColor
- iOS Dynamic Colors
- Variant Colors

Reviewed By: sammy-SC

Differential Revision: D30103451

fbshipit-source-id: 7d7be0f08dc2fb95b606b8f5d73784766787a574

* hook up PlatformColorParser to RCTPlatformColorUtils

Summary:
Changelog: [Internal]

in this diff, we iterate through the list of color passed down in the props, and write the RGBA value of the first valid UIColor

Reviewed By: sammy-SC

Differential Revision: D30110297

fbshipit-source-id: c6730110129d0fe1f784fa89cd26b46d3dda7f28

* replace SharedColor alias with class for more reliable template deduction

Summary:
Changelog: [Internal]

when we try to write a `SharedColor` type prop in the renderer, the template function we match to is the following:

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/ReactCommon/react/renderer/core/propsConversions.h?commit=28dacb972cda702d37dedd4612bc67c212d4d9eb&lines=108-132

this is because `SharedColor` is an alias of `better::optional<Color>`. ultimately, this causes a crash in L130 - the template deduction in L130 interprets the T as an `int`, rather than `SharedColor`, but our `rawValue` is pointing to `SharedColor`.

there was a number of options i considered, but didn't feel the most correct:
- wrapping `SharedColor` in another `better::optional` - this felt like a hack and didn't really provide any real benefits of the `optional` wrapper.
- writing a template specialization on SharedColor - this didn't seem future proof because we could introduce another type that could potentially wrap an integer, which doesn't seem impossible in the future - then we would get some conflict with our `SharedColor` conversion, which is custom to the behavior of colors.
- coercing the template during the function call - from an engineering perspective, this didn't seem like a great idea since it isn't clear to the engineer that this would be necessary and they would most likely only find out to do this after seeing a crash on their builds.

i ultimately decided to convert `SharedColor` to a simple class wrapper, similar to the implementation already used in Android. this alleviates all of the concerns with the other options above.

Reviewed By: sammy-SC

Differential Revision: D30149880

fbshipit-source-id: 7e8abafcd9fd7465b13ef227d140e859f8df6ecd

* Deploy 0.157.0 to xplat

Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D30148513

fbshipit-source-id: 7eb17353c3620d6f99d547dd6a781ac0a13a9a72

* General Logging Util (stab) class for native errors (#31998)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31998

Overall Context: We want to add a way to log errors (e.g. mustfix, warn, etc on the server with stack trace) without crashing the app (e.g. react_native_assert crashes the app).

This diff: I am writing very simple logger functions which will get resolved at build time depending on the platforms/apps.

Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D30174404

fbshipit-source-id: 2e5bc865dd8576c5a758c56e080a1e582a8c3ada

* Documenting UserFlow.endFailure

Summary:
We had some confusion lately, where errorName was used to dump "error message". This caused problems in Scuba.
This doc should add some clarity on what is expected from endFailure users.

Changelog:
[Internal][Added] - Documentation for method in UserFlow.js class

Reviewed By: mityal

Differential Revision: D30192127

fbshipit-source-id: d057668aab714a9342131c83daf41cbe9372cb39

* iOS: When RCTSyncImageManager image times out, log warning instead of error

Reviewed By: fkgozali

Differential Revision: D30255710

fbshipit-source-id: e5238f718420718265823dd0fb93507d472d3cff

* Un-deprecate ReactSoftException

Summary:
After creating and using this utility, we learned that (1) it's really useful, and (2) its interface is good enough. So, let's un-deprecate this utility.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30251651

fbshipit-source-id: d1ecf81484f865587a5552d5ddf0e68da86397d9

* Rename ReactSoftException to ReactSoftExceptionLogger

Summary:
ReactSoftException makes it seem like the class is an Exception, when it's actually a logger. This rename I think is more appropriate.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30251735

fbshipit-source-id: 550bd543388e698774ec31753200bd3f722d8c17

* Updated TextInput autoCompleteType prop to autoComplete 2/2 (#26010)

Summary:
Fix for bug https://github.com/facebook/react-native/issues/26003 Rename TextInput prop "autoCompleteType" to "autoComplete".

## Changelog

[Android] [Breaking] - Updated `autoCompleteType` prop of `TextInput` to `autoComplete`

Pull Request resolved: https://github.com/facebook/react-native/pull/26010

Test Plan: Sandcastle

Reviewed By: mdvacca

Differential Revision: D29795575

Pulled By: lunaleaps

fbshipit-source-id: 6eba7030968e9b7384529a43a6cd1b3c9e8b2a2c

* Remove autoCompleteType as a native component prop

Summary: Changelog: [Android][Internal] - Cleanup `autoCompleteType` prop from Android native component.

Reviewed By: charlesbdudley

Differential Revision: D30057497

fbshipit-source-id: c80dd5682b314112ae70551bf8135372bb1ddc8b

* Match native*.js and Native*.js srcs

Summary:
Globbing is case sensitive only when eden is enabled. This causes Android cold builds to regress by 2 minutes because a large number of react native targets have to be built and fetched.

This change causes srcs to match with and without eden.

Changelog: [Internal]

Reviewed By: cute-jumper

Differential Revision: D30266076

fbshipit-source-id: 39ac2cbfa146fcdda1d8d3a6f40b0ec41bfb3c2f

* Fix TextInput Cursor jumping to the right when the placeholder null (#28995)

Summary:
This issue fixes https://github.com/facebook/react-native/issues/28794 fixes https://github.com/facebook/react-native/issues/27658
Flow type ?Stringish allows to set the placeholder value to null. The null value causes the cursor to jump to the right in a TextInput. The fix replaces the placeholder null value with an empty string which avoid calling setHint(null) as causes the placeholder to jump to the right.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - avoid calling setHint with a null parameter causing cursor to jump to the right

Pull Request resolved: https://github.com/facebook/react-native/pull/28995

Test Plan:
**<details><summary>CLICK TO OPEN TESTS RESULTS (28 May 2020 20a9473aaa330ad9b6e7a0b42ebd9c4ed41ce60b)</summary>**
<p>

More videos and information included in issue https://github.com/facebook/react-native/issues/28794
The below test cases are from the [following repository](https://github.com/fabriziobertoglio1987/AwesomeProject)

| **BEFORE** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/83123470-3e2f8000-a0d5-11ea-8718-11e6a0575a0c.gif" />|

| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/83123554-599a8b00-a0d5-11ea-9701-6557f0d76044.gif" />|

Extensive testing on `RNTester` did not identify any regression.

| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/83123586-628b5c80-a0d5-11ea-92eb-449d499dcc7d.gif" />|

</p>
</details>

**<details><summary>CLICK TO OPEN TESTS RESULTS (15 February 2021 20a9473aaa)</summary>**
<p>

| **BEFORE** |
|:-------------------------:|
| <video src="https://user-images.githubusercontent.com/24992535/107960803-5d44a980-6fa5-11eb-90e2-f0d665e35291.mp4" />|

| **AFTER** |
|:-------------------------:|
| <video src="https://user-images.githubusercontent.com/24992535/107960602-1f478580-6fa5-11eb-8f39-b985fafa6a6c.mp4" />|

</p>
</details>

Reviewed By: charlesbdudley

Differential Revision: D30095877

Pulled By: lunaleaps

fbshipit-source-id: 38a3e788443a22d48a4335063cd4315638bd8e97

* Bump AGP to 4.2.2

Summary:
This is just a minor bump in the Android Gradle plugin.

Changelog:
[Android][Changed] - Bumped AGP to 4.2.2

allow-large-files

Reviewed By: ShikaSD

Differential Revision: D30220591

fbshipit-source-id: 217a21e4935bcd258ac3bcd45c7fb1ff5c0a1ead

* Flatten the `react-native-codegen` included build. (#32007)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32007

This Diff simplifies the codegen Gradle build.
Previously the build used to have a 2-level nesting of included build.

Turns out that the `react-native-codegen/android/build.gradle` build
is just providing a task and including an inner build that contains the codegen
Gradle plugin. I've moved such plugin to the outer build.

This will also make sure that the Gradle plugin files are properly index by the
IDE when opening the build (as nested included build are not yet supported).

Changelog:
Internal - Flatten the `react-native-codegen` Gradle included build

Reviewed By: fkgozali, ShikaSD

Differential Revision: D30227784

fbshipit-source-id: af304afeeba1926f8b7b5b47cf69889d3f808f5f

* iOS: Log image url in test environment when image times out

Reviewed By: fkgozali

Differential Revision: D30280757

fbshipit-source-id: 57385d3fd64f564f1de9ad86ffb2c0064e941df9

* Fix BorderExample for DynamicColorIOS

Summary:
Changelog:
[Internal] - Fix border example for RNTester

Reviewed By: charlesbdudley

Differential Revision: D30262957

fbshipit-source-id: 677e7a9346bc2f1dc67ec7cc9ad7e36af34ffa60

* Add a flag to warn whenever the legacy NativeModule system is used

Summary:
When true, this flag will cause React Native to start logging soft exceptions, whenever the legacy NativeModule system is used. This flag is independent of useTurboModules. In practice, it's only enabled when TurboModules is enabled.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30250363

fbshipit-source-id: f610567c5b99a4fbf8252c3962908668f483d028

* Log SoftExceptions when the legacy NativeModule system is used

Summary:
When ReactFeatureFlags.warnOnLegacyNativeModuleSystemUse is true, we will log a SoftException, whenever:
1. A Java/Cxx NativeModule is created by the legacy system.
2. Any method on the Java NativeModule is executed, including getConstants().

NOTE: Logs to CXXModule use incoming.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30252953

fbshipit-source-id: 570929624d0114bb298c593ba909e5cdbd54bd6c

* Introduce JReactSoftExceptionLogger to log SoftExceptions from C++

Summary:
When the TurboModule system is enabled, C++ NativeModules shouldn't be used in production. We'll use this JReactSoftExceptionLogger to log soft exceptions from C++ NativeModules this scenario.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D30272694

fbshipit-source-id: 8dadcfe51bcbc353d438d1a403e74da5e2cb9546

* Warn whenever CxxNativeModules are used

Summary:
After this diff, when ReactFeatureFlags.warnOnLegacyNativeModuleSystemUse is enabled, the legacy NativeModule infra will log soft exceptions whenever legacy NativeModules are accessed/used.

Changelog: [Internal]

Reviewed By: p-sun

Differential Revision: D30272695

fbshipit-source-id: 7111402c1d8b883a600dcb4559e9ff1d56447070

* Fix typo in RCTConvert.m (#31067)

Summary:
seperated -> separated

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Fixed] - Fixed typo in comment

Pull Request resolved: https://github.com/facebook/react-native/pull/31067

Test Plan: NONE

Reviewed By: sammy-SC

Differential Revision: D30176244

Pulled By: sota000

fbshipit-source-id: 617607aaa7eb5f613344773c4bbbc09a8c5096c1

* Allow Modal to handle hardware escape key in the same way the back button is handled (#31564)

Summary:
On Android, when a hardware keyboard is connected pressing the escape key will partially dismiss an active `<Modal>` without calling the `onRequestClose` callback. The modal will disappear, but I beleive the underlying activity may still be present, blocking interaction with the main app below and leaving things in a partially broken state.

This code change allows the escape key to be handled in the same way as the hardware back button, calling the `onRequestClose` and allowing the developer to decide the behaviour.

This issue isn't present on iOS, so no change is required there.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Fix Modal being dismissed incorrectly when pressing escape on a hardware keyboard

Pull Request resolved: https://github.com/facebook/react-native/pull/31564

Test Plan: I've tested this manually locally, but unsure if it's possible to test in an automated way as the emulator didn't respond to a hardware escape key in the same way as a physical device.

Reviewed By: ShikaSD

Differential Revision: D28953718

Pulled By: lunaleaps

fbshipit-source-id: 5547bc5d894da0d3d9daf4515b1af9c2407815db

* Nullable ReconnectingWebSocket params

Summary: Changelog: [Internal] - Annotated the MessageCallback and ConnectionCallback params of the ReconnectingWebSocket with Nullable

Reviewed By: makovkastar

Differential Revision: D30298832

fbshipit-source-id: 4e0a6ea339d1d8b25fb7bb24dfbada93d5cebc96

* Clean up unbatched only experiment

Summary:
changelog: [internal]

The experiment isn't shipping.

Reviewed By: JoshuaGross

Differential Revision: D30303379

fbshipit-source-id: 80b89d3738c1640f6abefcad161f95397c88ee04

* Clean up AsyncEventBeatV2 experiment

Summary:
changelog: [internal]

This experiment is abandoned. It regressed engagement metrics.

Reviewed By: JoshuaGross

Differential Revision: D30303383

fbshipit-source-id: 1d86eb5c7c257d4b369632007d0bda23e80c88ab

* Back out "Fix Undefined symbol: __swift_FORCE_LOAD_$_swiftFileProvider when building with Xcode 13"

Summary:
Changelog: Backout "Fix Xcode 13 build error in HelloWorld template"

Original commit changeset: 59dbde441e61

This change breaks the template for Xcode 12.5:

{F642871165}

Reviewed By: philIip

Differential Revision: D30301800

fbshipit-source-id: 4fcd9a5413dafb2cedb2194d5b68ddfd46edd974

* Include Swift lib in LIBRARY_SEARCH_PATHS

Summary:
changelog: Fix Xcode 13 build error in HelloWorld template

Including `usr/lib/swift` fixes error:
{F642876047}

Reviewed By: p-sun

Differential Revision: D30301799

fbshipit-source-id: b93eb51ec5dd929ddc46574fc11bc89934eadeaf

* fix#29319 - ios dismiss modal (#31500)

Summary:
This PR aims to resolve iOS can't dismiss Modal on swipe gesture.
https://github.com/facebook/react-native/issues/29319

When modal presentationStyle is pageSheet, iOS allows to dismiss the modal using swipe gesture. This PR adds support for that feature
## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Added] - Support for onRequestClose for iOS Modal component.

Pull Request resolved: https://github.com/facebook/react-native/pull/31500

Test Plan:
- If onRequestClose updates the visibility state, modal will be closed.

```
<Modal
    visible={visible}
    animationType="slide"
    presentationStyle="pageSheet"
    onRequestClose={dismiss}>
</Modal>
```

https://user-images.githubusercontent.com/23293248/117590263-36cd7f00-b14c-11eb-940c-86e700c0b8e7.mov

## Notes
- In this PR, only support for partial drag is added. i.e. user can't drag the modal up and down completely. I added full user dragging but reverted in this [commit](bb65b9a60d) to support controllable onRequestClose. If someone has any suggestion to have full draggable support + controllable onRequestClose, please let me know.

<!--

 the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. -->

Reviewed By: p-sun

Differential Revision: D30041625

Pulled By: sammy-SC

fbshipit-source-id: 9675da760bd5c070c4f0e1d30271c8af5c50b998

* Fix selectionColor doesn't style Android TextInput selection handles (#31007)

Summary:
This issue fixes https://github.com/facebook/react-native/issues/30283 selectionColor does not change the handles color.

The method setCursorColor changes the cursor color of field `mCursorDrawable` using a reflection for Android Devices lower then API 28. This fix adds a reflection to change color of the left, center and right handles of a selection (mTextSelectHandleLeftRes, mTextSelectHandleRes and mTextSelectHandleRightRes).

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Fix selectionColor doesn't style Android TextInput selection handles

Pull Request resolved: https://github.com/facebook/react-native/pull/31007

Test Plan:
This changes fix the Java API for which I can not write Java tests as explained in commit 709a441ecf
The java TextInputTest was excluded from the test suite in commit 709a441ecf as they need the Yoga libraries to run

**<details><summary>CLICK TO OPEN TESTS RESULTS - API 22</summary>**
<p>

left/right handles do not change color with the cursor

| **BEFORE** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/108241887-98351180-714c-11eb-9c7b-7c693ea0bb06.png" width="250" height="" /> |

center Handle color does not change color

| **BEFORE** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/108241904-9ec38900-714c-11eb-9fc3-dbd26f83b979.png" width="250" height="" /> |

The left and right handle change color with the cursor color

| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/108241796-805d8d80-714c-11eb-9d90-6871ddaea86f.png" width="250" height="" /> |

The center handle color is correctly updated

| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/108241571-45f3f080-714c-11eb-8475-86e6dea64d73.png" width="250" height="" /> |

`setCursorColor` changes correctly the cursor color

| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/108241484-2d83d600-714c-11eb-8a0c-80a847f28537.png" width="250" height="" /> |

Default Colors do not have issues

| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/108241346-04634580-714c-11eb-933e-0dce504498a8.png" width="250" height="" /> |

| **AFTER** |
|:-------------------------:|
| <img src="https://user-images.githubusercontent.com/24992535/108241347-04fbdc00-714c-11eb-902a-fc057cf94986.png" width="250" height="" /> |

</p>
</details>

Reviewed By: ShikaSD

Differential Revision: D28682935

Pulled By: sota000

fbshipit-source-id: ff037c93f36bbf20c915373b995bbfd8e8ca92d0

* Fixing CI error "Entry file RNTester/js/RNTesterApp.ios.js does not exist" (#29263)

Summary:
PRs are failing with the error "Entry file RNTester/js/RNTesterApp.ios.js does not exist", despite it existing. The if statement around the checker will always trigger because when it looks to see if RNTester/js/RNTesterApp.ios.js exists it's inside of RNTester instead of root. I've added a "../" to solve this.

## Changelog

[Internal] [Fixed] - Fixing CI error "Entry file RNTester/js/RNTesterApp.ios.js does not exist"

Pull Request resolved: https://github.com/facebook/react-native/pull/29263

Test Plan:
![Screen Shot 2020-07-01 at 11 25 03](https://user-images.githubusercontent.com/65255457/86278790-cc43ce00-bb8d-11ea-8098-9f4a751667ae.png)
![Screen Shot 2020-07-01 at 11 26 52](https://user-images.githubusercontent.com/65255457/86278796-ccdc6480-bb8d-11ea-9d73-63801f77e840.png)

Reviewed By: sammy-SC

Differential Revision: D30176138

Pulled By: sota000

fbshipit-source-id: 41510b31d3f1a34de7b0b5218ab670ac99409622

* Fix dashed/dotted border drawing when border-radius is 0 (#28359)

Summary:
This PR fixes the border-style that is not respected when drawing a border with 0 border-radius on Android. This would cause the faster `drawRectangularBackgroundWithBorders` path to be used, but that uses rectangular drawing and doesn't support dashed/dotted stroke patterns.
This PR changes the behavior to use the generic `drawRoundedBackgroundWithBorders` code-path which does support dashed/dotted border-styles.

## Changelog

`[Android] [Fixed] - Fix dashed/dotted border-drawing when border-radius is 0`

Pull Request resolved: https://github.com/facebook/react-native/pull/28359

Test Plan:
**Faulty situation:**

![Screenshot_1584721992](https://user-images.githubusercontent.com/6184593/77184987-e838cd80-6ad0-11ea-9585-058eafbd361a.png)

**After the fix:**

![Screenshot_1584721410](https://user-images.githubusercontent.com/6184593/77184801-9d1eba80-6ad0-11ea-92a7-7212f40ace73.png)

Reviewed By: lunaleaps

Differential Revision: D20590739

Pulled By: charlesbdudley

fbshipit-source-id: 18657ea21e54f763e22c623bf979b3500c1bdcbd

* Add a way to bind log function to the unified react native logger.

Summary:
In this diff:
1. Convert the ReactNativeLogger to c function for the future compatibility.
2. Bind the log function from Catalyst app
3. Update the call site

Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D30271863

fbshipit-source-id: 4c0ea704cf19f53468a3b72631353959ea999884

* React Native sync for revisions 19092ac...5634ed1

Summary:
This sync includes the following changes:
- **[424fe5870](https://github.com/facebook/react/commit/424fe5870 )**: Revert "Show a soft error when a text string or number is supplied as a child to non text wrappers ([#21953](https://github.com/facebook/react/pull/21953))" ([#22108](https://github.com/facebook/react/pull/22108)) //<Sota>//
- **[aebf3b456](https://github.com/facebook/react/commit/aebf3b456 )**: [Scheduler] Check for continuous input events ([#22107](https://github.com/facebook/react/pull/22107)) //<Andrew Clark>//
- **[e9b2028b3](https://github.com/facebook/react/commit/e9b2028b3 )**: Show a soft error when a text string or number is supplied as a child to non text wrappers ([#21953](https://github.com/facebook/react/pull/21953)) //<Sota>//
- **[ecd73e17b](https://github.com/facebook/react/commit/ecd73e17b )**: Enable enableSuspenseLayoutEffectSemantics flag statically for Facebook ([#22050](https://github.com/facebook/react/pull/22050)) //<Brian Vaughn>//
- **[a8725a3e6](https://github.com/facebook/react/commit/a8725a3e6 )**: Scheduling profiler: Added lane labels and durations to React measures ([#22029](https://github.com/facebook/react/pull/22029)) //<Brian Vaughn>//

Changelog:
[General][Changed] - React Native sync for revisions 19092ac...5634ed1

jest_e2e[run_all_tests]

Reviewed By: kacieb

Differential Revision: D30225923

fbshipit-source-id: 562895d3e0d264f40770dadb89d4a16241967c4c

* Exclude nativeImageSource.js instead of matching [Nn]

Summary:
The change to this glob by D30266076 (f1b4748a7c) lines up suspiciously to a non-reproducible failure in the sources to the rules that use this glob. Changing to see if it mitigates the issue.

See https://fb.workplace.com/groups/askbuck/posts/6473961645985729/?comment_id=6476777799037447&reply_comment_id=6477737555608138

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D30361375

fbshipit-source-id: af7b7fe553364fc1d7012bea8d00bf02ee2804fa

* Revert D20590739

Summary:
This diff is reverting D20590739 (3e5998e651)
D20590739 (3e5998e651) is making the following tests to fail and this revert diff is either the revert of the blame diff or the revert of the stack of diffs that need to be reverted to revert the blame diff
Tests affected:
- https://www.internalfb.com/intern/test/281475012591721/
Multisect link:
https://www.internalfb.com/intern/testinfra/multisect/476214

## Changelog

`[Android] [Fixed] - Revert: Fix dashed/dotted border-drawing when border-radius is 0`

Reviewed By: charlesbdudley

Differential Revision: D30361262

fbshipit-source-id: 21dd507deb5817dda1063a267a38749c77e7ae1a

* Fix irregular indent in template (#29871)

Summary:
Fix irregular indent in template/android/app/build.gradle

![image](https://user-images.githubusercontent.com/26166657/92319046-46417900-f04f-11ea-9051-cb4d7bcc3049.png)

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Fixed] - Fix irregular indent in template

Pull Request resolved: https://github.com/facebook/react-native/pull/29871

Test Plan: N/A

Reviewed By: passy, cortinico

Differential Revision: D30360839

Pulled By: sota000

fbshipit-source-id: 7a92890007716c6e244ceffaa697cdd5ad1a0504

* JS: Fix "Modal | Basic" Test's Layout

Summary:
Fix the CSS on the main Modal test

Move the warning message for the "Transparent" switch to below the switch, since warnings messages are usually under the field they're warning.

Move Presentation Style to be before Transparent, since Transparent is a modifier of "overFullScreen" Presentation Style.

Reviewed By: lunaleaps

Differential Revision: D30323087

fbshipit-source-id: b13d6c958145096da95c9888181ff457b093fb49

* replace testing-support-lib with androidx buck targets in RN

Summary: Changelog: [Internal] - codemod testing library Buck redirect to actual dependency

Reviewed By: jiawei-lyu

Differential Revision: D30379180

fbshipit-source-id: eb9a22569230d07732bd0aa63dddfcfff7c3800f

* `Android/ColorProps`: ColorProps with value null should be defaultColor instead of transparent (#29830)

Summary:
This pr:
- Fixes: https://github.com/facebook/react-native/issues/30183
- Fixes: https://github.com/facebook/react-native/issues/30056
- Fixes: https://github.com/facebook/react-native/issues/29950
- Fixes: https://github.com/facebook/react-native/issues/29717
- Fixes: https://github.com/facebook/react-native/issues/29495
- Fixes: https://github.com/facebook/react-native/issues/29412
- Fixes: https://github.com/facebook/react-native/issues/29378

Because most of ReactProps(name = ViewProps.COLOR) accept @ Nullable Integer.
For example:
abb6433f50/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java (L472-L479)

After update to react-native 0.63.2 to make PlatformColor work, there is a new ColorPropSetter.
abb6433f50/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagersPropertyCache.java (L194-L215)

But ColorPropSetter won't return an nullable value with getValueOrDefault, it will always return it's defaultValue which is 0.
And 0 is equal to TRANSPARENT, will cause <Text /> disappear.
## Changelog

[Android] [Fixed] - ColorProps with value null should be defaultColor instead of transparent

Pull Request resolved: https://github.com/facebook/react-native/pull/29830

Test Plan:
Please initiated a new project and replaced the app with the following code:
```
import * as React from 'react';
import {Text, View, TouchableOpacity, PlatformColor} from 'react-native';

export default function App() {
  const [active, setActive] = React.useState(false);

  return (
    <View>
      <Text style={active ? {color: 'green'} : null}>Example</Text>
      <Text
        style={
          active ? {color: PlatformColor('android:color/holo_purple')} : null
        }>
        Example2
      </Text>
      <TouchableOpacity onPress={() => setActive(!active)}>
        <Text>Toggle Active</Text>
      </TouchableOpacity>
    </View>
  );
}
```

Thanks you so much for your code review!

Reviewed By: JoshuaGross

Differential Revision: D30209262

Pulled By: lunaleaps

fbshipit-source-id: bc223f84a92f742266cb7b40eb26722551940d76

* Fix Dimensions not updating on Android (#31973)

Summary:
When retrieving the device dimensions through the JS `Dimensions` utility, the result of `Dimensions.get` can be incorrect on Android.

### Related issues

- https://github.com/facebook/react-native/issues/29105
- https://github.com/facebook/react-native/issues/29451
- https://github.com/facebook/react-native/issues/29323

The issue is caused by the Android `DeviceInfoModule` that provides initial screen dimensions and then subsequently updates those by emitting `didUpdateDimensions` events. The assumption in that implementation is that the initial display metrics will not have changed prior to the first check for updated metrics. However that is not the case as the device may be rotated (as shown in the attached video).

The solution in this PR is to keep track of the initial dimensions for comparison at the first check for updated metrics.

## Changelog

[Android] [Fixed] - Fix Dimensions not updating

Pull Request resolved: https://github.com/facebook/react-native/pull/31973

Test Plan:
### Steps to reproduce
1. Install the RNTester app on Android from the `main` branch.
2. Set the device auto-rotation to ON
3. Start the RNTester app
4. While the app is loading, rotate the device
5. Navigate to the `Dimensions` screen
6. Either
 a. Observe the screen width and height are reversed, or
 b. Quit the app and return to step 3.

### Verifying the fix

#### Manually
Using the above steps, the issue should no longer be reproducible.

#### Automatically
See unit tests in `ReactAndroid/src/test/java/com/facebook/react/modules/deviceinfo/DeviceInfoModuleTest.java`

### Video

https://user-images.githubusercontent.com/4940864/128485453-2ae04724-4ac5-4267-a59a-140cc3af626b.mp4

Reviewed By: JoshuaGross

Differential Revision: D30319919

Pulled By: lunaleaps

fbshipit-source-id: 52a2faeafc522b1c2a196ca40357027eafa1a84b

* refactor: remove DefaultProps from the StatusBar Component (#31631)

Summary:
Issue https://github.com/facebook/react-native/issues/31607. defaultProps makes it difficult to migrate components to functional.

## Changelog

[General] [Changed] -  Remove defaultProps from the StatusBar Component.

Pull Request resolved: https://github.com/facebook/react-native/pull/31631

Test Plan:
Verified the behaviour of the existing functionality after the removal on the RN Tester app.

https://user-images.githubusercontent.com/11355609/120085709-a2b35f80-c0da-11eb-94f2-2649270155ef.mov

Reviewed By: sota000

Differential Revision: D30259324

Pulled By: lunaleaps

fbshipit-source-id: 0c8841691198761589fdd029cab36629f7dfa757

* fix AGP 7 compatibility (#32030)

Summary:
Android Gradle Plugin 7 removed dependency configurations, and it includes compile. Below is a snipped from release notes https://developer.android.com/studio/releases/gradle-plugin

I can confirm that RN 0.65.0 app is running as expected on Android with the patch.

> **compile**
Depending on use case, this has been replaced by api or implementation.
Also applies to *Compile variants, for example: debugCompile.

## Changelog

[Android] [Changed] - Android Gradle Plugin 7 compatibility

Pull Request resolved: https://github.com/facebook/react-native/pull/32030

Test Plan: Create a project with RN 0.65.0 and upgrade Android Gradle Plugin to 7.0.0, and Gradle to 7.0.2. It'll fail to sync. Then apply the change, and it'll sync as normal, and build the app.

Reviewed By: passy, ShikaSD

Differential Revision: D30394238

Pulled By: cortinico

fbshipit-source-id: cabc25754b9cd176a7d6c119d009728f2e5a93d9

* Clean up Fabric startSurface API used in Venice

Summary:
Update FabricUIManager methods for `SurfaceHandler` to start usual rendering or prerendering based on presence of the view instead of using two methods with same logic.

Changelog: [Internal]

Reviewed By: sshic

Differential Revision: D30346502

fbshipit-source-id: 297f2b4a16dc7af7c36379252bd73e6dc953ff59

* Expose "unreserved" trait constants that can be mapped per-component

Summary:
Fabric core uses a lot of traits - I am reserving a few more for core usage, and also exposing a few "unreserved" traits.

It is recommended that all custom components that do use traits rely on these constants instead of hard-coding any trait values. That way, in the unlikely event that these values change in the future, it will not break components.

Changelog: [Internal]

Reviewed By: cortinico, RSNara

Differential Revision: D30401743

fbshipit-source-id: fb2e8f5cf33c94e31a0c25a89055acfc4eccf066

* Call super.onActivityResult in ReactActivity

Summary:
This change allows native activities and fragments to also handle onActivityResult callbacks, in addition to sending the result to React Native.

Changelog:
[Android][Changed] - Call super.onActivityResult in ReactActivity's onActivityResult()

Reviewed By: JoshuaGross

Differential Revision: D30232449

fbshipit-source-id: cb080d6f2eff57dcf839660ee715cb4068ffcdd5

* Move react_native_log out of utils (#32042)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32042

This diff moves react_native_log out of utils to make it easier/possible to import from modules.
Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D30411247

fbshipit-source-id: 5482761b259600df051a88c6eff1834c882e7230

* fix: Resolve NODE_BINARY *after* finding the path to node (#32029)

Summary:
We want to resolve `NODE_BINARY` **after** `find-node.sh` runs and sets up any node version manager that we need to setup, otherwise `NODE_BINARY` is always undefined.

## Changelog

[Internal] [Fixed] - Resolve NODE_BINARY after finding the right path to node

Pull Request resolved: https://github.com/facebook/react-native/pull/32029

Reviewed By: TheSavior

Differential Revision: D30401213

Pulled By: yungsters

fbshipit-source-id: 386ffeff15b5f371a452488ed078d3adebe0f211

* Ship "Disable 'virtual view' preallocation" experiment in code

Summary:
The impact of this has proven impressive, and safe. Ship in code and remove feature-flag.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D30269561

fbshipit-source-id: 9bb72567cfd881928d14d9bee43cf32b390664fb

* Emit soft error for warning

Summary:
This diff adds a default behavior for the unified logger on Android.

Added the call site in the CXXNativeModule.

Changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D30377767

fbshipit-source-id: 000014828f2f245dc9492e3617218895d9a33536

* Enable ktfmt

Summary: Changelog: [internal]

Reviewed By: zertosh

Differential Revision: D30423755

fbshipit-source-id: 8ae27b3666214f5144ef8b5ef7fe868afc19b4b9

* Pass configFile: false to Babel parser

Summary:
Changelog: [Internal]

Disables implicit `babel.config.js` lookup in a `parse()` call that does not need any user-specified config.

Reviewed By: javache

Differential Revision: D30396331

fbshipit-source-id: 9b07c361eae53cdffc6a76ba30f1146a7af65a10

* Passing the scheme field throughout all the metro connection pipeline to allow different scheme other than the default hardcoded http

Reviewed By: lunaleaps

Differential Revision: D30218490

fbshipit-source-id: 3832c731156a4f88ad1c55be0a0e4f68fa3e1d48

* Adding activity check to enable Dev mode

Summary:
It is assumed that there will always be an activity associated on enabling the dev support which is not the case. Hence adding that null check.

Changelog:
[Android][Fixed] - Added null check for activity in onHostResume()

Reviewed By: javache

Differential Revision: D30411311

fbshipit-source-id: 8936be2df7f16c355693163347d5e1d94c5ce2e1

* Deploy 0.158.0 to xplat

Summary: Changelog: [Internal]

Reviewed By: dsainati1

Differential Revision: D30426571

fbshipit-source-id: 70689323d066e3b25bf720f454d2146d195df8b3

* - Fix broken Circle CI due to missing BUCK rule for androidx:tests (#32052)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/32052

Changelog: Update the OSS React Native dependencies to match the internal dependency structure.

Reviewed By: cortinico

Differential Revision: D30397818

fbshipit-source-id: a70e26d764729f6ead9eb6a4d689e32d25243571

* Remove BUILD FILE SYNTAX from build files

Summary: Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D30410441

fbshipit-source-id: 62deebb502121f23270bfa18286b155ad161af2d

* Apply new buildifier fixes

Summary: Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D30407205

fbshipit-source-id: 022a02829d59a900764b228afb9856ed1ba2cf8c

* Remove redundant includes

Summary:
changelog: internal

Removing unused headers. Fewer headers = faster compilation

Reviewed By: p-sun

Differential Revision: D30398600

fbshipit-source-id: a64801e49d283ad1e2d0cb9c9d688445e30bf0ed

* Provide logger to YGConfig

Summary:
Changelog: [internal]

Logger needs to be supplied to YGConfig, otherwise the app crashes when Yoga tries to log.

Reviewed By: fkgozali

Differential Revision: D30394676

fbshipit-source-id: bda464a4e43cb815c00650e1fedf43fe0a06f973

* Set initial maximum surface size to viewport size

Summary:
Changelog: [internal]

There is a possibility of race between JavaScript sending "completeRoot" and maximum size set on surface. To prevent this race, we set the initial maximum size to be equal to the viewport size.

Alternative solution is to set maximumSize to {0, 0} initially instead of infinity. This is what old architecture does, even though not explicitly.

Reviewed By: fkgozali

Differential Revision: D30402207

fbshipit-source-id: 44427404eaf060a81de257797823edf971ffc1bb

* iOS: Don't display LogBox in Dev if Bridge was invalided

Summary: Bridge can get invalidated during tear down. If a JS error is thrown then, don't display a LogBox so we don't hit the invalid bridge assert in RCTSurface.

Reviewed By: fkgozali

Differential Revision: D30464848

fbshipit-source-id: 87a8daa95fd06342d194a4805ecfa97279820f2e

* Update ImageBackground.js (#32055)

Summary:
Currently ImageBackGround component has optional style props, but if you don't pass it as prop, it still "thinks" you pass style and crushes.
In this pr, I made width and height inside component to be optional so it won't crush.

## Changelog

[General] [Fix] - Changed ImageBackground's style so it won't crush.

[Screen Shot 2021-08-20 at 15 05 45](https://user-images.githubusercontent.com/62840630/130230568-be02b1a2-52ec-4f9d-b3d3-212552d3882b.png)

As you can see in this component, I tried to use ImageBackground without any style props, and my app crushes. Then I added style with empty object and the app didn't crush anymore, as you can see here:
![Screen Shot 2021-08-20 at 15 09 23](https://user-images.githubusercontent.com/62840630/130230932-a576c397-a910-4e40-a202-56482d83dd9c.png).

In conclusion, if we make width and height styles optionals inside ImageBackground component, it won't crush anymore.

Thoughts:
Maybe consider to make style props for this component none-optional because it isn't make any sense that image won't have any style at all.

Thanks ahead, that was my first pr, Eden Binyamin.

Pull Request resolved: https://github.com/facebook/react-native/pull/32055

Reviewed By: charlesbdudley

Differential Revision: D30452297

Pulled By: sshic

fbshipit-source-id: b7071aa457dba443ed2f627c2458ea84fd24b36d

* Fix typo and grammar (#31916)

Summary:
> Always leave the campground cleaner than you found it.

Fixing:
* typo in _dismissed_
* make the subject agree with the verb

## Changelog

[Internal] [Fixed] - A typo in a comment

Pull Request resolved: https://github.com/facebook/react-native/pull/31916

Test Plan: Grammarly says it's better now.

Reviewed By: lunaleaps

Differential Revision: D29967403

Pulled By: yungsters

fbshipit-source-id: 6cb33328e99e3fceba5f19f4baaa9446340fbbcc

* Added Selection prop to TextInputProps

Summary:
Changelog: [iOS][Added]
1. Added new primitive type "Selection" to C++
2. Added property "selection" to TextInputProps
3. Added parser for that

Reviewed By: sammy-SC

Differential Revision: D30043256

fbshipit-source-id: eefa67ca23759761901cba1d2ab3052877a153a7

* Selection prop is applied for TextInput when component is mounting

Summary:
Changelog: [Internal]
TextInput's predefined "selection" prop is now applied when view did move to window, and when attributed string is set.

Reviewed By: sammy-SC

Differential Revision: D30045271

fbshipit-source-id: e5495171b07a25e1e822421ff1627a8686cd0904

* use correct gradle packageTask and asserts dir for android libraries (#32026)

Summary:
Fixes https://github.com/facebook/react-native/issues/29577 and https://github.com/react-native-community/upgrade-support/issues/93, when building an android library the package task has a different name, which was not handled correctly in the react.gradle file. The fix uses the existing `packageTask` variable which is correctly set for applications and libraries. This PR also copies the bundled js file into the correct assets directory, which is different from the assets directory of applications.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Fixed] - Fixed Android library builds with react.gradle file

Pull Request resolved: https://github.com/facebook/react-native/pull/32026

Test Plan: Tested with my android library build which includes the `react.gradle` file and the build succeeded.

Reviewed By: sshic, ShikaSD

Differential Revision: D30368771

Pulled By: cortinico

fbshipit-source-id: 8f0df8c4d0fa38d85f7c0b9af56d88799571191d

* Codegen: Add codegen.js wrapper around generate-specs.sh

Summary:
Adds a simple wrapper around the generate-specs.sh bash script.
Supports optional flags.

Usage:
`node ./codegen.js --srcs ./js --modules_library_name FBReactNativeSpec`

Remove unused `USE_FABRIC` envvar code from `generate-specs.sh`.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D30439132

fbshipit-source-id: 07099c1d899606ac2e679fac6d32ea2fa4af40fc

* Add Flow libdefs for HermesInternalType

Summary:
Changelog: [Internal]

This diff add a flow libdefs for the `HermesInternalType` to type
`HermesInternal` as the first accurately typed `global` property,
and filled all the type holes.

Reviewed By: yungsters

Differential Revision: D29986749

fbshipit-source-id: a94be7919f989b5085f6b264e55145a85020fea9

* Add support for the UIAccessibilityTraitsTabBar

Summary:
Changelog:
Add the capability to set tabbar accessibilityRole which maps to the iOS's UIAccessibilityTraitsTabBar

Reviewed By: yungsters

Differential Revision: D30490752

fbshipit-source-id: f7561a8932306e133d2f65a5ab40ba0be3899ec3

* Add support for AccessibilityValue

Summary:
Changelog:
[Fabric][iOS] Add support for AccessibilityState

Specification: https://reactnative.dev/docs/accessibility#accessibilityvalue

Reviewed By: sammy-SC

Differential Revision: D30452786

fbshipit-source-id: 0d459d3a7b9c037bd1877e5c7ead40bbb42830c3

* fix typos in comments (#32061)

Summary:
Fixed some typos in the code comments.

## Changelog

[Internal] [Fixed] - Fixed typo in the comments

Pull Request resolved: https://github.com/facebook/react-native/pull/32061

Test Plan: N/A

Reviewed By: javache

Differential Revision: D30482511

Pulled By: cortinico

fbshipit-source-id: ff67bc00d57972df88e41ee7a933259673de3aa2

* Add window to jest setup (#28067)

Summary:
`window` exists in the React Native runtime, but not inside the test environment. Many libraries use `typeof window === 'undefined'` to check if code is running in SSR. Because of the difference in the real environment and test environment, tests can behave different than the real app, which is an unwanted behavior.

## Background

I'm using https://github.com/tannerlinsley/react-query in my React Native Project, which works really well. When writing tests, they wouldn't work: jest started and then seemingly did nothing. While debugging I noticed the render was stuck in an infinite loop. Then I noticed the following line inside `react-query`:

```js
const isServer = typeof window === 'undefined'
```

I didn't know that the React Native runtime has a global `window`, and thought it's a bug inside react-query. But it does have a `window`, which is not defined inside the test environment.

The infinite loop was caused by react-query thinking it is running on the server, which doesn't fetch any data. If the react-query hook mounts, it re-executes because then it should be mounted inside the client. But `isServer` was still `true`. This repeats forever.

## Changelog

[General] [Fixed] - Fix `window` not existing in jest setup

Pull Request resolved: https://github.com/facebook/react-native/pull/28067

Test Plan: Are there tests to check if the test environment is setup correctly? �

Reviewed By: yungsters

Differential Revision: D30317021

Pulled By: charlesbdudley

fbshipit-source-id: 837ed952833ef8e70c5132c9b4152b0e0f28b4dd

* React Native sync for revisions 424fe58...bd5bf55

Summary:
Post: https://fb.workplace.com/groups/rnsyncsquad/permalink/879923262900946/

This sync includes the following changes:
- **[fc3b6a411](https://github.com/facebook/react/commit/fc3b6a411 )**: Fix a few typos ([#22154](https://github.com/facebook/react/pull/22154)) //<Bowen>//
- **[986d0e61d](https://github.com/facebook/react/commit/986d0e61d )**: [Scheduler] Add tests for isInputPending ([#22140](https://github.com/facebook/react/pull/22140)) //<Andrew Clark>//
- **[d54be90be](https://github.com/facebook/react/commit/d54be90be )**: Set up test infra for dynamic Scheduler flags ([#22139](https://github.com/facebook/react/pull/22139)) //<Andrew Clark>//
- **[7ed0706d7](https://github.com/facebook/react/commit/7ed0706d7 )**: Remove the warning for setState on unmounted components ([#22114](https://github.com/facebook/react/pull/22114)) //<Dan Abramov>//
- **[9eb2aaaf8](https://github.com/facebook/react/commit/9eb2aaaf8 )**: Fixed ReactSharedInternals export in UMD bundle ([#22117](https://github.com/facebook/react/pull/22117)) //<Brian Vaughn>//
- **[bd255700d](https://github.com/facebook/react/commit/bd255700d )**: Show a soft error when a text string or number is supplied as a child to non text wrappers ([#22109](https://github.com/facebook/react/pull/22109)) //<Sota>//

Changelog:
[General][Changed] - React Native sync for revisions 424fe58...bd5bf55

jest_e2e[run_all_tests]

Reviewed By: yungsters

Differential Revision: D30485521

fbshipit-source-id: c5b92356e9e666eae94536ed31b8de43536419f8

* Remove usages of `dynamic_casts` that are used inside assertions

Summary:
This diff is part of a bigger effort to remove the RTTI flags.
To do so we need to remove occurrences of `dynamic_cast` and other functions that rely on runtime
type informations.

Changelog:
[Internal][Changed] - Removed extra asserts relying on dynamic_cast

Reviewed By: JoshuaGross

Differential Revision: D30483554

fbshipit-source-id: 92b31281841a92c7b43e918938248431265dd654

* Fix broken CI with a run of prettier

Summary:
This Diff is fixing a broken CircleCI on OSS due to
not properly formatted .js files. See https://app.circleci.com/pipelines/github/facebook/react-native/10040/workflows/923cb408-b09c-4425-87c1-2677a7af9681/jobs/213822

The offending diff was D29986749 (ff4b33672a)

Changelog:
[Internal] - Fix broken CI due to not formatted js files

Reviewed By: ShikaSD

Differential Revision: D30515439

fbshipit-source-id: 560de04347a8746065981b534ed96f0956d94b9c

* Fixed dynamic behavior of <Text adjustsFontSizeToFit={true}> on Android (#31538)

Summary:
This PR fixes https://github.com/facebook/react-native/issues/30717, a bug in `<Text adjustsFontSizeToFit={true}>` implementation that prevents it from adjusting text size dynamically on Android.

The way `adjustsFontSizeToFit` was implemented in https://github.com/facebook/react-native/issues/26389 (and the design of ReactTextShadowNode) implies that Yoga will call `onMeasure` on every size change of a `<Text>` component, which is actually not the case (Yoga can cache the results of the measures, call the function multiple times or do not call at all inferring the size from the size constraints). The implementation of `adjustsFontSizeToFit` computes the adjusted string inside the measure function and then eventually passes that to the view layer where it's being rendered.

The proper fix of this issue requires the full redesign of the measure and rendering pipelines and separating them, and that... would be too invasive. And, I believe, this issue is already fixed in Fabric where this part is already designed this way.

Instead, this diff implements a small workaround: if `adjustsFontSizeToFit` is enabled, we manually dirty the Yoga node and mark the shadow node updated to force remeasuring.

## Changelog

[Android] [Fixed] - Fixed dynamic behavior of <Text adjustsFontSizeToFit={true}> on Android

Pull Request resolved: https://github.com/facebook/react-native/pull/31538

Test Plan: https://user-images.githubusercontent.com/22032/118508162-8c79cc80-b6f4-11eb-853f-a1a09f82935f.mov

Reviewed By: mdvacca

Differential Revision: D28631465

Pulled By: yungsters

fbshipit-source-id: 7db1d22e2a5a464c7bf941d1d3df8e3fe8df66a2

* Bump @react-native/polyfills version (#32074)

Summary:
8a62583f79 did some renaming inside of the react-native/polyfills project, with the jest preset updated to use the new name. The new package for polyfills has not yet been published, so the jest preset in the main branch will be looking for the new name, while the old name is provided by the currently published react-native/polyfills@1.0.0. This is not hit inside the repo, since the dependency is linked instead of using the published one.

Bump react-native/polyfills to 2.0 (breaking change), in preparation for publish.

## Changelog

[Internal][Fixed] - Bump react-native/polyfills version

Pull Request resolved: https://github.com/facebook/react-native/pull/32074

Reviewed By: lunaleaps, cortinico

Differential Revision: D30498104

Pulled By: yungsters

fbshipit-source-id: 92dcb159d76bd74cd93cfa09e2155c9c1b2c0a86

* Include Swift lib in LIBRARY_SEARCH_PATHS

Summary:
changelog: Fix Xcode 13 build error in RNTester

Including `usr/lib/swift` fixes error:
{F642876047}

Reviewed By: fkgozali

Differential Revision: D30559838

fbshipit-source-id: 65aad16b550d156c8670eaefcc8bedae99606329

* chore: prefer the local react-native-codegen package (#32096)

Summary:
Currently, the build breaks if we move `react-native-codegen` from the template's dependencies to root. This is due to `scripts/generate-specs-cli.js` using the one installed under `node_modules` instead of the local one.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Internal] [Fixed] - `scripts/generate-specs-cli.js` should prefer the local `react-native-codegen` package

Pull Request resolved: https://github.com/facebook/react-native/pull/32096

Test Plan:
1. Make the following changes
   ```diff
   diff --git a/package.json b/package.json
   index 847c726a69b..78da8232988 100644
   --- a/package.json
   +++ b/package.json
   @@ -107,6 +107,7 @@
        "promise": "^8.0.3",
        "prop-types": "^15.7.2",
        "react-devtools-core": "^4.13.0",
   +    "react-native-codegen": "^0.0.7",
        "react-refresh": "^0.4.0",
        "regenerator-runtime": "^0.13.2",
        "scheduler": "^0.20.2",
   diff --git a/template/package.json b/template/package.json
   index 715614112ac..5e0762b1b25 100644
   --- a/template/package.json
   +++ b/template/package.json
   @@ -21,7 +21,6 @@
        "eslint": "7.14.0",
        "jest": "^26.6.3",
        "metro-react-native-babel-preset": "^0.66.2",
   -    "react-native-codegen": "^0.0.7",
        "react-test-renderer": "17.0.2"
      },
      "jest": {
   ```
2. Run `scripts/test-manual-e2e.sh`

## Expected Behavior

Task `:ReactAndroid:buildReactNdkLib` succeeds.

## Actual Behavior

```
> Task :ReactAndroid:buildReactNdkLib FAILED
make: Entering directory '~/Source/react-native/ReactAndroid/src/main/jni/react/jni'
fcntl(): Bad file descriptor
make: Leaving directory '~/Source/react-native/ReactAndroid/src/main/jni/react/jni'
~/Library/Android/sdk/ndk/21.4.7075529/build/core/build-binary.mk:651: Android NDK: Module react_codegen_rncore depends on undefined modules: react_render_components_view
~/Library/Android/sdk/ndk/21.4.7075529/build/core/build-binary.mk:664: *** Android NDK: Note that old versions of ndk-build silently ignored this error case. If your project worked on those versions, the missing libraries were not needed and you can remove those dependencies from the module to fix your build. Alternatively, set APP_ALLOW_MISSING_DEPS=true to allow missing dependencies.    .  Stop.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:buildReactNdkLib'.
> Process 'command '~/Library/Android/sdk/ndk/21.4.7075529/ndk-build'' finished with non-zero exit value 2

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.9/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 19s
20 actionable tasks: 20 executed
Couldn't generate artifacts
```

Reviewed By: ShikaSD

Differential Revision: D30581194

Pulled By: hramos

fbshipit-source-id: 3f7a707b33377042502e50887856ff5641fdd52c

* feat: add Android 12 BLUETOOTH_ADVERTISE to PermissionsAndroid (#32079)

Summary:
This PR adds BLUETOOTH_ADVERTISE, which showed up in the latest Android 12 Beta build as new `dangerous` permissions requiring approval for them.

https://developer.android.com/reference/android/Manifest.permission.html#BLUETOOTH_ADVERTISE

You can see the new set of `SCAN/ADVERTISE/CONNECT` added in this doc - https://developer.android.com/about/versions/12/features/bluetooth-permissions, previously SCAN/CONNECT were added in: https://github.com/facebook/react-native/pull/31488

## Changelog

[Android] [Changed] - Add BLUETOOTH_ADVERTISE to PermissionsAndroid

Pull Request resolved: https://github.com/facebook/react-native/pull/32079

Test Plan:
```
PermissionsAndroid.BLUETOOTH_ADVERTISE === 'android.permission.BLUETOOTH_ADVERTISE'
```

Reviewed By: cortinico

Differential Revision: D30532656

Pulled By: yungsters

fbshipit-source-id: 986ad8cbfc27913df13ab24bba36f6e13104e7d9

* Update manual testing script to also test Hermes for RNTester

Summary: Changelog: [Internal] - Update test-manual-e2e.sh to test Hermes for RNTester

Reviewed By: ShikaSD

Differential Revision: D30569403

fbshipit-source-id: fd45c8158c4c5ad93f33bc7b80464c5fc387a737

* Move react-native-codegen to root

* [0.66.0-rc.0] Bump version numbers

* Native component check in deprecatedPropType was inverted (#31164)

Summary:
While investigating an issue hit on a recent sync of [react-native-windows](https://github.com/microsoft/react-native-windows) I noticed that e68cf7cee9 appears to have accidently inverted the logic to avoid checking native components.

`!UIManager.getViewManagerConfig(componentName)`
become
`UIManager.hasViewManagerConfig(componentName)`
losing the !

Also adding a check in PaperUIManager's getViewManagerConfig to avoid trying to call a sync method when using Chrome Debugging.

[Internal] [Fixed] - Restored the previous logic of deprecatedPropType

Pull Request resolved: https://github.com/facebook/react-native/pull/31164

Test Plan:
Change tested and being submitted in react-native-windows:
https://github.com/microsoft/react-native-windows/pull/7397

Reviewed By: hramos

Differential Revision: D30624302

Pulled By: fkgozali

fbshipit-source-id: 0f26e750283a1fa5eb5f44ecd2cf90617b6d931f

* OSS: Fix $ENTRY_FILE check for non-Debug Xcode builds

Summary:
The original $ENTRY_FILE check was added in https://github.com/facebook/react-native/pull/29012 to help catch misconfiguration for the entry JS file. That turned out breaking some RNTester builds/tests, so https://github.com/facebook/react-native/pull/29263 was added to accommodate the fact that RNTester .xcodeproj file has its own directory hierarchy.

The 2nd PR had multiple issues:
* It is incorrect to assume that the $ENTRY_FILE always exists in the parent dir of the .xcodeproj location. This caused an issue in RC 0.66: https://github.com/react-native-community/releases/issues/249#issue-983474535
* RNTester has since moved to packages/rn-tester/ (from RNTester/), hence breaking that assumption

It turns out RNTester .xcodeproj has incorrectly misconfigured this JS bundling step (not sure since when). The original script invocation passed in the correct path for `RNTesterApp.ios.js`, but as an arg to the `react-native-xcode.sh` instead of by setting `ENTRY_FILE` env var.

So this diff does 2 things:
* Undid https://github.com/facebook/react-native/pull/29263
* Fix RNTester JS bundling invocation to set the ENTRY_FILE correctly

{F659123377}

Changelog: [iOS][Fixed] Unbreak $ENTRY_FILE handling for JS bundling

Reviewed By: lunaleaps

Differential Revision: D30690900

fbshipit-source-id: 7c5802b3eac56c0456edcd4b7478bfa4af48fc27

* OSS: add Xcode 12.5 + M1 machines CocoaPods post_install workaround

Summary:
Context: there are multiple issues currently exposed by Xcode 12.5 and/or M1 machine + Flipper. To unblock the new 0.66 release, let's add this workaround in the official react_native_pods.rb recipe and make RNTester and new app Podfile's call it directly.

Changelog: [iOS][Fixed] Added workaround for Xcode 12.5 / M1 machines build issues

Reviewed By: lunaleaps

Differential Revision: D30691291

fbshipit-source-id: 8b24cc60da3d620dbc90f95c77f2345e18c28212

* Switch order of search libraries to fix M1 build error

Summary: changelog: Resolve Xcode 13 build error on M1 Macs for projects created from RN template

Reviewed By: fkgozali

Differential Revision: D30693466

fbshipit-source-id: f0b4fd471de38119d636c8e337831aa4d4599c4e

* Copy repo-config dependencies for bumping release version

Summary:
Changelog: [Internal[Fixed] - Revert, yarn workspaces only used in private packages. Copy dependencies over from repo-config instead

Original commit changeset: 1dd2adc6a036

Reviewed By: fkgozali

Differential Revision: D30599065

fbshipit-source-id: 0efffaaf38bc23bac339e6e1d917736243e1750e

* [0.66.0-rc.1] Bump version numbers

* [LOCAL] postfix timestamp to bust yarn cache

* Make JSI a dynamic library

Summary:
Ship libjsi as a standalone dynamic library. This prevents problems
with exception handling caused by duplicate typeinfo across multiple
shared libs, and reduces bundle size by removing duplicate copies of
JSI.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D30599215

fbshipit-source-id: abad1398342a5328daa825f3f684e0067cad7a96

* Revert the Android specific max heap size GCConfig

Summary:
Changelog:
[Category][Internal]

This diff reverts the [Androids-specific heap size overrides](github.com/facebook/react-native/commit/63d20d3b1ef35cb4398d63d62f631f7f5d2935c7#diff-4c59ddca85e294a90a0e1bd15ed323ff4e130911d9642680dde44aacbcd7d32c) after
[Hermes has changed its default max heap size to 3GiB](5f2b47d0be).
You can read about more context there.

Reviewed By: yungsters

Differential Revision: D30726067

fbshipit-source-id: 1bcc93fdf4da817f3b3d60bd09c6a5a64166eb7e

* Bump Hermes npm to 0.9.0

Summary:
Changelog:
[General][Changed] - Bump Hermes to 0.9.0

allow-large-files

Reviewed By: lunaleaps

Differential Revision: D30726474

fbshipit-source-id: 742cf68b046d8768e83e00d754e8efcc97586c00

* Bump Hermes pod to 0.9.0

Summary:
Changelog:
[General][Changed] - Bump Hermes to 0.9.0

(Note: this ignores all push blocking failures!)

Reviewed By: lunaleaps

Differential Revision: D30726473

fbshipit-source-id: add4149454b3f0333f3c1cb8b5d632371fd1bd80

* Update Podfile.lock

* [0.66.0-rc.2] Bump version numbers

* Link RCT-Folly against libc++abi

Summary:
Folly now depends on libc++abi. This solves linker error for RCT-Folly.podspec like this:

```
Undefined symbols for architecture arm64:
  "___cxa_increment_exception_refcount", referenced from:
      folly::exception_ptr_get_type(std::exception_ptr const&) in libRCT-Folly.a(Exception.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
```

See https://github.com/react-native-community/releases/issues/251

Note: RNTester was not affected by this bug for some reason, so the only way to verify is via the new app generated via `npx react-native init`.

Changelog: [Fixed][iOS] Unbreak Folly linker error

Reviewed By: lunaleaps

Differential Revision: D30950944

fbshipit-source-id: 3eb146e23faa308a02363761d08849d6801e21ca

* Update rn-tester Podfile.lock to prepare for 0.66.0-rc.3

* [0.66.0-rc.3] Bump version numbers

* Don’t hard-code CocoaPods’s sandbox path (#32243)

Summary:
When running `scripts/react_native_pods.rb`, the `Pods` directory may not be in the current working directory, for example, when calling [`pod install`](https://guides.cocoapods.org/terminal/commands.html#pod_install) with `--project-directory=ios`. Therefore, `sed` fails and, ultimately, the build fails.

References:
* https://rubydoc.info/gems/cocoapods/Pod%2FInstaller:sandbox
* https://rubydoc.info/gems/cocoapods/Pod/Sandbox#root-instance_method

## Changelog

[iOS] [Fixed] - Fix build error after running `pod install` with `--project-directory=ios`

Pull Request resolved: https://github.com/facebook/react-native/pull/32243

Test Plan:
1. `npx react-native init AwesomeProject --version 0.66.0-rc.3 --skip-install`
2. `cd AwesomeProject`
3. `yarn install`
4. `pod install --project-directory=ios`

This command prints “sed: Pods/RCT-Folly/folly/portability/Time.h: No such file or directory” but still exits with 0.

5. `npx react-native run-ios`

The build fails because of “typedef redefinition with different types” as described in https://github.com/facebook/flipper/issues/834.

6. Apply this patch using `(cd node_modules/react-native && curl ec330f756e.patch | patch -p1)`
7. Re-run `pod install --project-directory=ios`
8. Re-run `npx react-native run-ios`

The iOS app should now run successfully.

Reviewed By: sota000

Differential Revision: D31089656

Pulled By: fkgozali

fbshipit-source-id: 431898bed88f68761c7e0e6c79074dc04f43ed23

* OSS: update Podfile.lock automatically when bumping release version

Summary:
To ensure consistency of RNTester Podfile.lock:
* introduce a script to run `pod install` on the current commit
* have the script check the exact CocoaPods version to use for consistency
* have version bump script run this automatically to keep it up-to-date with the version change

To validate, have this change in `0.66-stable` branch, then try:

```
./scripts/bump-oss-version.js 0.66.0-rc.5
```

This automatically ran `pod install` which produced the Podfile.lock update.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D31132867

fbshipit-source-id: 1c82653ca0cfc5471ed2c5091c09648a7acbab90

* [LOCAL] Port react-native-codegen new .gitignore from main

This is to bring c3ff336326/.gitignore (L107) to release branch

* OSS: bump-oss-version -- update Podfile.lock later in the flow

Summary:
There was some hardcoded validation logic to verify package.json and gradle.properties update. Running `pod install` before that failed this validation on release branch, so let's move the pod update a bit later in the flow.

This also restrict the version number change check to the specific files for better reliability

Changelog: [Internal]

Reviewed By: sota000

Differential Revision: D31160139

fbshipit-source-id: d32470d7dfc48c2efab1d2767f3892b33e0b77dd

* [0.66.0-rc.4] Bump version numbers

* [0.66.0] Bump version numbers

* get ios building

* remove isSelected and selectedRowIndexPath for now

* add workspace

* Restore .eslintignore to what it looks like in react-native-macos

* Fix easy eslint errors as per the `--fix` option

* Fix the rest of the yarn lint errors

* Update yarn.lock

* Add AccessibilityRole back to Button.js

* Fix flow issues on iOS and macOS

* Initialize state in VirtualizedSectionList

* Update snapshots

* Fix parseLogBoxLog tests to include native code blocks

* Specify state explicitly for DisplayOptionsStatusExample

* Disable "Text with custom accessibility actions" example

* android

* Fix AnimatedMock spring to handle animated configs

* Fix most compile issues for macOS

* Fix post_install sed script

* Changes that allow RNTester to launch on macOS

* Fix isHighContrastEnabled on RNTester accessibility page

* Bump special targets in RNTester Podfile to iOS 11

* BorderExample: use a platform color that also exists on macOS

* Disable dev mode on ship builds (#888)

* revert dev mode on ship builds

* rctuicolor

* remove unused variable

* pod install

* fix text fields on macOS

* add osx support

* image prop and scroll view build failures osx

* Fix yarn lint issues

* Update Podfile.lock

* endline changes

* Get rid of macOS RedBox in LayoutEventsExample

* fix: Apply proper accessibility role to images on macOS

* Add another macOS GH#774 tag

* fix snapshot image test failure

* upgrade ts to a compatible version

* bump podfile.lock

* Fix Android patches in fb66merge

* change cocoapods version

* update internal cocoapods requirements

* test increasing min deployable target

* min deployment error in CI, bump to 10.15 osx

* fix typedef redefinition build error in folly

* disable use_flipper in our templates

* disable USE_FRAMEWORKS for Flipper support

* Revert "disable USE_FRAMEWORKS for Flipper support"

This reverts commit c09b6c579c.

* disable post_install of flipper

* combine tempated macos post_install

* add generate-specs.sh

Co-authored-by: Xuan Huang <jsx@fb.com>
Co-authored-by: Samuel Susla <samuelsusla@fb.com>
Co-authored-by: Charles Dudley <charlesdudley@fb.com>
Co-authored-by: Jesse Katsumata <jesse.katsumata@gmail.com>
Co-authored-by: Sota Ogo <sota@fb.com>
Co-authored-by: Rick Hanlon <rickhanlonii@fb.com>
Co-authored-by: David Vacca <dvacca@fb.com>
Co-authored-by: Amy Nichol <amynichol@fb.com>
Co-authored-by: swittk <switt1995@gmail.com>
Co-authored-by: Ikko Ashimine <eltociear@gmail.com>
Co-authored-by: Joshua Gross <joshuagross@fb.com>
Co-authored-by: CodemodService FBSourceClangFormatLinterBot <>
Co-authored-by: Michael Chow <michael.chow@alumni.stanford.edu>
Co-authored-by: Evan Yeung <evanyeung@fb.com>
Co-authored-by: Jacob Parker <jacobparker1992@gmail.com>
Co-authored-by: jeswinsimon <jeswinsimon@gmail.com>
Co-authored-by: fabriziobertoglio1987 <fabrizio.bertoglio@gmail.com>
Co-authored-by: Ramanpreet Nara <ramanpreet@fb.com>
Co-authored-by: Vegas Murphy <vegasmurphy@fb.com>
Co-authored-by: Moti Zilberman <moti@fb.com>
Co-authored-by: Test User <gosimek@gmail.com>
Co-authored-by: Pieter De Baets <pieterdb@fb.com>
Co-authored-by: Paige Sun <paigesun@fb.com>
Co-authored-by: Moti Zilberman <motiz88@gmail.com>
Co-authored-by: Andrei Shikov <ashikov@fb.com>
Co-authored-by: Andrew Clark <acdlite@fb.com>
Co-authored-by: Luis Miguel Alvarado <luismiguel1730@gmail.com>
Co-authored-by: Sunny Luo <sunnylqm@gmail.com>
Co-authored-by: Saad Najmi <saadnajmi2@gmail.com>
Co-authored-by: Héctor Ramos <hramos@fb.com>
Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
Co-authored-by: Harry Yu <hy.harry.yu@gmail.com>
Co-authored-by: Janic Duplessis <janicduplessis@gmail.com>
Co-authored-by: Jordan Becker <jordanbeckerfr@gmail.com>
Co-authored-by: Nicola Corti <ncor@fb.com>
Co-authored-by: Phillip Pan <phillippan@fb.com>
Co-authored-by: Dmytro Voronkevych <zloy@fb.com>
Co-authored-by: Luna Wei <luwe@fb.com>
Co-authored-by: Chris Tolliday <ctolliday@fb.com>
Co-authored-by: Levi Buzolic <levibuzolic@gmail.com>
Co-authored-by: Nishan Bende <nishanbende@gmail.com>
Co-authored-by: Matthew Gray <Matgray@microsoft.com>
Co-authored-by: Hein Rutjes <hrutjes@gmail.com>
Co-authored-by: nacam403 <satnakam@gmail.com>
Co-authored-by: Nicholas Tinsley <nicktinsley@fb.com>
Co-authored-by: hank121314 <hank121314@gmail.com>
Co-authored-by: Jonathan Andrew <jonny.andrew@protonmail.com>
Co-authored-by: alessandro <alessandro.fan@welld.ch>
Co-authored-by: Dulmandakh <dulmandakh@gmail.com>
Co-authored-by: Albert Sun <fatalsun@fb.com>
Co-authored-by: pera <santiagofermendy@gmail.com>
Co-authored-by: Carmi Grushko <carmi@fb.com>
Co-authored-by: Jimmy Zhang <jimmyzh@fb.com>
Co-authored-by: Arushi Kesarwani <arushikesarwani@fb.com>
Co-authored-by: Marshall Roch <mroch@fb.com>
Co-authored-by: Chatura Atapattu <chatatap@fb.com>
Co-authored-by: edenb-moveo <71688494+edenb-moveo@users.noreply.github.com>
Co-authored-by: pietro909 <2094604+pietro909@users.noreply.github.com>
Co-authored-by: Dmitry Rykun <dmitryrykun@fb.com>
Co-authored-by: Leon Kiefer <leon.k97@gmx.de>
Co-authored-by: Steven Bell <bell-steven@users.noreply.github.com>
Co-authored-by: Timo Mämecke <timomeh@users.noreply.github.com>
Co-authored-by: Kacie Bawiec <kacieb@fb.com>
Co-authored-by: Valentin Shergin <valentin.shergin@coinbase.com>
Co-authored-by: Nick Gerleman <ngerlem@microsoft.com>
Co-authored-by: Tommy Nguyen <4123478+tido64@users.noreply.github.com>
Co-authored-by: Connor Tumbleson <connor@sourcetoad.com>
Co-authored-by: Andrew Coates <30809111+acoates-ms@users.noreply.github.com>
Co-authored-by: Kevin Gozali <fkg@fb.com>
Co-authored-by: Neil Dhar <neildhar@fb.com>
Co-authored-by: Jakob Krigovsky <jakob@krigovsky.com>
Co-authored-by: Adam Gleitman <adam.gleitman@gmail.com>
2022-01-14 13:11:09 -08:00
Marshall Roch 66dc211436 truncate JSTimers errors array instead of making it nullable
Summary:
instead of `errors: ?Array<Error>` and setting it back to `null` to clear errors, which Flow is not very happy with, we can make it always an array and truncate it with `errors.length = 0`.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D33584184

fbshipit-source-id: 81b424e69e60203c645bafbac12177ffcdc0c6ef
2022-01-14 09:06:56 -08:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Luna Wei 3204c55981 Remove usages of bump-oss-version from generated scripts
Summary: Changelog: [Internal] - Update the source of the changes in generated files, no longer bump-oss-version but set-rn-version

Reviewed By: sota000

Differential Revision: D33110408

fbshipit-source-id: 8cd5004f5d40dde82fe4d6271d5b8598cd27ca31
2021-12-17 18:37:37 -08:00
Gijs Weterings 0c744dea56 Back out "Introduce a PlatformBaseViewConfig for all HostComponents"
Summary: Changelog: [Internal]

Reviewed By: arushikesarwani94

Differential Revision: D33042499

fbshipit-source-id: 603fbfa4e2f482c5d002532745a29170daded184
2021-12-11 06:58:07 -08:00
Ramanpreet Nara cab16352c7 Introduce a PlatformBaseViewConfig for all HostComponents
Summary:
## iOS
On iOS:
- All props come from ViewManagers
- All HostComponent ViewManagers extend <View/> ViewManager

https://pxl.cl/1SxdF

Therefore, it's safe to have all HostComponent Static View Configs extend <View/> Static View Config.

## Android

On Android, the model is a bit more complicated:

https://pxl.cl/1Vmp5

Takeaways:
- Props come from Shadow Nodes **and** ViewManagers
- Nearly all HostComponent ViewManagers extend BaseViewManager. But, that's not <View/>'s ViewManager.
- <View/>'s ViewManager is [ReactViewManager](https://fburl.com/code/0zalv8zk), which is a descendent of BaseViewManager, and declares its own ReactProps.

So, it's not safe to have all Android HostComponent Static View Configs to extend <View/>'s Static View Config:
1. No components actualy incorportate <View/>'s props
2. Some components don't even incorporate BaseViewManager's props.

## Changes
In this diff, I removed ReactNativeViewViewConfig, and introduced a new view config called PlatformBaseViewConfig. This ViewConfig partial will capture all the props available on all HostComponents on **both** platforms. This may not necessarily be the props made available on <View/>.

The only components that don't extend the base platform props are: RCTTextInlineImage. What we do with these components is TBD.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D32187832

fbshipit-source-id: 9a057abb3f58801615891c21e42ad4cfa5c69f21
2021-12-10 23:19:52 -08:00
Evan Yeung 037e346197 Add LTI annotations to xplat/js
Summary:
This diff runs the codemod to add type annotations to function parameters in preparation for Flow's local type inference (LTI) project. I ran the codemod over xplat/js and reverted any files that had flow errors in them. See the list of commands run to see the regeneration of various files.

Changelog:
[Internal][Changed] - Added type annotations

Reviewed By: yungsters

Differential Revision: D32075270

fbshipit-source-id: 6a9cd85aab120b4d9e690bac142a415525dbf298
2021-11-10 15:40:15 -08:00
Tim Yung 36bbd8fa31 RN: Eliminate Jest Log Spew
Summary:
Eliminates all of the console logs that appear when successfully running Jest tests for React Native.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D32304619

fbshipit-source-id: 8bc8ef9337ae6af588238cec7cfb874ac6067340
2021-11-09 23:42:28 -08:00
Tim Yung 148c98ec80 RN: Resolve Outstanding ESLint Warnings
Summary:
Resolves outstanding ESLint warnings in React Native.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D32291912

fbshipit-source-id: 61337d5a5a0e6ed55f732675e029f4b76d850af9
2021-11-09 21:46:21 -08:00
Tim Yung 77ecc7ede1 JS: Format with Prettier v2.4.1 [3/n]
Summary:
Changelog:
[General][Internal]

Reviewed By: zertosh

Differential Revision: D31883447

fbshipit-source-id: cbbf85e4bf935096d242336f41bf0cc5d6f92359
2021-11-02 22:14:16 -07:00
Lulu Wu c901c43d11 Remove shared responsibility between LogBox and ExceptionsManager native module
Summary:
## Context
Right now we are using both LogBox and ExceptionsManager native module to report JS errors in ExceptionsManager.js, from below code we can tell they have some overlapping - when ```__DEV__ === true``` both could report the error.

https://www.internalfb.com/code/fbsource/[5fb44bc926de87e62e6e538082496f22017698eb]/xplat/js/react-native-github/Libraries/Core/ExceptionsManager.js?lines=109-141

## Changes
In this diff overlapping is removed: in ```ExceptionsManager.js``` LogBox will be responsible for showing the error with dialog when ```__DEV__ === true```, when it's prod we'll use ExceptionsManager native module to report the error. As a result LogBox and ExceptionsManager native module don't share responsibilities any more.

Changelog:
[General][Changed] - Remove shared responsibility between LogBox and ExceptionsManager native module

Reviewed By: philIip

Differential Revision: D30942433

fbshipit-source-id: 8fceaaa431e5a460c0ccd151fe9831dcccbcf237
2021-10-08 11:08:43 -07:00
Rubén Norte a101fc768c Remove unnecessary global variable named GLOBAL
Summary:
We are defining an alias for the global variable in React Native called `GLOBAL`, which is not used at all at Facebook and it doesn't seem it's used externally either. This alias is not standard nor common in the JS ecosystem, so we can just remove it to reduce the pollution of the global scope.

Changelog: [General][Removed] - Removed unnecessary global variable `GLOBAL`.

Reviewed By: yungsters

Differential Revision: D31472154

fbshipit-source-id: 127c3264848b638f85fb2e39e17ed2006372d2dd
2021-10-08 07:39:11 -07:00
Adam Gleitman aa8cfcdb07 Merge commit '9500eb8867d25896b1611903a64fac8d81984bf6' into amgleitman/0.64-merge-head 2021-10-06 13:27:56 -07:00
Adam Gleitman 4bfa80f5c4 Merge commit 'f023519e491d8352fb384bd1520606c12cbad1ca' into amgleitman/0.64-merge-head 2021-10-05 18:55:29 -07:00
Adam Gleitman 0715e4a898 Merge commit '403d6f4401178fb9c22fb7c8dfac735633de6c0e' into amgleitman/0.64-merge-head 2021-10-01 14:28:59 -07:00
Adam Gleitman b0c8b79007 Merge commit '3a6327a5d9ebfd0de56c37009ab7de1d0e6bdf85' into amgleitman/0.64-merge-head 2021-09-22 16:22:20 -07:00
Adam Gleitman 66e61edce1 Merge commit '93e7a7a70dc2f41fccd3c1e4cce80d92913c4243' into amgleitman/0.64-merge-head 2021-09-16 18:53:41 -07:00
Adam Gleitman 28190f9b67 Merge commit '9b973f32e4d81713a10a186e42ee57d6e1d414d3' into amgleitman/0.64-merge-head 2021-09-15 18:35:12 -07:00
Adam Gleitman b756416539 Merge commit '9b11cb6f1f68f919684de0e4ceb926961c26b998' into amgleitman/0.64-merge-head 2021-09-01 17:30:37 -07:00
Adam Gleitman 708495dbfd Merge commit '4409642811c787052e0baeb92e2679a96002c1e3' into amgleitman/0.64-merge-head 2021-09-01 14:10:33 -07:00
Adam Gleitman ea581e6aac Merge commit 'f00795dc90d05180014eeea4b3215b0166a90692' into amgleitman/0.64-merge-head 2021-08-27 14:43:33 -07:00
Xuan Huang e60ad0837e Type more globals
Summary:
Changelog: [Internal]

This diff add types to some of the common globals so uses of
them through `global` are now typed.

All the globals are marked as read-only for their intented uses.
However, some of them do have write cites (mostly are in tests to
deliberately set up a special test environment). Those write cites
are considered as "necessary evil" and annotated as `FlowFixMe`.

Reviewed By: yungsters

Differential Revision: D30158145

fbshipit-source-id: 93a99063361a4b7a1e33d9fc97a661be30a4d8f9
2021-08-26 01:06:44 -07:00
Xuan Huang ff4b33672a Add Flow libdefs for HermesInternalType
Summary:
Changelog: [Internal]

This diff add a flow libdefs for the `HermesInternalType` to type
`HermesInternal` as the first accurately typed `global` property,
and filled all the type holes.

Reviewed By: yungsters

Differential Revision: D29986749

fbshipit-source-id: a94be7919f989b5085f6b264e55145a85020fea9
2021-08-24 00:12:21 -07:00
Adam Gleitman 42a4e5ee9a Merge commit '709570acfb667b2884d24e9a90061466809ceeef' into amgleitman/0.64-merge-2020-mm-dd 2021-08-20 14:08:23 -07:00
Adam Gleitman e6d2b0a983 Merge commit 'f53267f7031dec9f8e61c679bf786d025d634eb6' into amgleitman/0.64-merge-2020-mm-dd 2021-08-18 18:29:38 -07:00
Adam Gleitman 0dd5ae73b4 Merge commit 'a50fa552a7e07f611d626fae99a6ef80845d9d4d' into amgleitman/0.64-merge-2020-mm-dd 2021-08-17 13:54:33 -07:00
Adam Gleitman 9a02986fae
Merge from upstream through 2020-05-28 (#811)
* Remove `docs` from `jscodeshift`

Summary:
I removed 1 MiB from `jscodeshift` as it was shipping with docs: 5885662920

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D21368889

fbshipit-source-id: 452fd4cedcc749d972adbb69df5c95117dd55b15

* iOS: when the bridge has been invalidated, NativeModule lookup should just return nil

Summary:
There's a corner case where:
* The bridge gets invalidated, and native modules are cleaning up themselves (but not done yet)
* Something asks for a NativeModule instance - ideally it should just get nil at this point
* If TM Manager is invalidating, we get nil correctly, but we continue thru the old NativeModule lookup logic
* The latter will fail anyway, and would throw a redbox (RCTLogError).

So, if the bridge is invalidated, if TM Manager returns nil, we should just return nil for old NativeModule lookup.

The module of interest is RCTImageLoader, which was requested by RCTImageView on deallocation. The problem is RCTImageView got dealloc'ed **after** the bridge has been invalidated, so the lookup would always fail...

Bonus: RCTImageView should just keep a weak ref to the RCTImageLoader, so that:
* if the imageLoader is still alive on image dealloc, it can still access them (last minute "meaningless" cleanup)
* if the imageLoader is gone, then the image deallocation doesn't do anything

Changelog: [iOS] [Fixed] - Fix module lookup race condition on bridge invalidation.

Reviewed By: p-sun, sammy-SC

Differential Revision: D21371845

fbshipit-source-id: 862dc07de18ddbfb90e87e24b8dbd001147ddce4

* Fix invalid type annotations

Summary:
Our parsers accept these but they are invalid. This fixes them.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D21373812

fbshipit-source-id: 6084757b9f842644fe629ae5e6d85baec611588d

* Fixes TextInput shaking when typing Chinese (#28805)

Summary:
Fixes https://github.com/facebook/react-native/issues/28488.

## Changelog

[iOS] [Fixed] - Fixes TextInput shaking when typing Chinese
Pull Request resolved: https://github.com/facebook/react-native/pull/28805

Test Plan: Demo see https://github.com/facebook/react-native/issues/28488.

Differential Revision: D21376803

Pulled By: shergin

fbshipit-source-id: b1fe6cc5f67d42ef98a6c12b8ab9990feac0e2a7

* VirtualizedList: Migrate to React.Context

Summary:
Migrates `VirtualizedList` off legacy context by creating `VirtualizedListContext`.

Changelog:
[General][Changed] - Migrated `virtualizedList` legacy context to `React.Context`.

Reviewed By: TheSavior

Differential Revision: D21370882

fbshipit-source-id: 2fa99ee0bc0e6b747a2d3fe7c66ee402c6b9c5af

* VirtualizedList: Remove `PropTypes` Dependency

Summary:
Removes `PropTypes` as a dependency of `VirtualizedList` by no longer validating the return value of `getItemLayout`.

Changelog: [Internal]

Reviewed By: TheSavior, cpojer

Differential Revision: D21370890

fbshipit-source-id: 966db3557b714987aa91179c7654a5ebf27818ad

* Remove `@babel/preset-env`

Summary:
`babel/preset-env` pulls in a number of unused deps, like `caniuse-lite` (3 MiB) that knows about which browsers support certain features. We do not ship to browsers and always know which version of node we are using, so we don't need to pull this in.

I changed `jscodeshift` to optionally depend on `babel/preset-env` instead of always pulling it in.

This reduces node_modules by 7 MiB.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D21374475

fbshipit-source-id: 6f55e96e990ec0ca12f17bb3657bfa5429796b93

* Add prepareForReuse to RCTSafeAreaViewComponentView

Summary:
Changelog: [internal]

As part of recycle, we should delete state. This is a common pattern used in other components as well.

Reviewed By: shergin

Differential Revision: D21348782

fbshipit-source-id: a5dee2f4ccee9b19498db31dab1983d8879dca71

* chore: remove Kotlin version from the default template (#28626)

Summary:
The default application requires Kotlin version that is not supported by the Gradle plugin (should be at least `1.3.10`). However, instead of upgrading, we should remove it entirely. Here's why.

This commit 29d3dfbd19 introduced Detox for RNTester Android application.

Since the commit doesn't mention Detox for the default application and there are no Detox tests present by default in the default application, I believe that this addition was performed by a mistake.

The best way is to remove Kotlin from the default template. This step is described in the Detox documentation and all users that are integrating Detox will be asked to perform it anyway. No need to do it for them.

## Changelog

[ANDROID] [INTERNAL] - remove Kotlin from the default template
Pull Request resolved: https://github.com/facebook/react-native/pull/28626

Test Plan: Building a brand new project with `master` should work

Differential Revision: D21388961

Pulled By: shergin

fbshipit-source-id: 92666aa67f92b29f4e7f9c036b332bd058cdd49e

* Fix Optimized Differ (was generating extraneous Create mutations)

Summary:
When we call `.erase` on the TinyMap, it sets the key of the element to 0. When we call `.begin()` later, TinyMap will sometimes, but not always, clean up the underlying Vector. This means that *most* of the time, underlying erased elements will be removed from the Vector; but sometimes erased elements will still be there when iterating over it.

This was causing us to generate extra "Create" mutations.

To fix this, for now we just check for zeroed-out elements when iterating over the vector.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21389371

fbshipit-source-id: 1e641050987d40a3f3e31499dcb373cfb28ae6f8

* Add warning when scrollRef does not have a scrollTo method

Summary:
Add a `console.warn()` call when calling `_scrollRef.scrollTo`, because `scrollTo` is not guaranteed to exist on `_scrollRef`.

Context:
`VirtualizedList` holds `_scrollRef`, which is usually a reference to a `ScrollView` component. However, there are several cases where it holds a `View` or other type of component instead.

A custom component can be passed in to `renderScrollComponent`, and then `_scrollRef` will point to that custom component. Additionally, if two VirtualizedLists are nested with the same orientation, `_defaultRenderScrollComponent` will return a View instead of a ScrollView.

Due to these possibilities, `_scrollRef` is not guaranteed to have a `scrollTo` method.

Changelog: [General] [Added] - Add warning when scrollRef does not have a scrollTo method

Reviewed By: JoshuaGross, TheSavior

Differential Revision: D21386842

fbshipit-source-id: 01e167e0ae0edea8f29853e8b242ce88a5103b49

* Don't use #import in C++ Code (#28825)

Summary:
While #import is common in Objective C, it's a vendor specific extension in C++, only supported by GCC/Clang, and only when -pedantic is off. Its use causes build breaks with MSVC. Replace it with the standard #include.

## Changelog

[Internal] [Fixed] - Don't use #import in C++ Code
Pull Request resolved: https://github.com/facebook/react-native/pull/28825

Test Plan: We've ben running this change within react-native-windows for some time.

Differential Revision: D21391233

Pulled By: shergin

fbshipit-source-id: c0f94f314c46d6ac24067bbdcd5aaaeec9da283f

* Fix unit test compilation on Android

Summary:
Before, compilation fails with P130281113. After fixing BUCK target, fails with P130281201.

After all changes, the tests succeed.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21390996

fbshipit-source-id: c85aa43b3ef7fc9642d226ae706c937b2a5a408d

* Support calling LayoutAnimation APIs in Fabric from JS

Summary:
Call Fabric's LayoutAnimation APIs from JS.

Changelog: [Internal] A step towards supporting LayoutAnimations on Fabric

Reviewed By: shergin, mdvacca

Differential Revision: D21297975

fbshipit-source-id: 6d530b01d8152e7c803a7c0299b918a32fb39dc0

* Differ: fix TinyMap to prevent possible crashes in `find()` and `begin()`, and prevent erased elements from being iterated over

Summary:
The core issue solved in D21389371 was that erased elements of a TinyMap were being iterated over, because TinyMap has somewhat-complicated logic around cleaning out the underlying vector. In some very marginal cases, vectors were not being cleaned and an iterator pointing at erased elements was being returned.

The diff prevents some possible crashes in `begin()` and `find()` while making it much less likely to iterate over erased elements.

We also add a unit test to catch the case fixed in D21389371, in particular.

We also are keeping the code added in D21389371 (for now) since it's a cheap check, and will be a safeguard until we have rigorous testing around TinyMap. To be clear that logic should noop currently, but will prevent crashes in case guarantees around TinyMap change in the future.

Currently there is only one line of code that actually uses the TinyMap iterator, so this should be safe.

Reviewed By: shergin

Differential Revision: D21392762

fbshipit-source-id: 36dc998958c230fad01af93338974f8889cbcf55

* Allow passing partial contentOffset to ScrollView on Android (#28817)

Summary:
Since support for contentOffset was added to horizontal ScrollView on android (30cc158a87) I'm seeing a crash in my app because of a library. What happens is that it passes a partial object for contentOffset so something like `{x: 1}` which causes a crash on Android.

According to the flow types the object should always contain both x and y but I think we should preserve the runtime behaviour and just use 0 like iOS does.

## Changelog

[Android] [Fixed] - Allow passing partial contentOffset to ScrollView on Android
Pull Request resolved: https://github.com/facebook/react-native/pull/28817

Test Plan: Tested that passing partial object for contentOffset does not crash.

Reviewed By: JoshuaGross

Differential Revision: D21396319

Pulled By: shergin

fbshipit-source-id: 4b52c868e3bfe183ff7f68a76ac34d1abd5e1069

* Pass initial props to WrapperComponent

Summary:
`renderApplication` receives the root component that we need to render and an optional wrapper component. There are cases where we want to use the initial props passed to the root component in the wrapper component as well (e.g.: to provide a specific context to the root component), so this adds modifies `AppContainer` to accept the initial props and inject them into the wrapper component.

Changelog: [General] [Added] - Modified `renderApplication` to forward `initialProps` to `WrapperComponent`

Reviewed By: fkgozali

Differential Revision: D21347486

fbshipit-source-id: 1c4f702a3875077630de1a44d3ac9ef2c80bc10c

* Upgrade to Jest 26

Summary:
* Brings performance improvements from 25.5.x
* Reduces node_modules by 3 MiB, see https://github.com/facebook/jest/pull/9950/files?short_path=63580dd#diff-63580dd1e7078ce037f10f2fee7553b9
* Breaking changes: https://github.com/facebook/jest/blob/master/CHANGELOG.md

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D21369069

fbshipit-source-id: 81a9d50f8e541293a85ce3957cb962930ca05b11

* Make column match fuzzy

Summary:
We are currently very strict about breakpoint location matching. This
diff allows some fuzz in the column, but not in the line.

Changelog: [Internal] Setting Hermes breakpoints no longer requires exact column match

Reviewed By: avp

Differential Revision: D21343198

fbshipit-source-id: a59786a9d63f9fe1ed576835ed660ba3343affe1

* Fix type of exported Touchables: ComponentType -> AbstractComponent (#28737)

Summary:
Fixes https://github.com/facebook/react-native/issues/28726

When importing TouchableOpacity, it is treated as any by Flow. Replacing ComponentType with AbstractComponent works.

The [Flow documentation](https://flow.org/en/docs/react/types/#toc-react-componenttype) says the following about ComponentType:
> Note: In 0.89.0+, React.ComponentType is an alias for React.AbstractComponent<Config, any>, which represents a component with config type Config and any instance type.

So I'm thinking that since the instance type is treated as any with ComponentType, Flow treats TouchableOpacity as any as well.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[General] [Fixed] - Fix Touchable{Opacity,Bounce,Highlight} being exported as `any` (Flow)
Pull Request resolved: https://github.com/facebook/react-native/pull/28737

Test Plan: I have done the same changes to react-native in my project's node_modules and seen that the components TouchableOpacity went from any to AbstractComponent with some props. Now I have a bunch of errors because I'm sending in wrong props to some touchables, which is good!

Reviewed By: cpojer

Differential Revision: D21362601

Pulled By: TheSavior

fbshipit-source-id: 5b98cc79eaef034eccdb7f47242f9f44be2ef2b8

* Import folly and adjust whitespace to match old codegen

Summary:
Import folly to handle optionals (`folly::Optional<__type__>`)

Sort modules and indent generated code to match output from the old codegen. While not strictly necessary as these are generated files that should not be edited by hand, I found that matching the old codegen in this regard made it less of a chore when it came to comparing the output of both codebases.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D21395231

fbshipit-source-id: 289d617d7a2d93724456c80afea57a49c108cb9b

* Update native module specs

Summary: As titled.

Reviewed By: fkgozali

Differential Revision: D21417307

fbshipit-source-id: 7c6b0179f9f1a5108da241d181a24f707a083deb

* Smoother scrolling in ScrollView, HorizontalScrollView

Summary:
Android ScrollView/HorizontalScrollView `smoothScrollTo` contains some logic that, if called multiple times in a short amount of
time, will treat all calls as part of the same animation and will not lengthen the duration
of the animation. This means that, for example, if the user is scrolling rapidly, multiple
pages could be considered part of one animation, causing some page animations to be animated
very rapidly - looking like they're not animated at all.

We use a custom animation to perform `smoothScrollTo` to improve the UX.

This resolves a longstanding issue in non-Fabric RN, as well as Fabric, since this code is shared between the platforms.

Changelog: [Update] Android ScrollView/HorizontalScrollView scrolls using custom animations instead of default Android `smoothScrollTo` implementation, leading to smoother scrolls for paginated ScrollViews

Reviewed By: mdvacca

Differential Revision: D21416520

fbshipit-source-id: 6ebe63cb054a98336b6e81253d35623fe5522f89

* Cleanup unused dependencies

Reviewed By: kassens

Differential Revision: D21281288

fbshipit-source-id: cf566ad0628dc179b3753f2f25a11637c33dee24

* iOS: Animated image should animate at the same speed regardless of framerate

Summary:
In iOS 11, [CADisplayLink](https://developer.apple.com/documentation/quartzcore/cadisplaylink)'s frameInterval was deprecated in favor of preferredFramesPerSecond, but these two properties have different underlying assumptions.

- set frameInterval to 2 for 30fps
- set preferredFramesPerSecond to 30 for 30fps. When you use preferredFramesPerSecond, assume frameInterval is 1.

This fix ensures gifs in <Image> component will animate at same speed regardless of framerate.

Reviewed By: shergin

Differential Revision: D21414014

fbshipit-source-id: 40ab23bab1990cf65d2802830b6835f350999537

* LogBox - Always display the first fatal error

Summary:
This diff fixes an off-by-one error probably caused by my font ligatures where when exactly two exceptions are thrown at the same time we would show the second exception instead of the first. If three or more were thrown, we would show the second.

I also fixed some tests that had the wrong descriptions and wrong behavior enforced.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D21413186

fbshipit-source-id: 8e2940c89251dc042b10c6a2a2186089b6e7b53d

* Rename error titles

Summary:
Based on feedback we're updating these titles to be more clear for their source.

Changelog: [Internal]

Reviewed By: cpojer

Differential Revision: D21413486

fbshipit-source-id: c144e7f759a4ff263b7ec80fa643eeb8ffac741b

* Moved some NativeModule JS specs to OSS

Summary:
For some reason the specs were internal, but the native impl is still in github. So let's move these to github for consistency.

Changelog: [Internal]

Reviewed By: hramos

Differential Revision: D21419934

fbshipit-source-id: f2c4486edca43c4348f3a3c6ce98f76a322bab0b

* Deploy Flow v0.124.0 to xplat/js

Summary:
Changelog: [Internal]

allow-large-files

Reviewed By: samwgoldman, cpojer

Differential Revision: D21413059

fbshipit-source-id: f3d111b40bfb88c182eab022925f7ae2dc47bc6b

* RN: Workaround Fabric + Virtual Text Press Bug

Summary:
Workaround for a bug with Fabric when pressing on virtual text.

Changelog:
[Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: JoshuaGross

Differential Revision: D21432793

fbshipit-source-id: fe20eeadd5365707fb71edae7a76d374e26b4c86

* Fabric: Backward-compatible behaviour of `measureInWindow` and `measure`

Summary:
Before this change, in case of incorrect measurements, Fabric's implementation of `measure` and `measureInWindow` incorrectly returned negative height and width. Now it returns zeros (as classic React Native does).

Fabric:
This does not fix `measureLayout` called for virtual nodes. This is not so trivially to fix and it will be done separately.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross, yungsters, mdvacca

Differential Revision: D21433239

fbshipit-source-id: fbaf5ee35c690506822c634daac4426542c2cdcf

* Upgrade to Yargs 15

Summary:
Only breaking changes appear to be dropped Node 6 support: https://github.com/yargs/yargs/blob/master/CHANGELOG.md. Deduplicates quite a few copies of Yargs, yay!

Changelog: [Internal]

(Note: this ignores all push blocking failures!)

Reviewed By: motiz88

Differential Revision: D21426137

fbshipit-source-id: b091e29ac2d9464d6ce9a716a99f7ae156a91a01

* Ez Extend logging of Fabric

Summary:
Quick diff to log of content of UpdateState mount item. This is useful for debugging. Note this will ONLY be logged when the constant FabricUIManager.IS_DEVELOPMENT_ENVIRONMENT is set to true

changelog: [Internal][Android] internal log for fabric android

Reviewed By: JoshuaGross

Differential Revision: D21428345

fbshipit-source-id: d000eb6dbdd39d15935fa2102072790e17372682

* Fix measureLayout function for Virtual Nodes

Summary:
This diff fixes a NullPointerException thrown when calling measureLayout function on a virtual node.

changelog: [Android] Fix measureLayout function for VirtualTexts

Reviewed By: JoshuaGross

Differential Revision: D21435030

fbshipit-source-id: aba6d81f333464e49d2d769b111842e7ae8ce769

* Update cocoapods (#28833)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28833

The checked-in RNTester podfile was generated using Cocoapods version 1.9.1. This doesn't match the version currently used in CircleCI, which is 1.8.4. In order to update the offline mirrors and land them without breaking CircleCI, it seems we need to switch back to 1.8.4. This diff updates the podfile back to 1.8.4 and updates the offline mirrors.

Reviewed By: fkgozali

Differential Revision: D21392989

fbshipit-source-id: b14aa6e2798175534e9416410ba9d6877fb718c0

* Fabric: Introducing `RunLoopObserver`

Summary:
`RunLoopObserver` is one of the core interfaces that bridge intrinsically platform-specific functionality to cross-platform React Native core. `RunLoopObserver` allows subscribing for notifications about changes in a run loop life cycle. Primarily it supposed to be used for observing UI (aka main) and JavaScript execution thread/run-loop.
Having a `RunLoopObserver` implemented in a platform-specific manner allows building these components in a cross-platform manner:
* Sync and async UI event delivery pipeline;
* Timing for some animation engine;
* Timers (probably additional features are required).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21341997

fbshipit-source-id: 7ef61fb51f550dd0f2e89c64af657e0f0de029aa

* Fabric: Cross-platform implementation of `SynchronousEventBeat` and `AsynchronousEventBeat`

Summary:
`SynchronousEventBeat` and `AsynchronousEventBeat` are a cross-platform re-implementation of run loop related parts of `MainRunLoopEventBeat` and `RuntimeEventBeat` (iOS specific classes for now). In the future, they will replace iOS- and Android-specifc event beat classes.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21341996

fbshipit-source-id: 8eda9a5df537cd666b7728e32212a8bb5ddb3ab7

* third-party | Move glog from xplat/third-party to third-party and create temporary redirect.

Summary:
Move and create an empty rule that redirects as well, to handle //arvr rules
Need to do this way, since ovrsource sync rules are in different repo.

allow_many_files
allow-large-files

Steps:
- [X] Move glog from xplat/third-party to /third-party
- [ ] Update references in ovrsource to translate to //third-party instead of //xplat/third-party
- [ ] Get rid of temporary rule
- [ ] Update fbsource/third-party/glog to 0.3.5 (what we have in ovrsource)

Changelog: [Internal] Update reference for glog from xplat/third-party to /third-party.

Reviewed By: yfeldblum

Differential Revision: D21363584

fbshipit-source-id: c1ffe2dd615077170b03d98dcfb77121537793c9

* Fix Animated type

Summary:
- Fixed typing of Animated and fixed the callsites

Changelog: [Internal]

Reviewed By: kacieb

Differential Revision: D21311870

fbshipit-source-id: 386fb496ab00ef7917273dc3eb65e1ed76a8dd33

* Add virtual destructor to JSError

Summary:
We consume Hermes through multiple .so's, which means we have multiple (weak) typeinfo definitions of facebook::jsi::JSError. Previously we were using gnustl, which would strcmp typeinfo to decide whether a certain exception handler applies, which meant this didn't cause any major issues. However since this is deprecated, we recently switched to libc++, which does not have this by behaviour (or it does, but behind a flag I'm not sure how to enable). This causes any JS exceptions to fall through from our exception handlers and fatal the app.

This problem is actually documented in the common Android NDK problems page: https://android.googlesource.com/platform/ndk/+/master/docs/user/common_problems.md#rtti_exceptions-not-working-across-library-boundaries

The suggested solution is to ensure that any exception types have a key function defined (a non-pure, out-of-line virtual function). The simplest one to add is a virtual destructor. This makes the object file that holds the implementation of the destructor export a non-weak typeinfo definition which will at load time override the other weak versions.

I'm not sure why we're the first to hit this. RN's JSIExecutor doesn't explicitly reference JSError which probably helps (https://github.com/facebook/react-native/blob/master/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp#L256-L258) and they also don't use unguarded callbacks like we do.

Changelog: [Internal]

Reviewed By: mhorowitz

Differential Revision: D21426524

fbshipit-source-id: 474284ada1ca2810045dc4402c420879447f9308

* Handle initialProps as optional in renderApplication

Summary:
Pass a default empty object to `AppContainer` if no `initialProps` were passed to `renderApplication`.

This prevents issues on Android, where we do not pass a default empty `initialProps` from native, as we do on iOS.

Changelog: [General] [Fixed] - Handle nullish `initialProps` correctly in `renderApplication`

Reviewed By: motiz88

Differential Revision: D21448692

fbshipit-source-id: 9630bdc2414532999abf3bf9da25047f0482fcab

* Enable with CocoaPods `:configuration` (#28796)

Summary:
~~⚠️ Depends on https://github.com/facebook/flipper/pull/1086 and a new Flipper release.~~
Fixes 17f025bc26 (commitcomment-38831234)

Currently user’s are being told to add a definition of the `FB_SONARKIT_ENABLED` macro and examples, including those in stock React Native templates, set this for the user by making use of a `post_install` hook in the user’s `Podfile`. This leads to confusion, fragile code [when a user’s project dir structure deviates from vanilla], and is ultimately not necessary as CocoaPods already has dedicated mechanisms to:

* specify build settings (through the `xcconfig` property);
* and selectively include certain pods only in certain build configurations (e.g. debug).

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Changed] - Entirely control Flipper being enabled through inclusion in Podfile and optionally limiting to certain build configurations using the `:configuration` directive.
Pull Request resolved: https://github.com/facebook/react-native/pull/28796

Test Plan: Tested using the changes of https://github.com/facebook/flipper/pull/1086 in a new app that uses RN `master`.

Reviewed By: priteshrnandgaonkar

Differential Revision: D21449754

Pulled By: passy

fbshipit-source-id: 9ff7c7f4ffc32b364b1edd82b94e0b80c3997625

* Support excluding multiple platforms.

Summary:
Currently the schema only allows to exclude a single platform (iOS OR Android). There are cases where we need to exclude multiple. This change converts the previous `excludePlatform` string property into an `excludePlatforms` array.

Changelog:
[Internal][Changed] - Added support to exclude multiple platforms in Codegen.

Reviewed By: sammy-SC

Differential Revision: D21426950

fbshipit-source-id: eff36ffa207109274794b4b300bf6313f8286161

* Extend ParagraphAttribute to store the includeFontPadding prop

Summary:
This diff extends the ParagraphAttribute class to store the value of the includeFontPadding prop.
Note that this is an Android only prop, I'm not creating android blocks to improve "cleanliness" of the code.

changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric

Reviewed By: shergin

Differential Revision: D21446738

fbshipit-source-id: 0543e86aa18ce10f7a56bbaafe111cce0179ea86

* Extend Text measurement to support includeFontPadding prop

Summary:
This diff exposes the Text.includeFontPadding prop to java, then it uses the prop to calculate the height of Text components correctly.

changelog: [Internal][Fabric] Internal change in Fabric to support Text.includeFontPadding prop in fabric

Reviewed By: shergin

Differential Revision: D21446737

fbshipit-source-id: efe73fb6b0d402c3275ac8c012fa8fa06b743bdd

* Small refactor on text measure method

Summary:
Quick refactor of TextLayoutManager class

changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21446736

fbshipit-source-id: a32bdf534b167e128c8c0054cf6a126131fa740a

* Handle optional return types/values

Summary:
Use folly to wrap optional return types and values as needed.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D21395439

fbshipit-source-id: a0e84e20717887e79a8565332a11fef42ebd3487

* Avoid redefining id when a property is named 'id'

Summary:
Handle properties named 'id' as a special case.

An example of a native module that ran afoul of this is `ExceptionsManager`.

Observe how the ExceptionsManager spec at `Libraries/Core/NativeExceptionsManager.js` defines the ExceptionData type as containing an `id` property:

```
export type ExceptionData = {
  message: string,
  originalMessage: ?string,
  name: ?string,
  componentStack: ?string,
  stack: Array<StackFrame>,
  id: number,
  isFatal: boolean,
  // flowlint-next-line unclear-type:off
  extraData?: Object,
  ...
};
```

Prior to this change, the generated code would redefine id in the SpecReportExceptionData struct...

```
 namespace JS {
   namespace NativeExceptionsManager {
     struct SpecReportExceptionData {
       // ...redacted...
       double id() const; <---
       // ...redacted...

       SpecReportExceptionData(NSDictionary *const v) : _v(v) {}
     private:
       NSDictionary *_v;
     };
   }
 }
```

...which would result in a build time error:

```
 inline double JS::NativeExceptionsManager::SpecReportExceptionData::id() const
 {
   id const p = _v[@"id"];
   ^--- build time error here
   return RCTBridgingToDouble(p);
 }
```

Comparing the above example  with the currently checked in `FBReactNativeSpec.h`, I see the expected output should be:

```
 namespace JS {
   namespace NativeExceptionsManager {
     struct SpecReportExceptionData {
       // ...redacted...
       double id_() const;
       // ...redacted...

       SpecReportExceptionData(NSDictionary *const v) : _v(v) {}
     private:
       NSDictionary *_v;
     };
   }
 }
```

...and...

```
inline double JS::NativeExceptionsManager::SpecReportExceptionData::id_() const
 {
   id const p = _v[@"id"];
   return RCTBridgingToDouble(p);
 }
```

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D21395463

fbshipit-source-id: e412648013ff9f70ebd294b6f5f81f1faccb4604

* Eager initialize Fabric Android classes

Summary:
This diff eager initializes Fabric Android classes. This should help load all the Fabric classes at Bridge load time.

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21460507

fbshipit-source-id: 4b8d5c4e2d19e3a7eb3077027071e64ff16f1cbd

* Remove Hermes.setPauseOnLoad message

Summary:
This removes the Hermes.setPauseOnLoad. It will be replaced by the more standard
Debugger.setInstrumentationBreakpoint's "beforeScriptExecution" event.

ChangeLog: [Internal] Remove Hermes.setPauseOnLoad message (to be replaced)

Reviewed By: mhorowitz

Differential Revision: D21418219

fbshipit-source-id: 93c53801c23487f9336b322c2bd737663ec21b97

* Add support for Debugger.setInstrumentationBreakpoint

Summary:
This diff adds support for the "beforeScriptWithSourceMapExecution" instrumentation
breakpoint via "Debugger.setInstrumentationBreakpoint".

CDP describes it as a breakpoint, but we just set a flag in the inspector. A
fake breakpoint ID is synthesized for optional removal later.

Changelog: [Internal] Add Debugger.setInstrumentationBreakpoint to Hermes Inspector

Reviewed By: mhorowitz

Differential Revision: D21418218

fbshipit-source-id: 90fa49c0954980993815322d3a7effee416ed5db

* label react-native-github targets

Summary:
For internal code attribution.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D21468924

fbshipit-source-id: 59cd2a52e0ae46bedbf54816820a5f40b684da8b

* Add script to generate native modules specs with react-native-codegen

Summary:
Adds a script that uses `react-native-codegen` to generate FBReactNativeSpec.
The generated output should not be considered ready for production use at this time.
The goal of adding this script at this time is to demonstrate the current status of native modules specs code generation in open source.

For example, the generated output may be used in RNTester, with some modifications due to some naming differences in react-native-codegen's output when compared to the FBReactNativeSpec files generated by the old codegen.

Usage:

```
./scripts/generate-native-modules-specs.sh ./codegen-out
```

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21471004

fbshipit-source-id: 5ff3c57807d9ba2c91dc7fe32d227d218732b059

* Update .gitignore (#28789)

Summary:
When you profile your heap and memory allocations with Memory Profiler, files with *.hprof extension are created in /android folder that has big sizes (up to 600 MB for each). These files may be needed to add to gitignore.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Added] - Add *.hprof files to gitignore
Pull Request resolved: https://github.com/facebook/react-native/pull/28789

Differential Revision: D21432927

Pulled By: hramos

fbshipit-source-id: a20f12645de5ca0874c9130094e2f97fe16b2203

* Codegen: Add prepublish script to build Flow files (#28827)

Summary:
*This is a follow-up to https://github.com/facebook/react-native/issues/28645, redone using a build script based off of Metro's build script instead of using `flow-remove-types` and `flow-copy-source`.*

This pull request adds a build step to `react-native-codegen` that builds the Flow-annotated JS files so that users of the NPM module `react-native-codegen` do not need to use require hooks to be able to import it.

A new build script, `scripts/build.js` is added that builds every JS file in `src/` into a `lib/` folder, and also copies over the original Flow annotated files to `lib/` with a `.js.flow` extension, so users of `react-native-codegen` can still typecheck against it using Flow. The shell scripts in `src` are also copied over. It is based off of the [build script from Metro](00867816eb/scripts/build.js)

## Changelog

[General] [Added] - Codegen: Add prepublish script to build Flow files
Pull Request resolved: https://github.com/facebook/react-native/pull/28827

Test Plan:
I am able to make use of the Codegen scripts without needing to use the `flow-node` CLI or the `flow-remove-types/register`
require hook.

Reviewed By: cpojer

Differential Revision: D21412173

Pulled By: hramos

fbshipit-source-id: 26ae67cdd04652ca4700a069a234a25558773cb1

* Remove RCTLogError from RCTScrollViewManager.calculateChildFrames

Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21483553

fbshipit-source-id: 0c681979a4988c36cfa6f05aa5bca896590f9e3d

* Enable animations in bridgeless mode on iOS

Reviewed By: ejanzer

Differential Revision: D21465166

fbshipit-source-id: b34e8e97330b897e20d9a4b05dba1826df569e16

* Expose RuntimeExecutor on CatalystInstance (#28851)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28851

This diff creates a RuntimeExecutor that uses the bridge and exposes it on CatalystInstanceImpl.

Changelog: [Internal]

Reviewed By: mdvacca, RSNara

Differential Revision: D21051949

fbshipit-source-id: b3977fc14fa19089f33e297d29cedba0d067526d

* Inject ImagePipeline into FrescoModule

Summary:
This diff refactors the FrescoModule in order to receive an ImagePipeline as a parameter. This is necessary to ensure the same ImagePipeline is used by every RN module

changelog: [Internal][Android]

Reviewed By: JoshuaGross

Differential Revision: D21428346

fbshipit-source-id: 70a6cc57c8585fe74b6d0b0d1fd86c539974ec23

* Fabric: Calling JSVM GC on memory pressure event on iOS

Summary:
This change is especially important for Fabric when a lot of objects (mostly `ShadowNode`s) have shared ownership. Without this change, JSVM could not know that bunch of natively allocated objects should be deallocated.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: dulinriley

Differential Revision: D21484773

fbshipit-source-id: 46e32de0f108082e60df346884c9287023156149

* TextInput: Default `blurOnSubmit` in JS

Summary:
Consolidates the logic for the default value of `blurOnSubmit` on `TextInput` in the JavaScript component.

This only materially impacts Fabric.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D21491482

fbshipit-source-id: 16d8aba32e7d0321a4583e87e03405ea587e35d4

* Fix taps not working after scrolling / scroll position not being updated in C++

Summary:
Problem: ScrollView offset was not being reported to the C++ ScrollView side of Fabric.
This results in taps not working correctly, for example if you tap a button inside scroll view after you scrolled, the tap might not trigger anything.
The root cause of this is our implementation of detecting whether scroll view has stopped scrolling.
To make this more robust, I now require that multiple "frames" have not scrolled because it's easy to trigger race conditions by scrolling very fast.
We also explicitly call `updateStateOnScroll` in a couple more places.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21496396

fbshipit-source-id: 2e565dd2fc4fc1ce582daa8a449c520e7cb19be0

* Fabric: Changes in UIManager::getNewestCloneOfShadowNode to make it safer

Summary:
There is no need to use a raw pointer to a shared pointer as a return value of `UIManager::getNewestCloneOfShadowNode`. If it would be a very hot path, we could you a raw pointer to the node instead but it's not a hot path.
Prooving that using a raw pointer here is safe is quite complex (and I don't know if it's safe or not). So, I changed it to just a shared pointer.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D21464833

fbshipit-source-id: 813a3c9fca0147afb322db6855a0ce8fd2d47909

* Fabric: Making `UIManager::getRelativeLayoutMetrics` safer

Summary:
In this method we have to maintain a retaining pointer to the node in order to access it as a raw pointer.
See also a comment in the codee.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross

Differential Revision: D21464834

fbshipit-source-id: 69f6894009509e5feca291fab12c019208933816

* Fabric: Making `UIManager::getNewestCloneOfShadowNode` even more safer

Summary:
We cannot use a raw pointer here because the tree might progress right after we call to `shadowTree.tryCommit` and we will get a dangling pointer as a result.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21464832

fbshipit-source-id: 3998b39d29db672da54d4adcb6be55cd3d44d862

* Fabric: Checks for corner cases in UIManager::getNewestCloneOfShadowNode

Summary:
We should check for corner cases.
Another interesting detail is behavior. Now (and previously) we return nullptr if case we could not find the most recent node. But maybe we should return the given node instead?

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21480874

fbshipit-source-id: bb943c4508ec025316a3665d652e4b5e06dd795c

* OSS: fixed incorrect license headers on some files

Summary:
de667fffa4 (commitcomment-39068402) had incorrect license headers. This fixed them.

Changelog: [General] [Fixed] - fixed license headers on some files

Reviewed By: cpojer

Differential Revision: D21496796

fbshipit-source-id: f9d6b0cf4af0ecf6caacbae2396d73efbc4975fe

* Fabric: Fixed incorrect name of the prop value `justifyContent=space-between`

Summary:
The name of the value was incorrect.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21496651

fbshipit-source-id: 464c98436bb8d5f2b6275b7eab1c32d187e2b23c

* Fabric: Initializing EventBeat::OwnerBox with non-null value ahead of time

Summary:
We use `EventBeat::OwnerBox` in the `EventBeat` infra to represent weak ownership of classes that contain that, so those classes can ensure own life-time at some critical points.
Before this diff, we stored a pointer to EventDispatcher right after we create it. However, some components that we build require to have a valid pointer from the beginning (even before the EventDispatcher is created). To satisfy this requirement, we create a dummy pointer first and use it as an owner, then we merge (share control block) the pointer to an EventDispatcher into that. It works because the owner pointer never gets dereferenced (it's `void *`), so it does not matter which object it represents while it represents correct ownership.

In the future, this approach will allow us to remove the concept of `OwnerBox` completely and use just `std::weak_ptr<void>` instead.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21441109

fbshipit-source-id: 7457c77bd31cd577f38a26e28e27eb7e33b6ad24

* Fabric: Using `PlatformRunLoopObserver` instead of `MainRunLoopEventBeat` and `RuntimeEventBeat` on iOS (gated)

Summary:
This diff implements iOS-specific `PlatformRunLoopObserver` (and `MainRunLoopObserver`) that then being glued together with `SynchronousEventBeat` replaces `MainRunLoopEventBeat`, and then same thing glued with `AsynchronousEventBeat` replaces `RuntimeEventBeat`.

So, instead of two platform-specific classes we had on iOS (for that needs), now we have only one (that can be reused for a more broad variety of applications).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21341998

fbshipit-source-id: fafde4e678770f7fcf9c1ff87acc02812a37e708

* Fix skewX/skewY/perspective/matrix on iOS (#28863)

Summary:
See discussion on c68195929b (commitcomment-38965326)

This PR fixes skewX/skewY/perspective/matrix on iOS as seen on this video: https://youtu.be/LK9iOKk62nw?t=115

## Changelog

[iOS] [Fixed] Bug with skewX/skewY/perspective/matrix transforms.
Pull Request resolved: https://github.com/facebook/react-native/pull/28863

Test Plan:
Try that the following transform as been fixed on iOS

```tsx
<View
  style={{ transform: [{ rotateZ: Math.PI / 2}, { skewX: Math.PI/6 }] }}
/>
```

Differential Revision: D21493022

Pulled By: shergin

fbshipit-source-id: 4bf3550941e8acd8fdb87fe1143b21639c95b059

* Fix skewX on Android and in the JS decomposition (#28862)

Summary:
This issue fixes https://github.com/facebook/react-native/issues/27649.

By using 2d decomposition that transforms a skewX into a rotate/scale/rotate, the skewX issue on Android was still there which made me suspect that the issue came from the decomposition algorithm. Then I noticed that the bug existed in the JavaScript decomposition as well which led me to a fix on the JS and therefore on the Android side most likely.

## Changelog

[Android] [Fixed] skewX transforms
Pull Request resolved: https://github.com/facebook/react-native/pull/28862

Test Plan:
Check that skewX works on Android.
On JS, making sure that processTransform() doesn't skip, you can try the following sequence:

```tsx
  const matrix = processTransform([{ skewX: `${Math.PI / 3}rad` }]);
  const result = MatrixMath.decomposeMatrix(matrix);
  console.log({ result });
```

Differential Revision: D21493021

Pulled By: shergin

fbshipit-source-id: 89f7aca5fbfd0f0f8c6f90a26bd76bf8550acaa5

* implemented showSoftInputOnFocus for iOS (#28834)

Summary:
`showSoftInputOnFocus` was added in https://github.com/facebook/react-native/issues/25028, but it was only added for Android. There was a lot of discussion on the original issue being addressed (https://github.com/facebook/react-native/issues/14045), that there is a need for this on iOS as well. The issue with iOS was brought up again on https://github.com/facebook/react-native/issues/27243.

On a related note, when searching this repo's issues for `showSoftInputOnFocus`, it appears that there are several closed issues that claim that the Android implementation doesn't work (https://github.com/facebook/react-native/issues/25685, https://github.com/facebook/react-native/issues/25687, https://github.com/facebook/react-native/issues/26643). So perhaps the Android implementation needs to be looked at as well (I myself have not gotten around to confirming whether it works or not)

## Changelog

[iOS] [Added] - Add showSoftInputOnFocus to TextInput
Pull Request resolved: https://github.com/facebook/react-native/pull/28834

Test Plan:
You'd use this just like you would in the Android implementation:
```jsx
<TextInput showSoftInputOnFocus={false} />
```

## GIFs
### Before change
![May-04-2020 20-52-49](https://user-images.githubusercontent.com/4932784/81034028-9d89cf80-8e4a-11ea-906c-64f62504f80c.gif)

### After change
![May-04-2020 20-54-27](https://user-images.githubusercontent.com/4932784/81034035-a11d5680-8e4a-11ea-918e-119a1c9e2a19.gif)

Differential Revision: D21418763

Pulled By: shergin

fbshipit-source-id: 561e72fc2cf16b30446132f6b96b8aa2b4a92daf

* Fabric: Support for sync `RuntimeExecutor` in `executeSynchronouslyOnSameThread_CAN_DEADLOCK`

Summary:
The approach is quite simple: we check the thread id, and if it matches the caller thread id, we unlock mutexes which lead to the normal uninterrupted execution flow.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: RSNara

Differential Revision: D21328313

fbshipit-source-id: 4290b8a0357dbad3563d7da9464c03ecce5ded7c

* Use plugin architecture for Paragraph component

Summary:
Leverage plugin infra for `Paragraph`

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21404704

fbshipit-source-id: 7565014f1d88c4a0a47e0f10fdb3656b8276b1d0

* Use plugins for TextInput component

Summary:
Leverage plugin infra for `TextInput`

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21407584

fbshipit-source-id: 48b1a69aa834ab956724e6617197da57ccf99aa7

* Use plugins for View component

Summary:
Leverage plugin infra for `View`

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21407611

fbshipit-source-id: d72d1e75bbd9d06c79544437bdd88f890086c587

* Move SegmentedControl components to separate file and make them function based

Summary: Changelog: [Internal] Separate SegmentControl examples into separate file and make them functional based

Reviewed By: mdvacca

Differential Revision: D21475596

fbshipit-source-id: 19165232f2a8edefa66f122944621f93265ff704

* Add comments to a test case in LayoutableShadowNodeTest

Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21500371

fbshipit-source-id: daec07f82f43aae9cdc31f67599e30873ca108b9

* xplat code ownership

Summary:
For internal code attribution.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D21496969

fbshipit-source-id: 9fa27a758df19c16fd2087ce964132eaa70dc91f

* Always run the momentum scroll Runnable so scroll position is updated on Fabric

Summary:
This early return is a very minor perf optimization, and it complicates things on Fabric: if scroll perf logging is disabled, the scroll position in C++ (State) doesn't get updated for the scrollview.

Just remove it. Always run the Runnable, no matter what.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D21503695

fbshipit-source-id: 13dfe232d692ff544bff725a2344a66b572f5444

* Use UIManagerHelper to access EventDispatcher in ReactViewManager

Summary:
ReactViewManager uses the bridge (CatalystInstance) to access the UIManagerModule in its onClick method. This doesn't work in bridgeless mode, so I'm replacing this callsite with the new API, which uses UIManagerHelper + the reactTag to look up the appropriate UIManager (Paper or Fabric), and get the EventDispatcher from that.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21510243

fbshipit-source-id: c2c6111e73c49ca6bf873819db8ece71c66417e4

* Mention using bundler to install cocoapods in RNTester README (#28873)

Summary:
This makes sure the proper version of cocoapods gets used, this will avoid noise in diffs if someone ends up updating pods with a different version.

## Changelog

[Internal] [Changed] - Mention using bundler to install cocoapods in RNTester README
Pull Request resolved: https://github.com/facebook/react-native/pull/28873

Test Plan: N/A

Differential Revision: D21519862

Pulled By: shergin

fbshipit-source-id: 3dc555bc3aee6bee10127ba5b5862302a63346c4

* Break retain cycle in RCTLegacyViewManagerInteropCoordinator

Summary: Breaks retain cycle by having weak reference to bridge.

Reviewed By: shergin

Differential Revision: D21501419

fbshipit-source-id: 7526ceefceb59e296c6f4944cac5069cb62b33a5

* Migrate Android view managers to type-safe commands generated by JS codegen

Summary:
## Changelog:

[General] [Changed] - Migrate Android view managers to type-safe commands generated by JS codegen.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D21406461

fbshipit-source-id: 93584b240314254675a36a58c4d0c0880d6889fb

* Add package name / bundle ID to bundle URL in development

Summary:
Adds the package name (Android) / bundle ID (iOS) as a new URL parameter named `app` in the bundle URL. This currently has no effect on Metro, which will ignore it for bundling / caching purposes.

Changelog: [General] - Add package name / bundle ID to bundle URL in development

Reviewed By: cpojer

Differential Revision: D21429764

fbshipit-source-id: 394fe50dba72219f7594ebeac9486a8264a836a6

* Forward all bundle URL params through HMR and bundle splitting

Summary:
Forwards any extra parameters set on the main bundle URL (in development) to the derived bundle URLs used in hot reloading and bundle splitting.

Changelog: [General] - Forward URL parameters from main bundle to hot reloaded bundles

Reviewed By: cpojer

Differential Revision: D21455592

fbshipit-source-id: e1c375e3b6a0f3387372f1d96498dbf7d5237a09

* imp: Add titlePlaceholder in template.config.js (#26218)

Summary:
In the latest `react-native-cli` we've added more flexibility for setting application title. New config key was introduced - `titlePlaceholder` - which will be changed during init process.

PR: https://github.com/react-native-community/cli/pull/650

## Changelog

[General] [Added] - Introduce `titlePlaceholder` for template configuration.
Pull Request resolved: https://github.com/facebook/react-native/pull/26218

Test Plan: Initialization works with the default template

Differential Revision: D17091492

Pulled By: shergin

fbshipit-source-id: 239110f2ad6f817d750575fa366ab49d146b36c1

* Fix opacity not being animated on Text component

Reviewed By: shergin

Differential Revision: D21523725

fbshipit-source-id: 80be40fd1314b7e1cbaa827ca52f917ba5bc916e

* Download image of size based on image view size, not image size

Summary:
Changelog: [internal]

Fabric asks server for images of their real size and scale, not images of size that they would take up on the screen once rendered. Also scale of the screen is incorrect. This causes images to be twice as large as they have to be.

Look at the size of the first image size here in Paper, it is `{310.5, 207}`.
{F235394066}

If you compare it with Fabric, there it is `{800, 381}`
{F235394115}

It isn't just the size, but scale of request image as well. Fabric always asks for image of scale 1, unlike Paper which takes screen scale into account.

Reviewed By: shergin

Differential Revision: D21255794

fbshipit-source-id: 9db3ccafec1c09cedc5db5ac0a435a28a4c30c85

* Fabric: Fixed incorrect memory management in Scheduler

Summary:
The previous implementation was incorrect causing a memory leak. In the new approach, we use a shared pointer to optional to be able to construct that ahead of time and then fill with actual value.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21516794

fbshipit-source-id: ddcbf8a1ad2b1f629ae4ff2842edeb7bb2a275a6

* Fixing typo in comment (#28882)

Summary:
I was reading the code and noticed the typo.

## Changelog

Doesn't affect the code.

[General] [Fixed] - Message
Pull Request resolved: https://github.com/facebook/react-native/pull/28882

Differential Revision: D21529436

Pulled By: shergin

fbshipit-source-id: 82929a6f1fe7b5510ee17fff547aae9d5125891c

* iOS: Fix Animated image crash when CADisplayLink target in RCTWeakProxy is nil

Summary:
## Problem
When self is nil, this may crash in RCTUIImageViewAnimated.m.

```
_displayLink = [CADisplayLink displayLinkWithTarget:[RCTWeakProxy weakProxyWithTarget:self] selector:selector(displayDidRefresh:)];
```

## Fix

Replace `RCTWeakProxy` with a concrete class `RCTDisplayWeakRefreshable` that has the displayDidRefresh method, that calls the displayDidRefresh method in its weak target.

### Original Github Issue
https://github.com/facebook/react-native/pull/28070#issuecomment-619295254

Changelog: [iOS] [Fixed] -  Fix Animated image crash when CADisplayLink target in RCTWeakProxy is nil

Reviewed By: shergin

Differential Revision: D21419385

fbshipit-source-id: da7c3c38f81ea54f633da7f59359e07680ea2faf

* Disable animations on Android again

Summary: We don't yet have native driver support for animations in bridgeless mode on Android, which leads to some weird bugs (like an overlay that never disappears). Let's just disable animations on Android again.

Reviewed By: mdvacca

Differential Revision: D21537982

fbshipit-source-id: b4e8882a414fecbd52dd25e02325b5c588ee68c0

* Get redbox working in bridgeless mode, disable logbox

Summary: This enables redbox in bridgeless mode, by removing a dep on the bridge. It also disables full screen logbox, since I couldn't figure out how to get it working without the bridge.

Reviewed By: rickhanlonii, ejanzer

Differential Revision: D21440233

fbshipit-source-id: cb1730fefe1639135fdf06039031975d53f95229

* Add dark mode to loading progress

Summary:
This diff updates the loading banner to respect the RCTAppearance dev mode setting.

Changelog: [General] [iOS] Add dark mode support to loading banner

Reviewed By: fkgozali

Differential Revision: D21429148

fbshipit-source-id: d7d9e778245112a19accf813dcff693f0d187a38

* Cleanup logbox imports

Summary:
Was looking at removing logbox from CoreModules, realized it had a bunch of extra deps.

Changelog: [Internal]

Reviewed By: rickhanlonii

Differential Revision: D21535374

fbshipit-source-id: 2427cc66fa34635b49ac4b4fafaf0b6481f5687d

* Fix precision of TextInlineViews in Android

Summary:
TextInlineViews in Android was incorrectly converting values to from float to int, this produced to loose precision and to render incomplete texts in some components.
This diff changed the types from int to float, avoiding loose precision.

The impact of this bug is not that high because in the conversion to int we were using Math.ceil(), which was already rounding the result to the next pixel.

changeLog: [Android][Fixed] Fix precision of TextInlineViews in Fabric Android

Reviewed By: JoshuaGross, shergin

Differential Revision: D21541159

fbshipit-source-id: 4741ab96964c35af1c1b7d3e821e505ecef2efce

* When debugger is attached continue to receive console messages

Summary:
I noticed an issue when the hermes debugger was attached. Console messages would no longer appear in the terminal. This is because the hermes inspector overrides the console object with its own to intercept messages and send them to the debug client.
With this change I made it so that messages are sent to the original console as well instead of completely replacing it.

Changelog:
[General][Fixed] - When Hermes debugger is enabled continue to send log messages to the console

Reviewed By: mhorowitz

Differential Revision: D21509895

fbshipit-source-id: 6d91c4b82682e404679533be14b3e5f12e687e79

* Add support for ScrollView.centerContent in Fabric

Summary:
Changelog: [Internal]

ScrollView didn't support centerContent prop. The implementation is copied over from Paper.

I added an example of this prop in RNTester.

Reviewed By: JoshuaGross

Differential Revision: D21548270

fbshipit-source-id: 28f6c8d769c5a6bc1d111b33970a06b95c259132

* Pressable: Rename pressRectOffset to pressRetentionOffset to be consistent with other touchables

Summary:
Text and the other Touchables have this prop called pressRetentionOffset. Pressable should be consistent with that.

Changelog:
[Breaking][General]: Pressable: Rename pressRectOffset to pressRetentionOffset to be consistent with other touchables

Reviewed By: yungsters

Differential Revision: D21552255

fbshipit-source-id: 31e64bad9e48ac98e4934dd2f4c0a7f526de5cb6

* Back out "Fabric: Calling JSVM GC on memory pressure event on iOS"

Summary:
Reverted for now because it causes a crash.

Original commit changeset: 46e32de0f108 (D21484773)

Changelog: [Internal]

Reviewed By: sammy-SC, kacieb

Differential Revision: D21555488

fbshipit-source-id: 555a143fe8cf4c8806d910803f104271454f5797

* LayoutAnimations: have each Props struct do its own interpolation

Summary:
Each ComponentDescriptor becomes capable of doing its own interpolation over props for animation purposes.

This new custom interpolator is called by default by the ConcreteComponentDescriptor, but `ComponentDescriptor::interpolateProps` is a virtual function and each ComponentDescriptor can provide custom interpolation if necessary.

For now, only View does any actual interpolation, to support LayoutAnimations.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D20965310

fbshipit-source-id: e1c1588107848e94c155efecb0da1cc1619ae544

* Extend ReactShadowNode API to expose flex props

Summary:
This diff extends the ReactShadowNode API to expose flex props, this is going to be used by some components that require access to it

changeLog: [Android][Added] Exposed getFlex method as part of ReactShadowNode API

Reviewed By: JoshuaGross

Differential Revision: D21554663

fbshipit-source-id: 26c9a3fe5f72a84120b16b553ab08231817c0efa

* Fabric: Unifying interface of stub TextLayoutManager with actual ones

Summary:
The interface of css/TextLayoutManager now matches acual platform-specific implementations, so now CXX tests compiles and usable.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21518656

fbshipit-source-id: cece3bea14c70410eea22abafb424f7a2cb201c0

* Delete playTouchSound from UIManagerModule

Summary:
This diff deletes the deprecated PlayTouchSound method from UIManagerModules.

I verified there are no callsites of this method in Facebook sourcecode

changelog: [BREAKING][Android] Deletes the method PlayTouchSound method from UIManagerModule, this method was moved to the SoundManagerModule class.

Motivation: I'm cleaning up my fabric backlog before lockdown

Reviewed By: JoshuaGross, TheSavior

Differential Revision: D21487612

fbshipit-source-id: f630e2b7f927e0b607a30b9f4904feb63a561ab9

* Revisit deprecated methods in UIManagerModule and update javadoc

Summary:
Ez diff that revisits deprecated methods in UIManagerModule and update javadoc

Motivation: I'm cleaning up my fabric backlog before lockdown
changelog: [Android] Update documentation of UIManagerModule methods

Reviewed By: JoshuaGross

Differential Revision: D21487609

fbshipit-source-id: 896ae21e02d5b1aa57b7158d714986fd1f8c9c5c

* Fix dev tool hotkets in RNTester

Summary:
This diff fixed hotkeys for dev tools like cmd+d, cmd+r, and cmd+i when Turbo Modules are enabled until we have a proper way to eagerly initialize turbo modules.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D21517482

fbshipit-source-id: 8c68bc126361aa961a4f05c93dc19ada32fe44c7

* Introduce NativeModulePerfLogger

Summary:
## Description
This diff introduces `NativeModulePerfLogger`, its BUCK, Cocoapod, android-ndk targets. This diff also wires up those targets into the React Native bridge and TurboModules targets, so that we get signal on if the code compiles.

This diff also introduces `TurboModulePerfLogger`, which is a namespace that holds the `NativeModulePerfLogger` that'll do perf-logging for TurboModules.

## How will perflogging work on iOS?
1. Each application will, during React Native initialization, create a NativeModule perf logger.
2. If TurboModules are enabled, we'll call `TurboModulePerfLogger::setInstance(perfLogger)`. If TurboModules are disabled, we'll call `NativeModulePerfLogger::setInstance(perfLogger)`.
3. TurboModules, when they're created and used, will log events via `TurboModulePerfLogger::getInstance()`. NativeModules (i.e: bridge modules), when they're created and used, will log events via the `NativeModulePerfLogger::getInstance()`.

> **Note:** The NativeModule system will log events for non-TurboModules as well. Maybe we should log events for only NativeModules that conform to the `TurboModule` interface, when TurboModules are disabled. This'll ensure a fair comparison between the two systems.

## How will perflogging work on Android?
Please see the subsequent diff.

allow-large-files

Changelog:
[Both][Added] - Introduce `NativeModulePerfLogger`

Reviewed By: PeteTheHeat

Differential Revision: D21318053

fbshipit-source-id: 6ddf5b5a80bdc4076d2dd6588067e2b0ec8c2c6b

* Switch TurboModules over to NativeModulePerfLogger

Reviewed By: PeteTheHeat

Differential Revision: D21363243

fbshipit-source-id: 9836b6651107c924ab9ab8e1ed73b156aed58d9f

* Instrument RCTModuleData create

Summary:
`RCTModuleData` holds our NativeModule classes/objects. This diff instruments `RCTModuleData` create.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D21415433

fbshipit-source-id: 7738f763c185e20f756d9bb2eff4a9493cde74e8

* Instrument module create

Summary:
`RCTModuleData instance` is the entry-point for creating and initializing NativeModules on iOS. This diff instruments module-create for the legacy NativeModule system.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D21415435

fbshipit-source-id: 8554e41cba9105ef528a9a63c49042b99ebf8751

* Instrument JS requires

Summary:
This diff instruments two markers:
- JSRequireBeginning: From the start of the JS require to when we start creating the platform NativeModule
- JSRequireEnding: From the end of platform NativeModule create to the end of the JS require

In order to accomplish this, I had modify `ModuleRegistry::ModuleRegistry()` to accept a `std::shared_ptr<NativeModulePerfLogger>`. I also had to implement the public method `ModuleRegistry::getNativeModulePerfLogger()` so that `JSINativeModules` could start logging the JS require beginning and ending.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D21418803

fbshipit-source-id: 53828817ae41f23f3f04a95b1d3ac0012735da48

* Instrument async method call batch preprocessing

Summary:
NativeModule async method calls are queued up on the JS side, and flushed to C++ on every Native -> JS call. Before we execute the batch of async NativeModule method calls, we convert it (a JS object) from a `jsi::Value` to a `folly::dynamic` object in `JSIExecutor::callNativeModules`. Then, in `JsToNativeBridge::callNativeModules`, we convert this `folly::dynamic` object into an `std::vector<MethodCall>`, before finally looping over these `MethodCall`s and invoking each NativeModule async method call.

The markers I'm adding in this diff measure this `jsi::Value -> folly::dynamic -> std::vector<MethodCall>` pre-processing.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D21435455

fbshipit-source-id: 4c5a9e2b73c1a2a49d7a8f224a0d30afe3a0c79c

* Instrument sync and async method calls (#28893)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28893

`JSIExecutor::callSerializableNativeHook` converts the arguments from `JSI::Value` to `folly::dynamic`. Then, `RCTNativeModule` converts the arguments from `folly::dynamic` to ObjC data structures in its `static invokeInner` function.

Therefore, I decided to start the sync markers inside `JSIExecutor::callSerializableNativeHook`, which required me to expose these two methode `ModuleRegistry::getModuleName` and `ModuleRegistry::getModuleSyncMethodName`. This shouldn't modify performance because we eagerly generate a NativeModule's methods when it's first required. So, at worst, this is doing a cache lookup.

Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D21443610

fbshipit-source-id: 67cf563b0b06153e56e63ba7e186eea31eafc853

* Remove branching for optimized differ QE

Summary: Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21556312

fbshipit-source-id: 0d6d275de2d691cb42e5e70e5bf19bcc983cae12

* throw std::logic_error instead of aborting the process and convert to java exception

Summary: Changelog: [Internal][Yoga] throw std::logic_error instead of aborting the process and convert to java exception for jni layer

Reviewed By: pasqualeanatriello

Differential Revision: D21301235

fbshipit-source-id: 148b27920e62990a271e1d0df8c85a2cc42f4fd4

* Add support for ScrollView.contentOffset

Summary:
Changelog: [Internal]

Fabric's scrollview didn't have `contentOffset` implemented.

Reviewed By: JoshuaGross

Differential Revision: D21573179

fbshipit-source-id: 258c1cfa3398336f74d7ab033d90edcec7095292

* Use east const in ScrollViewProps

Summary:
Changelog: [Internal]

For consistency, switching west const to east const.

Reviewed By: JoshuaGross, mdvacca

Differential Revision: D21574239

fbshipit-source-id: eb3459c63f731f51b24f40f9f80b574661ffd935

* Use vector.empty() to check for emptyness

Summary:
Changelog: [Internal]

Using `empty()` vs `size() == 0` or `size() > 0`.
It is a more semantic way to check whether container is empty or not.

Reviewed By: JoshuaGross

Differential Revision: D21573183

fbshipit-source-id: b83283f687432a037941852114717a0f014e28db

* Support interpolating `transform` View property

Summary:
For Fabric LayoutAnimations, we need to support interpolating the Transform property (which really ends up just being interpolation of ScaleX, ScaleY, or ScaleXY transforms - not arbitrary matrices).

To support that, we need to be able to convert Transform back to folly::dynamic, and on the Java side we need to support accepting arbitrary matrices instead of transform maps of properties.

Changelog: [Internal] Fabric-only changes

Reviewed By: sammy-SC

Differential Revision: D21564590

fbshipit-source-id: b137f659b27e4b8fae83921a28ccf46035e18651

* Rename <ReactCommon/NativeModulePerfLogger.h> to <reactperflogger/NativeModulePerfLogger.h>

Summary:
## Motivation
This rename will fix the following CircleCI build failures:
- [test_ios_unit_frameworks](https://circleci.com/gh/facebook/react-native/150473?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)
- [test_ios_detox_frameworks](https://circleci.com/gh/facebook/react-native/150474?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)

## Investigation
We have 4 podspec targets that map to the same header namespace (i.e: `header_dir`) `ReactCommon`:
- **New:** `React-perflogger`: Directory is `ReactCommon/preflogger`, and contains `NativeModulePerfLogger.{h,cpp}`.
- `React-runtimeexecutor`: Directory is `ReactCommon/runtimeexecutor`, and contains only `RuntimeExecutor.h`
- `React-callinvoker`: Directory is `ReactCommon/callinvoker`, and contains only `CallInvoker.h`
- `ReactCommon/turbomodule/core`: Directory is `ReactCommon/turbomodule`, and contains C++ files, as well has header files.

**The problem:**
We couldn't import headers from `React-perflogger` in `ReactCommon/turbomodule/core` files.

**The cause:**
I'm not entirely sure why, but I was able to discern the following two rules by playing around with the podspecs:
1. If your podspec target has a cpp file, it'll generate a framework when `USE_FRAMEWORKS=1`.
2. Two different frameworks cannot map to the same `module_name` or `header_dir`. (Why? No clue. But something breaks silently when this is the case).

So, this is what happened when I landed `React-perflogger` (D21443610):
1. The TurboModules code generates the `ReactCommon` framework that uses the `ReactCommon` header namespace.
2. `React-runtimeexecutor` and `React-callinvoker` also used the `ReactCommon` header namespace. However, neither generate a framework because of Rule 1.
3. When I comitted `React-perflogger`, I introduced a second framework that competed with the `ReactCommon` framework (i.e: TurboModules code) for the `ReactCommon` header namespace. Rule 2 violation.

## Thoughts on renaming
- `<perflogger/NativeModulePerfLogger.h>` is too generic, and the `perflogger` namepsace is used internally within FB.
- `<react/perflogger/NativeModulePerfLogger.h>` matches our fabric header format, but I'm pretty sure that slashes aren't allowed in `header_dir`: I tested this and it didn't work. IIRC, only alphanumeric and underscore are valid characters for `header_dir` or `module_name`. So, I opted to just use `reactperflogger`.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D21585006

fbshipit-source-id: e3339273af5dfd65a1454d87213d1221de6a4651

* Create new Feature flag to eager initialize Fabric

Summary:
This diff exposes a new react feature flag to eager initialize fabric

changelog: [Internal] Internal change in Fabric

Reviewed By: JoshuaGross

Differential Revision: D21574814

fbshipit-source-id: c74fb316963fe92e43ce0ca6262cb73a6a4acb7f

* Implement eager initialization of Fabric

Summary:
This diff implements the eager initialization of fabric based on the param created in previous diffs

changelog: [Internal] Internal change in Fabric

Reviewed By: JoshuaGross

Differential Revision: D21574815

fbshipit-source-id: 1dfd2611ce8c8529ce5f6a7a8c48f8bee19be256

* Extend Binding to log only when a MC is enabled

Summary:
This diff integrates the logging of Binding class using a MC

changelog: [Internal] Internal change to control logging of Fabric

Reviewed By: JoshuaGross

Differential Revision: D21574813

fbshipit-source-id: e7b2acbaa4cb8a8e748db91af5c6960cd47b520e

* Fix position of TextInlineViews when nesting multiple Text components

Summary:
This diff fixes the position of TextInlineViews when nesting multiple Text.
The root is that we were not taking into consideration LayoutOffset of nested TextViews during the calculation of the nested views.

changelog: [Internal] Internal fix in Fabric

Reviewed By: JoshuaGross

Differential Revision: D21586893

fbshipit-source-id: 55e6ad0cf95222588ffe9185f5e22baea1059448

* Revert D21585006: Rename <ReactCommon/NativeModulePerfLogger.h> to <reactperflogger/NativeModulePerfLogger.h>

Differential Revision:
D21585006

Original commit changeset: e3339273af5d

fbshipit-source-id: cb4ff227edcc16842c7539bf71c912cd4ec478e0

* JS: Fix Spelling of JavaScript

Summary:
Fixes some misspellings of JavaScript.

Changelog:
[Internal]

Reviewed By: cpojer

Differential Revision: D21536786

fbshipit-source-id: d5551dfbb3895d0806d31ba38ecaeeeb7843bf20

* Enabling [-Werror,-Wunused-property-ivar] (#28895)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28895

## Summary
Enabling [-Werror,-Wunused-property-ivar]

## Changelog
[Warning] [-Werror,-Wunused-property-ivar] Enable the warning

## Test Plan
Build

Reviewed By: jdthomas

Differential Revision: D20961613

fbshipit-source-id: 8ec73935384800581a71ad96957b716a0d894152

* Add support for Debugger.runIfWaitingForDebugger

Summary:
This call is used to continue execution when the app has just been
started in a "wait for debugger" mode. This is the only case
in which it has an effect.

Notably, it should do nothing in the following cases, which a layperson
may be tempted to classify as "WaitingForDebugger":

* The app was running detached and hit a 'debugger;' statement
* The app is paused because of a breakpoint or hitting the Pause button
* The app stopped on an instrumentation breakpoint, and expects
  the debugger to collect data and potentially auto-resume.

Changelog: [Internal] Add Hermes support for Debugger.runIfWaitingForDebugger

Reviewed By: mhorowitz

Differential Revision: D21557446

fbshipit-source-id: 790cec7444ddc61908d2ef9d92e4649b535d678f

* iOS: Fix image instrumentation lifecycle on image cancel

Summary: Internal loggers were not deallocated when images were canceled on RCTImageView

Reviewed By: fkgozali

Differential Revision: D21380284

fbshipit-source-id: 00440cf49708ec03ecd7d9268001aa458ccbf923

* Rename <ReactCommon/NativeModulePerfLogger.h> to <reactperflogger/NativeModulePerfLogger.h>

Summary:
## Motivation
This rename will fix the following CircleCI build failures:
- [test_ios_unit_frameworks](https://circleci.com/gh/facebook/react-native/150473?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)
- [test_ios_detox_frameworks](https://circleci.com/gh/facebook/react-native/150474?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link)

## Investigation
We have 4 podspec targets that map to the same header namespace (i.e: `header_dir`) `ReactCommon`:
- **New:** `React-perflogger`: Directory is `ReactCommon/preflogger`, and contains `NativeModulePerfLogger.{h,cpp}`.
- `React-runtimeexecutor`: Directory is `ReactCommon/runtimeexecutor`, and contains only `RuntimeExecutor.h`
- `React-callinvoker`: Directory is `ReactCommon/callinvoker`, and contains only `CallInvoker.h`
- `ReactCommon/turbomodule/core`: Directory is `ReactCommon/turbomodule`, and contains C++ files, as well has header files.

**The problem:**
We couldn't import headers from `React-perflogger` in `ReactCommon/turbomodule/core` files.

**The cause:**
I'm not entirely sure why, but I was able to discern the following two rules by playing around with the podspecs:
1. If your podspec target has a cpp file, it'll generate a framework when `USE_FRAMEWORKS=1`.
2. Two different frameworks cannot map to the same `module_name` or `header_dir`. (Why? No clue. But something breaks silently when this is the case).

So, this is what happened when I landed `React-perflogger` (D21443610):
1. The TurboModules code generates the `ReactCommon` framework that uses the `ReactCommon` header namespace.
2. `React-runtimeexecutor` and `React-callinvoker` also used the `ReactCommon` header namespace. However, neither generate a framework because of Rule 1.
3. When I comitted `React-perflogger`, I introduced a second framework that competed with the `ReactCommon` framework (i.e: TurboModules code) for the `ReactCommon` header namespace. Rule 2 violation.

## Thoughts on renaming
- `<perflogger/NativeModulePerfLogger.h>` is too generic, and the `perflogger` namepsace is used internally within FB.
- `<react/perflogger/NativeModulePerfLogger.h>` matches our fabric header format, but I'm pretty sure that slashes aren't allowed in `header_dir`: I tested this and it didn't work. IIRC, only alphanumeric and underscore are valid characters for `header_dir` or `module_name`. So, I opted to just use `reactperflogger`.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D21598852

fbshipit-source-id: 60da5d0f7758eaf13907a080b7d8756688f40723

* Detect recoverable cases where SendAccessibilityEvent exceptions don't need to hard-crash the app

Summary:
See T53113342, view command retry logic, and comment explanation in code.

Changelog: [Internal] fabric

Reviewed By: mdvacca

Differential Revision: D21606911

fbshipit-source-id: 503f52400beb98a19840c67896e0a7a519f30573

* FabricUIManager should only swallow exceptions related to ViewCommands

Summary:
In the previous diff I made a few more things "Retryable" exceptions, where previously only strictly ViewCommand-related code would throw Retryable exceptions. This change is to prevent FabricUIManager from swallowing these exceptions if they happen outside of the context of ViewCommands.

Changelog: [Internal] Fabric

Reviewed By: mdvacca

Differential Revision: D21607324

fbshipit-source-id: b3bad4694d2399db447a9117cc31169104b36de5

* Move Size check before accessing type of transform

Summary:
Changelog:
[Android][Fixed] - Move Size check before accessing type of transform

Reviewed By: JoshuaGross, kacieb

Differential Revision: D21605800

fbshipit-source-id: eb3eb3c3e2992e2e117e6e0af53fbe939e09d971

* use xplat BUCK attribution

Summary:
Internal code attribution update.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21603406

fbshipit-source-id: c3da1823e26beb0092d97e66d731618c0433a2f7

* Create new ReactFlag to configure initialization of Fabric

Summary:
EZ diff to expose a new ReactFlag that will be used to configure the initialization of Fabric

changelog: [Internal] Internal change in fabric

Reviewed By: JoshuaGross

Differential Revision: D21606972

fbshipit-source-id: 53d6bac673b95f0fae93262ff52b815d76bb59ab

* Use MC to Start Fabric surfaces using layoutMetrics or not

Summary:
This diff uses a new MC to Start Fabric surfaces using layoutMetrics or not.

The motivation is to verify if the new initialization of fabric surfaces is regressing in production

changelog: [Internal] Internal change in fabric

Reviewed By: JoshuaGross

Differential Revision: D21606971

fbshipit-source-id: ed1f6937ffd0f1e6c54e3ebc34595d75b6c5f6e1

* Fabric: Automatic removing outstanding Surface on Scheduler destruction; gated.

Summary:
This is an addition to an automatic emergency clean-up algorithm that we have in Scheduler. In addition to committing empty surfaces, we also remove those surfaces from the registry making calling stuff on them impossible. Removing surfaces waits for all commits in flight to be finished, so it theoretically can deadlock (so we gated that).

If we won't face deadlocks in a coming couple of weeks, I would remove gating.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21610683

fbshipit-source-id: 71feeaa0ee4521a0180cdfba6e3a271e7f7d9401

* Pressable: Add Support for Inspector Overlay

Summary:
Adds support for the debug overlay (enabled via the Inspector) that the legacy touchable components supported.

Changelog:
[General][Added] - Added Inspector overlay support for Pressable

Reviewed By: TheSavior

Differential Revision: D21614412

fbshipit-source-id: b884e04f8dba1bfd35e61de25d33d6d47bc34b03

* set`NSAllowsArbitraryLoads` to false by default in template (#28885)

Summary:
Since we already have `localhost` as`Exception Domains` in NSAppTransportSecurity to allow connect to dev server, the template should set `NSAllowsArbitraryLoads` to false by default, as exaplained in [Apple's document](https://developer.apple.com/documentation/bundleresources/information_property_list/nsapptransportsecurity/nsallowsarbitraryloads) as a good practice.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [enhancement] - set `NSAllowsArbitraryLoads` to `false` by default in template
Pull Request resolved: https://github.com/facebook/react-native/pull/28885

Differential Revision: D21624042

Pulled By: shergin

fbshipit-source-id: 690afcd037c3f328d293ef4475380a28efd9fee6

* Extends view flattening algorithm to support flattening of absolute positioned views

Summary:
This diff extends view flattening algorithm to support flattening of absolute positioned views.

changeLog:[Internal] internal change in fabric

Reviewed By: shergin

Differential Revision: D21614519

fbshipit-source-id: e33a41677a332bb58d5e5dcedbffd614a8416a45

* Update Hermes attribution labels

Summary:
Internal target attribution update.

Changelog: [Internal]

Reviewed By: janettec

Differential Revision: D21519089

fbshipit-source-id: 1aa1b57f5e1a1405db32f5cfb9973f27a13bcfdf

* Fabric: Changes in LayoutableShadowNodeTest

Summary:
One small test was added.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21480201

fbshipit-source-id: fd6c050143fcdf27d345ee62e74c4368266e6ce0

* Fabric: Refinement of `LayoutableShadowNode::getRelativeLayoutMetrics`

Summary:
This diff simplifies the implementation of `LayoutableShadowNode::getRelativeLayoutMetrics`.

It fixes a small bug but the most important change is the new interface.

Now the function that does measurements accepts a node and a family instead of two nodes. It prevents misuse and misinterpretation of what the function does. The function needs two things to perform measurement:
 * an ancestor node that defines the tree is being measured and the base node of measurement;
* a family of some descendant node being measured relative to the ancestor node.

An API that accepts two nodes is misleading because it implies that the given descendant node will be measured (which is not true).

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D21480200

fbshipit-source-id: 9fddc361417fee47bbf66cc7ac2954eb088a3179

* Fabric: Simplification of `UIManager::getRelativeLayoutMetrics`

Summary:
Using of the new API makes clear that we don't need to calculate the newest descendant node.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: mdvacca

Differential Revision: D21480202

fbshipit-source-id: c54998573baffe4a05726e3402da027f052b049a

* Basic implementation of ARTSurfaceView

Summary:
Basic implementation of ARTSurfaceView (shadow nodes, props and component descriptor)
changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21621484

fbshipit-source-id: 5577989e966a8a97a043454bf9ae1e5602abc3b1

* Create basic implementation of Shape

Summary:
Create basic implementation of Shape (shadow node, props and component descriptor)
changelog: [Internal] Internal changes to support art in Fabric

Reviewed By: shergin

Differential Revision: D21621482

fbshipit-source-id: e5b9bb2812ee92bce625301b7521f0578eaca0ff

* Basic implementation of ARTGroupProps

Summary:
Basic implementation of ARTGroupProps (shadow node, props and component descriptor)
changelog: [Internal] Internal changes to support art in Fabric

Reviewed By: shergin

Differential Revision: D21621480

fbshipit-source-id: 367a479568b8c1a290f3e0f633cc4052a9c95b87

* Basic implementation of ARTText

Summary:
Basic implementation of ARTText (shadow node, props and component descriptor)
changelog: [Internal] Internal changes to support art in Fabric

Reviewed By: shergin

Differential Revision: D21621483

fbshipit-source-id: d0886dc149520af13faa1bb936dfcccab1798c37

* iOS: Fix logging lifecycle when image is scrolled out and immediately back in

Reviewed By: fkgozali

Differential Revision: D21619910

fbshipit-source-id: b94073afaacad45e12d22d593184cea97612fa26

* Delete local data from Fabric android

Summary:
LocalData was fully replaced by State, this diff removes dead code thas was previously used to update local Data
changelog: [Internal] Internal cleanup on Fabric Android code

Reviewed By: shergin

Differential Revision: D21621481

fbshipit-source-id: a3e38300a54a85adff9145cdeea1e89dad09103f

* get ripple drawables by id (#28600)

Summary:
While working on recent PRs regarding ripple radius in TouchableNativeFeedbaack and ripple support in Pressable I noticed `ReactDrawableHelper` uses a [discouraged](https://developer.android.com/reference/android/content/res/Resources#getIdentifier(java.lang.String,%20java.lang.String,%20java.lang.String)) way to obtain resources.

The attribute names (strings) `'selectableItemBackground'` and `'selectableItemBackgroundBorderless'` are used here

4a48b021d6/Libraries/Components/Touchable/TouchableNativeFeedback.js (L105)

And passed to `context.getResources().getIdentifier()` in `ReactDrawableHelper`. Since we know the attribute names beforehand I figured we can obtain the resources by id (fast) instead of by name (slow). I made it so that the slow code path is taken in case the attribute name does not match what is expected, as a fallback.

Note that I did not do any measurement of the effect of this, I'm just offering this as a PR. You'll notice that this PR relies on the fact that the string in JS is the same as the string in Java (it is duplicated). While I could export the strings from Java and use them in JS, I wasn't sure where to export them. But note that even before, the JS code depended on the `'selectableItemBackground'` and `'selectableItemBackgroundBorderless'` strings to exist on the native side, in the android SDK, I just made the dependency explicit.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[Android] [Changed] - get ripple drawables by id
Pull Request resolved: https://github.com/facebook/react-native/pull/28600

Test Plan: tested manually in RNTester

Differential Revision: D21241773

Pulled By: shergin

fbshipit-source-id: 1b8314f99616095cb6ed557c62095cf3200f53b6

* Pressable: Minimum Press Duration

Summary:
When a `Pressable` has a configured (or the default) `delayPressIn` and no (or the default) `delayPressOut`, tapping very quickly can lead to intantaneous invocation of `onPressIn` and `onPressOut`. The end result is that users may never experience any intended visual press feedback.

This changes `Pressable` to accept (and be preconfigured with a default) **minimum press duration**. The minimum press duration ensures that even if the press is released before `delayPressIn` has elapsed, `onPressOut` will still wait the remaining time up to `minPressDuration` before firing.

Note that setting a non-zero `delayPressOut` is insufficient because if a user holds down on a `Pressable` for longer than `delayPressIn`, we still want `onPressOut` to fire immediately when the press is released.

Changelog:
[General][Changed] - Added `minPressDuration` to `Pressable`.

Reviewed By: TheSavior

Differential Revision: D21614708

fbshipit-source-id: 502f3d8ad6a40e7762435b6df16809c8798dd92c

* Add possibility to disable buttons in action sheet ios (#28792)

Summary:
I've noticed that currently there is no option to disable button within the `ActionSheetIOS`. It can be really useful and decided to extend the API to support that functionality.

I added a new option called `disabledButtonsIndices` to `ActionSheetIOS` which is an array of button indices which should be disabled.

`ActionSheetIOS` documentation - PR https://github.com/facebook/react-native-website/pull/1898

## Changelog

[iOS] [Added] - Add disableButtonsIndices option to ActionSheetIOS component
Pull Request resolved: https://github.com/facebook/react-native/pull/28792

Test Plan:
1. Run the `RNTester`
2. Choose `ActionSheetIOS`
3. Check the fourth example `Show Action Sheet with disabled buttons`
4. `Option 1` and `Option 2` should be disabled

screenshot | gif
 --- | ---
<img width="493" alt="Screenshot 2020-04-30 at 15 16 22" src="https://user-images.githubusercontent.com/22746080/80739025-1ec52780-8b16-11ea-8b1c-30bb40ad8c99.png"> | ![action_sheet_disabled](https://user-images.githubusercontent.com/22746080/80739043-24227200-8b16-11ea-8bcb-af25eb57baac.gif)

Differential Revision: D21396409

Pulled By: shergin

fbshipit-source-id: b3c3e442965160e0c5e52854352f0540575c4d4c

* deploy Flow 0.125.1 to xplat

Summary:
Changelog: [Internal]
allow-large-files

Reviewed By: gkz

Differential Revision: D21597387

fbshipit-source-id: dddec43885daa5a9c5c4dfe8e338ecedc9abcd1e

* Prevent SafeAreaView from reporting same size twice

Summary:
Changelog: [Internal]

# Problem

We call `_state->updateState` anytime safe area insets changes.
Once that is called, `_state` still holds old value, so when we check whether there is big enough of a difference, we are actually checking it against old value of state until `updateState` is called from MountingManager.

This causes `_state->updateState` to be called dozens of times (I measured 47, with this diff it fell to 22) when displaying a safe area view inside Modal.

# Solution

Create new ivar `_lastPaddingStateWasUpdatedWith` where we store last padding that was sent through `_state->updateState` and compare new inset with this value instead of last value stored in state.

Reviewed By: shergin

Differential Revision: D21596367

fbshipit-source-id: b9249b8ef444ea532ec8b86a15a32c733eb6f987

* Copy alreadyAppliedPadding when cloning SafeAreaViewShadowNode

Summary:
Changelog: [Internal]

`SafeAreaViewShadowNode.alreadyAppliedPadding` was always {0, 0, 0, 0} because value of previous shadow node was never copied over to new shadow node during clone.

Reviewed By: shergin

Differential Revision: D21617361

fbshipit-source-id: 6d6c91b19ff60271bf7c48145d85faaee0321680

* remove suppress_comments from xplat flowconfigs

Summary:
Flow is deprecating this config option, so we are removing it in preparation.

Changelog:

[Internal]

Reviewed By: gkz

Differential Revision: D21642915

fbshipit-source-id: cb2abff067b8702b37d5fdbdd63556f464e2a4a5

* Fix thrown GradleScriptExceptions

Summary:
Changelog:
[Android] [Fixed] Use actual constructor when throwing GradleScriptException

Reviewed By: PeteTheHeat

Differential Revision: D21644385

fbshipit-source-id: 09802682cb9eb788e508cff3fbebdbdacd5b1d69

* Revert D21396409: Add possibility to disable buttons in action sheet ios

Differential Revision:
D21396409

Original commit changeset: b3c3e4429651

fbshipit-source-id: 073bea94d96f0ebbb474c474c73e4e3f01f27b2e

* RN: Persist Asynchronously Consumed Events in Pressability

Summary:
There are a few places in `Pressability` where we asynchronously consume the `event` object.

Most places do not encounter any problems because the actual properties on `event` are seldom used.

Nonetheless, we should fix these gaps.

Changelog:
[General][Fixed] - Fix invalid `event` objects from `onPressOut` in certain cases

Reviewed By: rickhanlonii

Differential Revision: D21657126

fbshipit-source-id: e28d825b85d25602427beaf0bd603d22eaa5960a

* docs: mention prettier in eslint-config README (#28930)

Summary:
The combination of `eslint` (v7.0.0), `react-native-community/eslint-config` (v1.1.0), and `flow-typed` (v3.1.0) causes the following error (`ESLint couldn't find the plugin "eslint-plugin-prettier"`) because `flow-typed` (v3.1.0) depends on `prettier: ^1.19.1` (c.f. https://github.com/flow-typed/flow-typed/blob/master/cli/package.json#L38).
To deal with the error, developers should install `prettier` (v2.x) directly in `devDependencies`.

```
Oops! Something went wrong! :(

ESLint: 7.0.0

ESLint couldn't find the plugin "eslint-plugin-prettier".

(The package "eslint-plugin-prettier" was not found when loaded as a Node module from the directory "/Users/exkazuu/Projects/test".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm install eslint-plugin-prettier@latest --save-dev

The plugin "eslint-plugin-prettier" was referenced from the config file in ".eslintrc.js » react-native-community/eslint-config".

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.
```

## Changelog

[Internal] [Changed] - `react-native-community/eslint-config` README recommends developers to install prettier directly
Pull Request resolved: https://github.com/facebook/react-native/pull/28930

Test Plan: This PR changes only README, so tests are not required.

Differential Revision: D21659672

Pulled By: cpojer

fbshipit-source-id: 67c775e664d539815fa78e12574d73eaa1942de1

* Daily `arc lint --take GOOGLEJAVAFORMAT`

Reviewed By: zertosh, colriot

Differential Revision: D21642196

fbshipit-source-id: 5ca93be472da2630374850e0937bbdcb92f86b31

* Add FBRotatablePhotoPlayerView to LegacyInterop whitelist

Summary: Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D21661427

fbshipit-source-id: de692015f3c6f029d2ea3f927e30d6758c0b1102

* Fix assignment of hitTestEdgeInsets in RCTViewComponentView

Summary:
Changelog: [Internal]

If you look at implementation of hit testing in `RCTViewComponentView`

```
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event
{
  if (UIEdgeInsetsEqualToEdgeInsets(self.hitTestEdgeInsets, UIEdgeInsetsZero)) {
    return [super pointInside:point withEvent:event];
  }
  CGRect hitFrame = UIEdgeInsetsInsetRect(self.bounds, self.hitTestEdgeInsets);
  return CGRectContainsPoint(hitFrame, point);
}
```

you will notice that we use `UIEdgeInsetsInsetRect` to calculate hitFrame. The input for this function is bounds and `hitTestEdgeInsets`. `hitTestEdgeInsets` is our hitSlop.
Look at documentation of `UIEdgeInsetsInsetRect`, it says "Adjusts a rectangle by the given edge insets.".

So if you give it a positive edge insets, it will make the rect smaller.

That's why we need to reverse values of hitSlop to negative before assigning it to `hitTestEdgeInsets`.
Paper does the same thing here d0871d0a9a/React/Views/RCTViewManager.m (L304-L305)

Reviewed By: mdvacca

Differential Revision: D21661894

fbshipit-source-id: c3dd6c55b68e4fdef8589ca8f0484e2837b4136c

* C++ Fabric Core LayoutAnimations

Summary:
This is the V1 implementation of Fabric Core LayoutAnimations.

The intention is to structure this in such a way that it's easy for each platform to customize the "AnimationDriver" class (to do platform-specific optimizations) without changing the KeyFrameManager at all.

In the future, this structure and architecture should allow us to iterate faster on new animation APIs.

TODOs:

- Use std::chrono for timekeeping

Changelog: [Internal] Support for LayoutAnimations in Fabric

Reviewed By: shergin

Differential Revision: D17486030

fbshipit-source-id: 95c72cf9fc2b4bf3fe652fbd249cf2ad113033c7

* LayoutImplementations: implement all existing animation curves besides Keyboard

Summary:
Implement EaseIn, EaseOut, EaseInOut, and Spring with SpringDamping.

Note this does not yet implement Keyboard-type animation for iOS (coming soon), and the spring interpolator is VERY naive. We likely want to replace it with a "real" spring animation ASAP. The spring animation is identical to what Android does today, but would likely be a downgrade for iOS. I will do both in a followup.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21587648

fbshipit-source-id: 246ab7fd40397a4231bb6b18d2f29602788a1bd2

* LayoutAnimations: implement LayoutAnimationStatusDelegate for platform-specific integrations

Summary:
The LayoutAnimationStatusDelegate exists so that platforms can get a signal when animations are starting or have all completed.

This signal is meant to be used ONLY for driving animations at 60fps, or stopping that process, on the platform side.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21583109

fbshipit-source-id: 234496841bde226fcd6623c74c1a500e5cd00d99

* Android-specific LayoutAnimation integration

Summary:
Turn on Fabric LayoutAnimations on Android.

I will gate this change behind a QE before landing.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21583122

fbshipit-source-id: 82eacb7192f7c59d2809a67a619cb950293aaace

* iOS-specific LayoutAnimation integration

Summary:
Turn on Fabric LayoutAnimations on iOS.

I will gate this change behind a QE before landing.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21583932

fbshipit-source-id: 0e0f988b44af37eb6fb22cccb48b0c7aa5020ca7

* LayoutAnimations: Use Quaternions to interpolate rotation transforms

Summary:
Implement a real Transform interpolation. It uses quaternions/Slerp to interpolate rotations. This allows us to interpolate scale, rotation, and translation simultaneously.

See caveats in code. Because of the way transform matrices work, there isn't much (anything?) we can do about skew, and certain values will look nonsensical. This seems to be true for any variant of this algorithm.

This is a big step up from Classic RN which didn't support this in LayoutAnimations at all.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21615829

fbshipit-source-id: da6cb931ce857107d4b3d20108fb9bbecbf4f898

* LayoutAnimations: allow Paragraph props to be interpolated

Summary:
1. Split out the prop interpolation function out of the View ComponentDescriptor, into an inline'd function that can be used elsewhere.
2. Call it from View and from Paragraph component descriptors.

This causes animations including Text to look normal on iOS.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21635473

fbshipit-source-id: 470f43fd24a6e80d8696ee2f2a09d9e693b7f280

* Revert D21635473: LayoutAnimations: allow Paragraph props to be interpolated

Differential Revision:
D21635473

Original commit changeset: 470f43fd24a6

fbshipit-source-id: 8507b0aaead2c0ebbdd09077db99e5e44da175ab

* Revert D21615829: LayoutAnimations: Use Quaternions to interpolate rotation transforms

Differential Revision:
D21615829

Original commit changeset: da6cb931ce85

fbshipit-source-id: 4b5bc392a35aac627b89ccccb73e10a2b1c4aaa6

* Revert D21583932: iOS-specific LayoutAnimation integration

Differential Revision:
D21583932

Original commit changeset: 0e0f988b44af

fbshipit-source-id: 2e3986e9310a56880a36cfd72fdee53fd9177dca

* Revert D21583122: Android-specific LayoutAnimation integration

Differential Revision:
D21583122

Original commit changeset: 82eacb7192f7

fbshipit-source-id: 5bcc392cdb3b11c755395beba4032a21c1bf2668

* Revert D21583109: LayoutAnimations: implement LayoutAnimationStatusDelegate for platform-specific integrations

Differential Revision:
D21583109

Original commit changeset: 234496841bde

fbshipit-source-id: 2f74dcce23f4eebf987e2114ad1f23cf01e11a9d

* Revert D21587648: LayoutImplementations: implement all existing animation curves besides Keyboard

Differential Revision:
D21587648

Original commit changeset: 246ab7fd4039

fbshipit-source-id: 427e13ff821776feb4952c3438c15ea815fce5f0

* Revert D17486030: C++ Fabric Core LayoutAnimations

Differential Revision:
D17486030

Original commit changeset: 95c72cf9fc2b

fbshipit-source-id: fa7ef058f5d0dea0154c62718a8a11d9330698d9

* Remove flow-node requirement from native modules codegen script

Summary:
Use transpiled `react-native-codegen` scripts. By avoiding use of flow-node, we no longer need to upgrade flow-remove-types in order to run the native modules codegen script.

The interface for the script remains the same:

```
./scripts/generate-native-modules-specs.sh [optionalOutputDir]
```

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21629705

fbshipit-source-id: 7714a67e36c8151a3b0b49285b6a6c93a525d7bc

* C++ Fabric Core LayoutAnimations

Summary:
This is the V1 implementation of Fabric Core LayoutAnimations.

The intention is to structure this in such a way that it's easy for each platform to customize the "AnimationDriver" class (to do platform-specific optimizations) without changing the KeyFrameManager at all.

In the future, this structure and architecture should allow us to iterate faster on new animation APIs.

Changelog: [Internal] Support for LayoutAnimations in Fabric

Reviewed By: mdvacca

Differential Revision: D21675808

fbshipit-source-id: b3ef44729bb8b6217f90760aec9737276c9601d1

* LayoutImplementations: implement all existing animation curves besides Keyboard

Summary:
Implement EaseIn, EaseOut, EaseInOut, and Spring with SpringDamping.

Note this does not yet implement Keyboard-type animation for iOS (coming soon), and the spring interpolator is VERY naive. We likely want to replace it with a "real" spring animation ASAP. The spring animation is identical to what Android does today, but would likely be a downgrade for iOS. I will do both in a followup.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675810

fbshipit-source-id: ac98554ebc81f0b81fdacefd6d848e3566e424c0

* LayoutAnimations: implement LayoutAnimationStatusDelegate for platform-specific integrations

Summary:
The LayoutAnimationStatusDelegate exists so that platforms can get a signal when animations are starting or have all completed.

This signal is meant to be used ONLY for driving animations at 60fps, or stopping that process, on the platform side.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675807

fbshipit-source-id: e89ba524ea43c266556199c8854e8228869755e3

* Android-specific LayoutAnimation integration

Summary:
Turn on Fabric LayoutAnimations on Android.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675809

fbshipit-source-id: 49fbd3094532c5b486ea12a58898b986964ddd6e

* iOS-specific LayoutAnimation integration

Summary:
Turn on Fabric LayoutAnimations on iOS.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675803

fbshipit-source-id: 1be5f516f8af9439134c1688deb63b35b964ae99

* LayoutAnimations: Use Quaternions to interpolate rotation transforms

Summary:
Implement a real Transform interpolation. It uses quaternions/Slerp to interpolate rotations. This allows us to interpolate scale, rotation, and translation simultaneously.

See caveats in code. Because of the way transform matrices work, there isn't much (anything?) we can do about skew, and certain values will look nonsensical. This seems to be true for any variant of this algorithm.

This is a big step up from Classic RN which didn't support this in LayoutAnimations at all.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675805

fbshipit-source-id: a33494cc02c73102ca67c1d562efc4b2a7308a4a

* LayoutAnimations: allow Paragraph props to be interpolated

Summary:
1. Split out the prop interpolation function out of the View ComponentDescriptor, into an inline'd function that can be used elsewhere.
2. Call it from View and from Paragraph component descriptors.

This causes animations including Text to look normal on iOS.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21675804

fbshipit-source-id: c34a317749fd6c108aef072d47f3dcb14ce8aa5c

* Guard all NativeModulePerfLogger calls with a null check

Summary:
## Motivation
We got this crash T67304907, which shows a `EXC_BAD_ACCESS / KERN_INVALID_ADDRESS` when calling this line:
```
  NativeModulePerfLogger::getInstance().asyncMethodCallBatchPreprocessStart();
```
There are no arguments in that call, so I figured the only error could be when we try to invoke `getInstance()` or `asyncMethodCallBatchPreprocessStart()`.

This diff:
1. Removes the `NativeModulePerfLogger::getInstance()` bit. Now NativeModulePerfLogger is used via regular static C functions. So, there's no way that simply invoking one of the logging functions crashes the application: there's no vtable lookup.
2. Inside each logging function, when perf-logging is disabled, the global perflogger should be `nullptr`. This diff makes it so that in that case, we won't execute any code in the control group of the perf-logging experiment.

## Changes
**How do we enable NativeModule perf-logging?**
- Previously:
   - `NativeModulePerfLogger::setInstance(std::make_shared<FBReactNativeModulePerfLogger>(...))`
   - `TurboModulePerfLogger::setInstance(std::make_shared<FBReactNativeModulePerfLogger>(...))`.
- Now:
   - `BridgeNativeModulePerfLogger::enableLogging(std::make_unique<FBReactNativeModulePerfLogger>(...))`
   - `TurboModulePerfLogger::enableLogging(std::make_unique<FBReactNativeModulePerfLogger>(...))`

**How do we do NativeModule perf-logging now?**
- Previously:
   -  `NativeModulePerfLogger::getInstance().command(...args)`
   -  `TurboModulePerfLogger::getInstance().command(...args)`.
- Now:
   - `BridgeNativeModulePerfLogger::command(...args)`
   - `TurboModulePerfLogger::command(...args)`.

The benefit of this approach is that each method in `BridgeNativeModulePerfLogger` is guarded with an if check. Example:

```
void moduleCreateConstructStart(const char *moduleName, int32_t id) {
  NativeModulePerfLogger *logger = g_perfLogger.get();
  if (logger != nullptr) {
    logger->moduleCreateConstructStart(moduleName, id);
  }
}
```

Therefore, we don't actually execute any code when perf-logging is disabled.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D21669888

fbshipit-source-id: 80c73754c430ce787404b563878bad146295e01f

* Create classes to represent C++ state of ART

Summary:
This diff introduces a set of classes that are going to be used to represent the internal State of ART nodes

changeLog: [Internal][Android] Internal change to support ART in Fabric

Reviewed By: JoshuaGross, shergin

Differential Revision: D21657612

fbshipit-source-id: ea6d94b06807ff02d222dfa129a1cae384dceeaa

* Create internal State of ART based on Shadow Nodes

Summary:
This diff creates the internal state of ART based on its shadow nodes

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21657607

fbshipit-source-id: 0a15e90ee7465bf3a2b1001ff9d3198eb22fd708

* Integrate State into ARTSurfaceViewShadowNode

Summary:
This diff integrates ART state into ARTSurfaceViewShadowNode

changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21657611

fbshipit-source-id: 06bd4d610e2c52e0ef3bca423b93c9ad2318e8df

* Integrate ElementType Enum into state

Summary:
This diff replaces the usage of int to represent the type of elements for an Enum
changelog: [Internal] Internal change to support ART in fabric

Reviewed By: shergin

Differential Revision: D21657706

fbshipit-source-id: 7bda0210d50136477f0524695d5406e35074f09c

* Serialize ART state into folly::dynamic

Summary:
This diff serializes ART state into folly::dynamic. this is necessary to send this data to Android

changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21657608

fbshipit-source-id: 6c1b69af7d1dbe7de15e509f83c508a38294d89e

* Prevent ABA problem during YogaLayoutableShadowNode cloning

Summary:
Changelog: [Internal]

# Problem
Yoga internally uses address of owner to determine whether a node should be cloned or it shouldn't.
During layout, it traverses the tree and looks whether current parent is equal to child's owner. If it isn't it means the yoga node is shared between 2+ trees and need to be cloned before mutated. Parent in yoga is stored as reference to the parent.

We can run into an issue where yoga node is shared between 2+ trees, but its current parent is equal to child's owner. This is because we reallocate new parent at address where its previous parent lived. This happens over few iterations, the old parent is first deallocated.

This is known as ABA problem.

# Solution

When we are cloning node, we loop over all children to see whether any of the is not using address of new `yogaNode_` as its owner. At this point we know this is accidental and set its owner to `0xBADC0FFEE0DDF00D`.

We chose `0xBADC0FFEE0DDF00D` because when someone is debugging this in LLDB and prints this address, it will hint them that it was artificially set and can string search for it in the codebase.

Reviewed By: shergin

Differential Revision: D21641096

fbshipit-source-id: c8b1b4487ea02b367f5831c1cdac055bce79c856

* Daily `arc lint --take CLANGFORMAT`

Reviewed By: zertosh

Differential Revision: D21683227

fbshipit-source-id: a29bc66af62fe99d803ac386261269b5cd16c18f

* Fix order in which views are mounted in RCTLegacyViewManagerInteropComponentView

Summary:
Changelog: [Internal]

# Problem

We were recording mount child component calls with its arguments and the replaying them inside `finalizeUpdates`.
However we store the events in NSDictionary where `key` was index at which the child should be added.
Then in `finalizeUpdates` we iterated over this NSDictionary and added those views into our paper view.
`NSDictionary` is unordered, it isn't guaranteed what was first inserted into it, will be first iterated over.

# Solution

Use `NSMutableArray` instead which guarantees order.

Reviewed By: shergin

Differential Revision: D21685993

fbshipit-source-id: 3b933f05125130eef175d7a8a56f29012ee76bb3

* Separate event dispatchers to ivars instead of array

Summary:
Changelog: [Internal]

Separates EventQueues from an array into 4 ivars.
EventQueues are of different type, in the future we will want to call different methods on different kind of EventQueue.

Reviewed By: shergin

Differential Revision: D21648905

fbshipit-source-id: 90ae65edb8a9276eecfea9770f554d8c56804797

* Introduce BatchedEventQueue::enqueueUniqueEvent

Summary:
Changelog: [Internal]

`BatchedEventQueue::enqueueUniqueEvent` goes over event queue and deletes previous event of the same type and same target.

This is useful for ScrollView for example where only the latest event is relevant.
This only affects ScrollView scroll event, other events take the original code path.

Reviewed By: mdvacca

Differential Revision: D21648906

fbshipit-source-id: a80ad652058fd50ebb55e24a87229cdc1764b591

* Touchable: Revert `minPressDuration` on Legacy Components

Summary:
When `minPressDuration` was introduced to `Pressability`, all of the legacy Touchable components inherited the new default.

This restore the former behavior for these legacy components so that only `Pressable` gets the new `minPressDuration` default value.

Changelog:
[General][Fixed] - Revert `minPressDuration` effect on legacy Touchable components

Reviewed By: fkgozali

Differential Revision: D21682764

fbshipit-source-id: b71a61843fae7f0f726155876a064fabd3ba1c64

* update internal code attribution

Summary:
Internal code attribution labeling update.

Changelog: [Internal]

Reviewed By: zlern2k

Differential Revision: D21696075

fbshipit-source-id: ef689a6367e1dddfffbbefb52a6aead2c91bfefe

* Fix imports in `RCTUtilsUIOverride.h` (#28946)

Summary:
While we build react native 0.62.2 via our Bazel build system, encountered those following errors due to lack of appropriate imports:
```
external/React-Core/React/Base/RCTUtilsUIOverride.h:8:33: error: cannot find interface declaration for 'NSObject', superclass of 'RCTUtilsUIOverride'
interface RCTUtilsUIOverride : NSObject
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   ^
external/React-Core/React/Base/RCTUtilsUIOverride.h:12:37: error: expected a type
+ (void)setPresentedViewController:(UIViewController *)presentedViewController;
                                    ^
```
Add the appropriate imports `<Foundation/Foundation.h>` and `<UIKit/UIKit.h>` fix those errors.

Honestly I dont know how it's supposed to work without those imports. Also all the siblings files have the correct imports. e.g. [RCTUtils.h](15a5f3624c/React/Base/RCTUtils.h)

## Changelog

[iOS] [Fixed] - Fix imports in `RCTUtilsUIOverride.h`
Pull Request resolved: https://github.com/facebook/react-native/pull/28946

Test Plan: RN tester iOS app runs fine.

Differential Revision: D21700030

Pulled By: shergin

fbshipit-source-id: 9ef806b8f656bdad289fbdd3d84ecefb0dea6afb

* Refactor types of ART Text class

Summary:
This diff refactors the types of ART Text classes, this is necessary on the next diffs of the stack

closeoncommit

changelog: [internal]

Reviewed By: JoshuaGross

Differential Revision: D21681876

fbshipit-source-id: ea438e89df6d860b3ff8bbdae657ca123b417a1b

* Serialize ART text components and send data to Android

Summary:
This diff implements the serialization of Text components to send data from C++ to java

changelog: [Internal] internal changes to support ART in fabric

Reviewed By: JoshuaGross

Differential Revision: D21681875

fbshipit-source-id: eba31f35c95e0a2d3226ec70421832719083d7fa

* Add support for Text in ART Fabric Android

Summary:
This diff adds support for Text in ART Fabric Android

changelog: [Internal] internal changes to fully support ART in Fabric

Reviewed By: JoshuaGross

Differential Revision: D21681877

fbshipit-source-id: c92e642cff56b71f8ee8f4eb9af6eea6c490f6c7

* Rename Element -> ARTElement

Summary:
Element, Shape, Group, Text are too generic, we are renaming these classes to ARTElement, ARTBGroup, ARTShape...

changelog: [Internal] internal changes to support ART in android

Reviewed By: JoshuaGross

Differential Revision: D21681878

fbshipit-source-id: f6b35443486a3db210f61dcaf91bd32df47fbc66

* Implement equality of ARTElements and use it in ARTState

Summary:
Here I'm implementing equality methods for ARTGroup, ARTShape and ARTText and I'm using these methods to update the state only when it is necessary.
This will improve perf in rendering of ART

changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D21695127

fbshipit-source-id: b438ddea4c34bd7a0bdf26a6aac4fd62a9f78b49

* Delete unused class

Summary:
ez diff to delete unused class

changelog: [internal]

Reviewed By: fkgozali

Differential Revision: D21699666

fbshipit-source-id: d0e725c7096906e2effd16f8fa2a57683192420f

* Add ART components into Catalyst app Android

Summary:
Simple diff to add ART components into Catalyst app Android

changelog: [Internal] Internal changes to add support of ART for Fabric

Reviewed By: JoshuaGross

Differential Revision: D21621479

fbshipit-source-id: d957c25f447d19d8f349c69aa20f5f19237d867a

* Delete copy constructor and copy assignment operator in ShadowNode

Summary:
Changelog: [Internal]

ShadowNode shouldn't be copyable.

Reviewed By: shergin

Differential Revision: D21692756

fbshipit-source-id: e70dcf82f4d4c7609283936a42c741467f8f13ca

* Annotate <Image> components in QPL logging using ImageAnalyticsTagContext

Reviewed By: mdvacca

Differential Revision: D21696266

fbshipit-source-id: b5c9d167e9da77ed969f7b4bdea1af9dd2e471ae

* Cleanup of RCTTExtInputComponentView.mm

Summary:
Changelog: [Internal]

1. `UITextField.attributedText` and `UITextView.attributedText` default value is `nil`, not an empty NSAttributedString.
2. Assigning `_backedTextInputView.frame = self.bounds` inside constructor isn't needed as `self.bounds` during initialisation.

Reviewed By: JoshuaGross

Differential Revision: D21722661

fbshipit-source-id: 8725335d929b7d10736b540e12f1669ea824ad94

* Change jsi::Runtime::lockWeakObject to take a mutable ref

Summary:
A key difference in WeakRefs with the Hades GC is that they are mutable,
in the sense that reading the value of a WeakRef while a GC is active might
clear the WeakRef.
For this reason, attempting to lock the WeakObject might mutate the backing
reference.

I preferred to communicate this change in behavior via the API rather than
`const_cast` it away inside the implementation.

Changelog: [Internal] Change jsi::WeakObject to be mutable in lockWeakObject

Reviewed By: mhorowitz

Differential Revision: D21485758

fbshipit-source-id: 3618928be8f8791aed56cb20673896ff5b786ded

* Android Animated timing: interface-only

Summary:
This is (part of) a rewrite of D15390384.

This implements the lifecycle interface only for Fabric to signal to NativeAnimatedModule when preOperations are about to run / operations are about to be dispatched.

We will likely want to remove this mechanism entirely and rewrite NativeAnimatedModule in C++ for Fabric/Venice, but for now, I'm not sure of a better solution to unblock.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21698193

fbshipit-source-id: a13d445073911fd63d896202a7a1bfbe1167038a

* Fix NativeAnimatedModule timing for Fabric/Venice(?)

Summary:
This is the second part of a rewrite of D15390384, which allows Animated timing to be driven by Paper or Fabric.

The intuition is: we don't care which one drives the animation. We will expect one or both of them to issue a callback that operations are about to be executed, and the first one wins. The blocks will only execute once, the second time will be a noop.

I don't think there's a 100% safe way of reimplementing Native Animated Module for Fabric/Venice (without a new API and implementing in C++) since it's inherently disconnected from the commit process and the tree. This gets us slightly closer to visual functionality, though.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21698192

fbshipit-source-id: c11d3cebd12cfc8acf4b63c87ccbe62cdbd8b672

* LayoutAnimations: fail silently instead of redboxing if there's a misconfigured LayoutAnimation

Summary:
property and type are optional params according to Flow, so we should treat as such.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21725746

fbshipit-source-id: 3c48a8cef8fa5911c195f582556de6dad871c4f1

* Split EventDispatcher into interface and impl (#28983)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28983

Creating an interface for EventDispatcher so I can implement it from a dummy/no-op EventDispatcher to use in bridgeless mode when the instance isn't alive.

Changelog: [Android] [Changed] Renamed EventDispatcher to EventDispatcherImpl and created EventDispatcher interface; calls to EventDispatcher contstructor need to be updated

Reviewed By: makovkastar

Differential Revision: D21695401

fbshipit-source-id: 46066a467efcf03a5f484bb9fb58c662d46a2c4e

* C++ LayoutAnimations: solve crash when "animating" virtual views

Summary:
Index adjustment doesn't work if virtual views are inserted, because those don't actually result in the view hierarchy being mutated, as such.

Add an Android-specific check to solve the crash.

I don't love adding platform-specific checks here, so I'm considering wrapping this logic in a platform-specific class, so that logic lives outside of the core of LayoutAnimations and entirely in platform code.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21727805

fbshipit-source-id: 5af2cf479beaa4d0e9d94ea16ac989c4268920f8

* Add new swizzle method RCTSwapInstanceMethodWithBlock

Summary:
This diff adds a new swizzling method for replacing instance methods with blocks.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21635131

fbshipit-source-id: c8061817bed66dad160efffee5a13c8714134540

* Remove unused double key press code

Summary:
This was added in D3343907 June 1st 2016, disabled in D3428043 June 16, 2016 and never re-enabled.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D21635227

fbshipit-source-id: db51dfb6271359bea7da34b4e2a71931fc7c2a63

* Migrate react-native Android tests to Robolectric v4 (#28927)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/28927

Changelog:
[Android] [Changed] Test Modernization

Reviewed By: mdvacca

Differential Revision: D21598788

fbshipit-source-id: 6fd9c30220d6d69cc68f13bf1f5ad5a4bc2b039a

* Better error message when crashing because of an invalid Remove operation

Summary:
Error messages like P131885276 don't help debugging, even when all mount instructions are logged to logcat. This log would help identify the incorrect mount instruction.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21735940

fbshipit-source-id: 16ff315c11ccafdd75d0ad9c7c60b7be2cd73202

* Move TimePickerAndroid to FB internal

Summary:
Moving TimePickerAndroid to FB internal.

Changelog:
[Android][Changed] - Moved TimePickerAndroid to FB internal.

Reviewed By: cpojer

Differential Revision: D21504128

fbshipit-source-id: 400c6ee7cff96a0d6b4205f7806ef8951b611b8c

* Upgrade to Babel 7.10

Summary:
See https://github.com/babel/babel/releases/tag/v7.10.0 for changes

It includes a change I asked the Babel team for as they have been wrapping object spread calls with lots of extends call for spec compliance, but that only matters when you have side-effectful getters that affect the rest of the objects in the spread call and are order dependent. We should not be depending on such behavior in FB code so we can use loose mode and benefit from the app size wins.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D21738344

fbshipit-source-id: 5eeff47481e474bb41183119d990692b31751dd5

* Always return an EventDispatcher in bridgeless mode

Summary:
This changes how we access the EventDispatcher from the FabricUIManager in bridgeless mode.

Currently, we have implemented a similar API to what we use for Fabric (used in UIManagerHelper): `BridgelessReactContext.getJSIModule(UIManager).getEventDispatcher()`. However, `getJSIModule` does not have a nullable return type, which means that we have to throw an exception if the UIManager can't be found - if, for example, the instance is not initialized yet (or has been destroyed). This is causing crashes when a view tries to access the EventDispatcher before the instance is initialized, which takes longer for Venice because we include JS bundle loading as part of initialization (we may need to revisit that).

Ideally, we'd like to create a first-class API for `getEventDispatcher()`, and make sure that it never crashes if the instance is destroyed, because we don't care if JS events aren't delivered at that point. However, there are some obstacles to making this change for the bridge - mostly related to avoiding circular dependencies between the bridge module and the uimanager module. (Also, this might be a behavior change for the bridge, because I think we currently start queueing events before it's initialized? and product code might be relying on that).

Reviewed By: mdvacca

Differential Revision: D21672949

fbshipit-source-id: a38e96cd40c6f70124b7ca2a5c9722988fe7fcf4

* Reset RootView ID when root view is detached from view hierarchy

Summary:
I have a theory that T53114059 can be caused by (1) other crashes, and/or (2) reloads. Clear out the ID of a RootView when it is detached.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21732066

fbshipit-source-id: 5e607f34cf42ca26bdf199d5d3024fd49a60dc1e

* Do not use variable types for array elements

Summary:
When a property returns an array type, use the actual element type when generating structs and inlines.

Changelog: [Internal]

Reviewed By: TheSavior

Differential Revision: D21651351

fbshipit-source-id: 14cadf209c38a301c9c65fcaadd8a292c1936349

* Fix crash introduced by D21735940 in T67525923

Summary:
We cannot call `parentView.getChildCount()` directly, we must get the child count through the ViewManager:

A simple `Log.e` call shows:

```
MountingManager: parentView.getChildCount(): 0 // viewGroupManager.getChildCount(parentView): 7
```

This difference does not occur for ALL views, but it occurs for... enough that this will crash on basically ~every screen, at least on navigation when all views are removed.

Theory about why this is happening: some ViewGroup types compute childCount differently, especially if we do some sort of custom child management for some view type? By coercing to `T` which the ViewManager does, we call getChildCount on the correct class type. This is just a hypothesis, though. But the failing views are all `View`s and it does look like `ReactClippingViewManager` has custom `getChildCount` logic, so that's likely the answer.

There's no such thing as an easy diff!

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21750097

fbshipit-source-id: 3d87d8f629a0c12101658050e57e09242dfc2a8c

* Fix crash in removeViewAt by fixing incorrect error-detection

Summary:
As a followup to D21750097 and D21735940, it seems that ANY uses of childCount will be incorrect as they are "often" reported, incorrectly, as just 0.

This is likely due to exotic cases like (1) the ViewManager childCount being overridden, or (2) special ViewManagers like BottomSheet where the childCount may actually be 1/0 even though many children are inserted.

Anyway, as a more generic fix, let's only rethrow an existing Exception with additional diagnostics instead of trying to detect when this /would/ crash.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21756178

fbshipit-source-id: 17ffb2ed531978bae8d4db19d7b87ec62397e44b

* Back out "Reset RootView ID when root view is detached from view hierarchy"

Summary:
Original commit changeset: 5e607f34cf42

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D21757847

fbshipit-source-id: 96caf39f2ee99f64c96ebac9836ca178a7513cf1

* Refactor RCTKeyCommands, allow hotkeys to be used without command key

Summary:
This diff updates our RCTKeyCommands code to be more resilient by copying the [FLEX strategy for key commands](https://github.com/Flipboard/FLEX/blob/master/Classes/Utility/Keyboard/FLEXKeyboardShortcutManager.m).

This strategy swizzles UIApplication handleKeyUIEvent which is further upstream than our UIResponder. It also allows for single key hotkeys like pressing just `r` instead of `cmd+r`. It does this without interfering with typing input  by checking the first responder first.

I've also updated our hotkey handling to support using just the keys like `r` in addition to `cmd+r`. In addition to brining these hotkeys more in line with other iOS tools, they're also easier to use and do not suffer the same issues hotkeys with modifiers like `cmd` have where keys are dropped.

Changelog: [iOS] [Added] Allow hotkeys to be used without command key

Reviewed By: shergin

Differential Revision: D21635129

fbshipit-source-id: 36e0210a62b1f310473e152e8305165024cd338b

* Remove calls to AllocationLocationTracker for native memory

Summary:
`getStackTracesTreeNodeForAlloc` only works for memory that was tracked with `newAlloc`.
For now, that is only memory that goes through GC APIs.

Various places were calling this function on native memory which was allocated
with `malloc`, not GC memory. This led to SIGSEGV on nullptr when trying to take heap profiles
of these objects.

`newAlloc` could, in theory, work with native memory as well. But building out support for that
is outside the scope of this fix.

Changelog: [Internal]

Reviewed By: jbower-fb

Differential Revision: D21667842

fbshipit-source-id: 8403a6668e5ec607972ce6819f78fedb89da3f37

* Add Fabric logs to TextLayoutManager

Summary:
This diff add logging on Text Layout Manager.

changelog: [Internal][Android] Internal changes to extend logging

Reviewed By: JoshuaGross

Differential Revision: D21737356

fbshipit-source-id: f34091722ff95f83ca41c9f17c49d31ce6618c9a

* Add new bundle loading strategy in FBiOS behind GK

Reviewed By: PeteTheHeat

Differential Revision: D21706223

fbshipit-source-id: 805628eed004e1469a4b1aa1e69fd2982e448b25

* Extend Text to support measurement of empty Texts

Summary:
This diff extends the measurement of Text components in order to support empty strings.
This is required for parity with Paper.
I created a follow up task to analyze support of empty string as part of the Text infrastructure of Fabric in the future.

changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D21761171

fbshipit-source-id: d2aa074052b09732af5d35723f19014090fcabbf

* Revert Virtual Text Press Bug workaround

Summary:
This diff reverts the workaround added as part of D21432793, now that D21432793 is released in production for FB4A / FBiOS

changelog:
[Internal]

Reviewed By: JoshuaGross

Differential Revision: D21772129

fbshipit-source-id: 3b39738cb8fc871ec85d87f347c7f0ef408ccc3e

* Clean up Flow & lint errors

Summary: Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D21703338

fbshipit-source-id: f33cf6dfdf8884ae76500ec55f44411e34e8cb76

* Delete ViewPagerAndroid JS and BUCK targets

Summary:
After the experiment in D21198302 ships to 100% and that code is deleted, we no longer need ViewPagerAndroid anywhere in FB so it can be deleted.

This is distinct from deleting the native side of the component, which resides in open-source.

Changelog: [Internal]

Differential Revision: D21211134

fbshipit-source-id: 610e09792b079d34acbfcec836fde58a0b3648a7

* Delete ReactViewPager

Summary:
All ReactViewPager functionality should now be possible by using a ScrollView.

Changelog: [Internal] ReactViewPager has been deprecated on Android and was removed from core as part of LeanCore

Reviewed By: mdvacca

Differential Revision: D21751774

fbshipit-source-id: 292475b9ffe7788b745329d13fd88dc3b613819e

* Update Podfile.lock

* Replace platform check in RCTUtilsUIOverride.h with direct import of RCTUIKit.h

* Add eager initialization of RCTDevMenu to macOS RNTester

* Fix for Android Build Issue after RN64 Merge

Co-authored-by: Christoph Nakazawa <cpojer@fb.com>
Co-authored-by: Kevin Gozali <fkg@fb.com>
Co-authored-by: zhongwuzw <zhongwuzw@qq.com>
Co-authored-by: Tim Yung <yungsters@fb.com>
Co-authored-by: Samuel Susla <samuelsusla@fb.com>
Co-authored-by: Mike Grabowski <grabbou@gmail.com>
Co-authored-by: Joshua Gross <joshuagross@fb.com>
Co-authored-by: Kacie Bawiec <kacieb@fb.com>
Co-authored-by: Nick Gerleman <ngerlem@microsoft.com>
Co-authored-by: Janic Duplessis <janicduplessis@gmail.com>
Co-authored-by: Rubén Norte <rubennorte@fb.com>
Co-authored-by: Will Holen <willholen@fb.com>
Co-authored-by: Mats Byrkjeland <matsbyr@gmail.com>
Co-authored-by: Héctor Ramos <hramos@fb.com>
Co-authored-by: Emily Janzer <janzer@fb.com>
Co-authored-by: Paige Sun <paigesun@fb.com>
Co-authored-by: Rick Hanlon <rickhanlonii@fb.com>
Co-authored-by: Nat Mote <nmote@fb.com>
Co-authored-by: Valentin Shergin <shergin@fb.com>
Co-authored-by: David Vacca <dvacca@fb.com>
Co-authored-by: Nikita Lutsenko <nlutsenko@fb.com>
Co-authored-by: Yuanzhe Bian <rijn@fb.com>
Co-authored-by: Pieter De Baets <pieterdb@fb.com>
Co-authored-by: Eloy Durán <eloy.de.enige@gmail.com>
Co-authored-by: João Vieira <joaovieira@fb.com>
Co-authored-by: Enes <enesozturk.d@gmail.com>
Co-authored-by: empyrical <empyrical@outlook.com>
Co-authored-by: Peter Argany <petetheheat@fb.com>
Co-authored-by: William Candillon <wcandillon@gmail.com>
Co-authored-by: Manvir Singh <gurs1kh@live.com>
Co-authored-by: Lulu Wu <luluwu@fb.com>
Co-authored-by: Moti Zilberman <moti@fb.com>
Co-authored-by: Kacper Wiszczuk <kacperwiszczuk@gmail.com>
Co-authored-by: Vitaly Potlov <potlov@gmail.com>
Co-authored-by: Martin Sherburn <mns@fb.com>
Co-authored-by: Eli White <eliwhite@fb.com>
Co-authored-by: Ramanpreet Nara <ramanpreet@fb.com>
Co-authored-by: Sidharth Guglani <sidharthguglani@fb.com>
Co-authored-by: Keegan Mendonca <mendoncakeegan@fb.com>
Co-authored-by: Aditya Kumar <aditya7@fb.com>
Co-authored-by: Ram N <axe@fb.com>
Co-authored-by: duan <wddwyss@gmail.com>
Co-authored-by: Daniel Weaver <danielw@fb.com>
Co-authored-by: Vojtech Novak <vonovak@gmail.com>
Co-authored-by: lukewalczak <lukasz.walczak.pwr@gmail.com>
Co-authored-by: Mike Vitousek <mvitousek@fb.com>
Co-authored-by: Daniel Sainati <sainati@fb.com>
Co-authored-by: Joshua Selbo <jselbo@fb.com>
Co-authored-by: Sakamoto, Kazunori <exKAZUu@users.noreply.github.com>
Co-authored-by: generatedunixname89002005287564 <generatedunixname89002005287564@fb.com>
Co-authored-by: Jimmy Zhang <jimmyzh@fb.com>
Co-authored-by: Ishan Khot <ishankhot@fb.com>
Co-authored-by: Fanghao <chen.fanghao517@gmail.com>
Co-authored-by: Christoph Purrer <chpurrer@fb.com>
Co-authored-by: Jacek Burys <jacekburys@fb.com>
Co-authored-by: Riley Dulin <dulinr@fb.com>
Co-authored-by: Mayuresh Gharpure <Mayuresh.Gharpure@microsoft.com>
2021-08-16 14:00:00 -07:00
Xuan Huang d9a9ae38d1 Conditionalize the Regenerator Setup
Summary:
Changelog: [Internal]

If generators are provided natively, that should suggest that the JS source
code did not go through the regenerator-transform (e.g. in Metro Hermes profile),
then there is no need to set up the regenerator runtime.

This should save some work during the Core initialization.

Reviewed By: motiz88

Differential Revision: D29986751

fbshipit-source-id: 129f5122e8e4c05535ee2aa5da6970a66843e8cd
2021-08-02 19:43:04 -07:00
Xuan Huang 06388891a3 Extract feature detection as an utilitiy module
Summary:
Changelog: [Internal]

This diff only extracted the `isNativeFunction` used in `setUpTimers`
into the `FeatureDetection` utility, but later we will add more functions
in it and reuse them in other places.

Reviewed By: RSNara

Differential Revision: D29986750

fbshipit-source-id: 6e48e38d92ceccb35eead3c52e00e1eecb81b5b0
2021-08-02 19:43:04 -07:00
Xuan Huang dc8d218077 Shim Immediate APIs when Promise is queueing to JSVM
Summary:
Changelog: [Internal]

Historically, Immediate API is implemented upon the React Native's
internal microtask-y queue (known as "immediate queue"), which
is the same queue Promise polyfill is operating on.

To make React Native suitable of using the built-in Promises from JSVMs,
which usually enqueues to the JSVM internal microtask queue and has no
access to React Native microtask-y queue, we need to migrate the
Immediate API to use the JSVM microtask queue as well to preserve the
semantics of code relies on the interleaving of promises and immediates.

To do that, this diff implement a shim layer for immediate APIs via the
new `global.queueMicrotask` API (which enqueues to JSVM) in JS, by wrapping
the immediate callback into a "microtask callback", which validate the
`immediate ID` against `clearedImmediate` Set before invoking it.

Reviewed By: RSNara

Differential Revision: D29845305

fbshipit-source-id: c2ed3fed426a5316b1e0dfbfaad51706d1765d4d
2021-07-28 13:37:54 -07:00
Xuan Huang be189cd819 Introduce queueMicrotask API
Summary:
Changelog:
[General][Added] - Add global.queueMicrotask

`queueMicrotask` is a relatively recent API defined in the WHATWG HTML spec
and it's been widely adopted by all web browsers and Node.js.

This diff introduced it to React Native by polyfilling it via a lazily-allocated
resolved Promise, or calling directly into a fast path provided by Hermes.

Reviewed By: RSNara

Differential Revision: D29838852

fbshipit-source-id: 8c4378b1b713fb8b0da5e67f92ba2ea9838766f7
2021-07-28 13:37:54 -07:00
Xuan Huang 37dc1d44a5 Rename immediate to ReactNativeMicrotask in Bridge
Summary:
Changelog: [Internal]

This diff replaced all the internal occurrences of "Immediate" with
"ReactNativeMicrotask" in the legacy bridge and then polyfilled the
original immediate APIs during the timer setup phases as aliases of them.

Note that this diff is part of a larger refactoring.

Reviewed By: RSNara

Differential Revision: D29785430

fbshipit-source-id: 7325d2a7358a6c9baa3e9abb8acf90414de5072f
2021-07-27 00:51:34 -07:00
Martin Sherburn e539e7d0be Fix bug in parseHermesStack.js
Summary:
If function name is an empty string then it would fail to parse the line. And not only that, it would cause the entire stack to be lost. This fixes the issue by replacing `.+?` with `.*?`.

For example this line fails to parse:
```
    at global (:2:4)
```

Changelog:
[General][Fixed] - Fixed bug parsing hermes call stacks when the file name is empty

Reviewed By: yungsters

Differential Revision: D29063192

fbshipit-source-id: 604e457af51f852fe547e6424283631ae148897d
2021-06-14 02:57:37 -07:00
Tim Yung e4a4c4d6d7 ExceptionsManager: Report Fatal "Warnings"
Summary:
As suggested by motiz88 on D28421692 (883e0d5752), make sure to still report fatal "warnings".

Changelog:
[General][Fixed] Report fatal errors even if its `type` is "warn".

Reviewed By: motiz88

Differential Revision: D28815228

fbshipit-source-id: 8d3b77958ef687a4ce64bdfccbf6ce2dc5557eaf
2021-06-02 01:31:50 -07:00
Daniel Sainati 74d5d03dbd pre-suppress Flow errors in xplat ahead of 153 release
Summary:
This pre-suppresses the 153 error diff ahead of its release, since it is large.

Changelog: [Internal]

Reviewed By: mroch

Differential Revision: D28754374

fbshipit-source-id: 1806f53bc7d804644d434583a2dcd6da63d00328
2021-06-01 09:01:26 -07:00
Tim Yung 883e0d5752 RN: Suppress Warning-Like Errors
Summary:
Changes `ExceptionsManager` in React Native so that errors with a `type` property equal to `'warn'` are not reported.

This change is banking on the fact that `type` is a non-standard and uncommon property on `Error` instances. If this ends up being problematic, we can instead change this to use a `unstable_type` or `unstable_level` property instead.

Changelog:
[General][Changed] - ExceptionsManager will no longer report exceptions with `type === 'warn'`.

Reviewed By: motiz88

Differential Revision: D28421692

fbshipit-source-id: 3ca19e29f32c8c5cad6dac637dcb930944fb24ed
2021-05-20 19:08:25 -07:00