Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always keep disabled logs in the second pass #21739

Merged
merged 4 commits into from Jun 24, 2021
Merged

Conversation

gaearon
Copy link
Collaborator

@gaearon gaearon commented Jun 23, 2021

For some class methods, we were disabling logs during the first rather than the second render. This can cover up issues if we deduplicate warnings. To fix, swap the order so the first render is consistently the one that has the logs.

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Jun 23, 2021
@gaearon gaearon requested a review from sebmarkbage June 23, 2021 20:39
@sizebot
Copy link

sizebot commented Jun 23, 2021

Comparing: 355591a...adfa3d4

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 127.39 kB 127.39 kB = 40.83 kB 40.83 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 130.20 kB 130.20 kB = 41.74 kB 41.74 kB
facebook-www/ReactDOM-prod.classic.js = 405.80 kB 405.80 kB = 75.02 kB 75.01 kB
facebook-www/ReactDOM-prod.modern.js = 394.23 kB 394.23 kB = 73.25 kB 73.25 kB
facebook-www/ReactDOMForked-prod.classic.js = 405.80 kB 405.80 kB = 75.02 kB 75.02 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against adfa3d4

Copy link
Member

@rickhanlonii rickhanlonii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice fix this was annoying

packages/react/src/__tests__/ReactStrictMode-test.js Outdated Show resolved Hide resolved
Copy link
Contributor

@bvaughn bvaughn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this change is okay. Seems like it has a chance to cause downstream issues though so maybe worth keeping in mind if we notice any regressions?

// there is a risk of suppressing warnings when they happen,
// and on the next render they'd get deduplicated and ignored.
expect(console.log.calls.all().map(c => c.args)).toEqual([['foo 1']]);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice tests 👍🏼


if (__DEV__) {
warnOnUndefinedDerivedState(ctor, partialState);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, so this PR does more than just disable logs during the second pass. It also changes the code to use the result of the first pass rather than the second pass? Should be okay so long as there are no unsafe side effects?

I think that using the 2nd call (for this and other methods below) may have been an intentional choice in case there were side effects.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. I haven't thought about this. I do vaguely remember some two year old conversations about this. Maybe let's hold off merging and keep it for the next sync discussion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool beans 👍🏼

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the double rendering order in general is very intentional eg renderWithHooks.

However I noticed when doing the Fizz parts that some of the class ones are reverse order. I'm not sure that was intentional or an oversight when we intentionally did the other ones.

Because I think there are some subtle semantic issues with things like memoization in general that's an issue here. Deduping warnings being one such memoization that breaks.

Copy link
Collaborator Author

@gaearon gaearon Jun 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way we do it with Hooks is we disable logs during the second one and use the result of the second one. I could make everything match that.

Copy link
Contributor

@tjallingt tjallingt Jun 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been extremely confused before why the logs and the returned values didn't match... Maybe disabling the logs on the first call and enable logs and use the result of the second call? On the other hand that might make it even harder to deduce whats happening since you can't "see" the first call at all...

// Invoke the function an extra time to help detect side-effects.
instance.shouldComponentUpdate(newProps, newState, nextContext);
} finally {
reenableLogs();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think reEnableLogs is better than reenableLogs

@gaearon
Copy link
Collaborator Author

gaearon commented Jun 24, 2021

I changed for consistency to use the second result always (but enable logs during the first pass). We can revisit them all together later but at least it matches up now.

@gaearon gaearon merged commit 51b0bec into facebook:master Jun 24, 2021
facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Jul 24, 2021
Summary:
This sync includes the following changes:
- **[cae635054](facebook/react@cae635054 )**: `act`: Resolve to return value of scope function ([#21759](facebook/react#21759)) //<Andrew Clark>//
- **[e2453e200](facebook/react@e2453e200 )**: act: Add test for bypassing queueMicrotask ([#21743](facebook/react#21743)) //<Andrew Clark>//
- **[534c9c52e](facebook/react@534c9c52e )**: Move error logging to update callback ([#21737](facebook/react#21737)) //<Dan Abramov>//
- **[51b0becf3](facebook/react@51b0becf3 )**: Always keep disabled logs in the second pass ([#21739](facebook/react#21739)) //<Dan Abramov>//
- **[7fec38041](facebook/react@7fec38041 )**: Log and show error overlay for commit phase errors ([#21723](facebook/react#21723)) //<Dan Abramov>//
- **[27c9c95e2](facebook/react@27c9c95e2 )**: act: Bypass microtask for "default sync" updates ([#21740](facebook/react#21740)) //<Andrew Clark>//
- **[355591add](facebook/react@355591add )**: Next/experimental release versions include commit date ([#21700](facebook/react#21700)) //<Brian Vaughn>//
- **[d7dce572c](facebook/react@d7dce572c )**: Remove internal `act` builds from public modules ([#21721](facebook/react#21721)) //<Andrew Clark>//
- **[06f7b4f43](facebook/react@06f7b4f43 )**: `act` should work without mock Scheduler ([#21714](facebook/react#21714)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 568dc35...cae6350

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross, ShikaSD

Differential Revision: D29555979

fbshipit-source-id: 0afc869cc007bce417f0020d3ee4dc8b0ea5beb9
HeyImChris added a commit to microsoft/react-native-macos that referenced this pull request Jan 25, 2022
* Adding metadata to React Native QPL points

Summary:
Changelog:
[General][Added] - Added data field to markerPoint to allow callers to add additional arbitrary string data to logged points

Reviewed By: dmitry-voronkevich

Differential Revision: D29764274

fbshipit-source-id: b0d21e3b20a5353351424afb10c950f3e8689887

* Resolve some XCode warnings (#31883)

Summary:
UIAccessibilityVoiceOverStatusChanged deprecated (iOS 11+) in favor for UIAccessibilityVoiceOverStatusDidChangeNotification ref: https://developer.apple.com/documentation/uikit/uiaccessibilityvoiceoverstatuschanged?language=objc

topLayoutGuide/bottomLayoutGuide deprecated (iOS 11+) in favor for safeAreaLayoutGuide ref: https://developer.apple.com/documentation/uikit/uiviewcontroller/1621367-toplayoutguide

This block declaration is not a prototype warnings fixed by adding void to specify no parameters ref: https://stackoverflow.com/questions/47916585/objective-c-block-parameter-issue-this-block-declaration-is-not-a-prototype

## 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] - Resolved some deprecations

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

Test Plan: Tests should pass, no functionality should change.

Reviewed By: fkgozali

Differential Revision: D29822033

Pulled By: mdvacca

fbshipit-source-id: dec8d612885634aca090ac3372cd4c7bf8a197ee

* Migrate to androidx.autofill.HintConstants & Support all constant types (#28008)

Summary:
Fix for https://github.com/facebook/react-native/issues/27952.

Noticed more than just `AUTOFILL_HINT_NEW_PASSWORD` were missing, this PR will support every `AUTOFILL_HINT_*` type.

## Changelog

[Android] [Added] - Added all autofill types to TextEdit

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

Reviewed By: sturmen

Differential Revision: D29766235

Pulled By: mdvacca

fbshipit-source-id: d5171aef8092d37716fddcb6f3443637a4af8481

* Fix mislabelled polyfills for Object.entries and Object.values (#31880)

Summary:
The polyfills for `Object.entries` and `Object.values` are in a file named `Object.es7.js` when these APIs form part of ES8/ES2017 (https://en.wikipedia.org/wiki/ECMAScript#8th_Edition_–_ECMAScript_2017).

The docs (https://reactnative.dev/docs/javascript-environment#polyfills) list these correctly as ES8 so I thought it might reduce confusion if anyone starts looking into the polyfills in the future like I did.

## 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 filename to include correct ECMA spec

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

Test Plan: All unit tests pass.

Reviewed By: yungsters

Differential Revision: D29820165

Pulled By: ShikaSD

fbshipit-source-id: 2a4eb58bed7b7a4089406665c5c9115cb1773ff6

* integrate RCTImpressionTrackingView into Fabric on Android

Summary:
This diff integrates RCTImpressionTrackingView into Fabric on Android

Following
https://www.internalfb.com/intern/wiki/React_Native/Migration_of_RN_Renderer_(Fabric)/
and
https://fb.quip.com/T8AtArEVcb0Z

Changelog: [Internal]

Reviewed By: bearzx

Differential Revision: D29804625

fbshipit-source-id: 16e89d629390093ace51d3b25725c37a49a08a39

* Implement textTransform prop

Summary:
Added to C++ props, but realized this is already implemented using C++ state in Android, so added to C++ state to keep this diff simpler. Keeping the C++ props change for future use.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D29805267

fbshipit-source-id: c1fe2dc34af8bc69352ee48a5d60ba998194e3f7

* Manually some remove existential types from xplat/js

Summary:
Manually remove some existential types.

Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D29724881

fbshipit-source-id: e21558dc033fa07d0b8a188eb64e14ddcf7df2ac

* Remove existential types from xplat/js

Summary: Changelog: [Internal]

Reviewed By: pieterv

Differential Revision: D29724915

fbshipit-source-id: 97cbeefbba2ddc2e1088dfe19db14fa545213549

* Deploy 0.156.0 to xplat

Summary: Changelog: [Internal]

Reviewed By: gkz

Differential Revision: D29833943

fbshipit-source-id: cb0260e1f4119b4208d42ef1267e253f6f84ff19

* RN: 5s Delay in `ReactAppInstrumentationTestCase`

Summary:
Tests like `CatalystSubviewsClippingTestCase` are intermittently failing due to registered callable modules not yet being registered.

Increasing the timeout to wait for the bundle execution to mitigate these intermittent failures.

Changelog:
[Internal]

Reviewed By: mdvacca

Differential Revision: D29835227

fbshipit-source-id: c9fe03202ad4028d3785216d50c6c173a56c6d84

* Wrong warning message

Summary:
* it says focusTextInput but the function name is blurTextInput
* probably the message was copy-pasted from `focusTextInput` where is the same error message.

Changelog: [Internal]

Reviewed By: arhelmus

Differential Revision: D29845922

fbshipit-source-id: 21fd3e572c32779c13f6909556153d07dc7a416f

* Add flow, flowfixmes to RNTesterModuleContainer and Animation examples

Summary: Changelog: [Internal] - RNTester: Add flow to RNTesterModuleContainer, render example as component, remove flowfixmes from Animation examples

Reviewed By: yungsters

Differential Revision: D29783772

fbshipit-source-id: 64ec6f247822b25c8cc6f64b192d17081be9c1f9

* Add useNativeDriver toggle UI

Summary:
Changelog: [Internal] - Update Animation examples to toggle useNativeDriver

There are issues when we toggle the native driver on and off. Where once off, the animations don't seem to update anymore, until we turn nativeDriver back on. See videos in testplan

Reviewed By: yungsters

Differential Revision: D29774939

fbshipit-source-id: cf6d70c1b574a87bb803510196dfb273b36de5e1

* Downgrade warning of view illegally being added to parent to Soft Exception

Summary: - This is crashing too much in debug, which is good signal but making it harder to test, and test unrelated features.

Reviewed By: JoshuaGross

Differential Revision: D29857626

fbshipit-source-id: c52cfb6131747ae420b27de0591620fe79f47359

* Add INFO, and MENU key event support to Android TV (#31884)

Summary:
Add INFO, and MENU key event support to Android TV

## Changelog

[Android] [Added] - Add INFO, and MENU key event support to Android TV

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

Test Plan: We develop application that utilizes aforementioned events, we've made a build against react-native fork with these changes and it was working as expected. These changes just add 2 more button mappings, so I don't think it requires some extensive testing.

Reviewed By: mdvacca

Differential Revision: D29821996

Pulled By: yungsters

fbshipit-source-id: 5f97c29c9c29d6e3bafed352b8b65f0cb02f3f1d

* Bump Flipper to 0.99.0 (#31896)

Summary:
Includes fix included in a Flipper Pod for incorrect timestamps in the Network viewer with iOS apps
https://github.com/facebook/flipper/commit/1cf745613390e5ce87b72e09016c42784cb0566a

## 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][changed] - Update Flipper to 0.99.0

[CATEGORY] [TYPE] - Message

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

Reviewed By: fkgozali

Differential Revision: D29881218

Pulled By: mdvacca

fbshipit-source-id: a206faa3d7b969a708d286884cff83bed5453d22

* Fix testID support for TextInput, Slider and ScrollView component (#31865)

Summary:
With the advent of https://github.com/facebook/react-native/issues/29610, we are now able to use the `testID` view prop on Android in black-box testing framework through the  view's `resource-id`.

But after testing it, I noticed that on the `TextInput`, `Slider` and `ScrollView` components, the `testID` prop was not exposed as  the `resource-id` properly. The main issue was that those component was using the `AccessibilityDelegateCompat` instead of the `ReactAccessibilityDelegate`.

## Changelog

[Android] [Fixed] - Fix `testID` prop for `TextInput`, `Slider` and `ScrollView` components

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

Test Plan: ![test-screenshot](https://user-images.githubusercontent.com/69216913/125802180-c0791a8c-a740-4657-a44f-42b1885eee39.png)

Reviewed By: mdvacca

Differential Revision: D29765333

Pulled By: yungsters

fbshipit-source-id: 2b8e362257e3e5fdcd20330280c588dabb44f28a

* EditText: maintain cursor position when text changes

Summary:
Similar to D29786190 (https://github.com/facebook/react-native/commit/b0e39b2ed9b66b378eb75bee9e692fc801431ddd) on iOS, keeps cursor position constant to the end of the text whenever text changes without selection updates.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D29879663

fbshipit-source-id: da1b50a99ae3b9ef796423146ba49e4172e286df

* Expose new API RuntimeExecutor.executeSynchronouslyOnSameThread_CAN_DEADLOCK

Summary:
This diff exposes a new API Expose new API RuntimeExecutor.executeSynchronouslyOnSameThread_CAN_DEADLOCK. This API will be used by the next diffs of the stack

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D29764996

fbshipit-source-id: e6cd6799e16f2e47a353b7504d58d80aa49447d8

* Expose new struct InspectorData

Summary:
This diff exposes a new struct InspectorData that will be used by FabricUIManager.getInspectorDataForInstance to return metadata of stacktraces.

See next diffs of the stack

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D29764995

fbshipit-source-id: 6a2ab819623e379795e59002be0e4d40ac73b9a6

* Expose new API FabricUIManager.getInspectorDataForInstance

Summary:
This diff exposes a new API in FabricUIManager called getInspectorDataForInstance. The goal of this method is to return React metadata for a Native view.

This data will be used from partner teams to build tools that uses React metadata in RN

Data returned from React: P429701924

changelog: [internal] internal

allow-large-files

Reviewed By: JoshuaGross

Differential Revision: D29747864

fbshipit-source-id: 8cb55573be08cb530f7e3c83eed8b4fcf43e7781

* React Native sync for revisions 568dc35...cae6350

Summary:
This sync includes the following changes:
- **[cae635054](https://github.com/facebook/react/commit/cae635054 )**: `act`: Resolve to return value of scope function ([#21759](https://github.com/facebook/react/pull/21759)) //<Andrew Clark>//
- **[e2453e200](https://github.com/facebook/react/commit/e2453e200 )**: act: Add test for bypassing queueMicrotask ([#21743](https://github.com/facebook/react/pull/21743)) //<Andrew Clark>//
- **[534c9c52e](https://github.com/facebook/react/commit/534c9c52e )**: Move error logging to update callback ([#21737](https://github.com/facebook/react/pull/21737)) //<Dan Abramov>//
- **[51b0becf3](https://github.com/facebook/react/commit/51b0becf3 )**: Always keep disabled logs in the second pass ([#21739](https://github.com/facebook/react/pull/21739)) //<Dan Abramov>//
- **[7fec38041](https://github.com/facebook/react/commit/7fec38041 )**: Log and show error overlay for commit phase errors ([#21723](https://github.com/facebook/react/pull/21723)) //<Dan Abramov>//
- **[27c9c95e2](https://github.com/facebook/react/commit/27c9c95e2 )**: act: Bypass microtask for "default sync" updates ([#21740](https://github.com/facebook/react/pull/21740)) //<Andrew Clark>//
- **[355591add](https://github.com/facebook/react/commit/355591add )**: Next/experimental release versions include commit date ([#21700](https://github.com/facebook/react/pull/21700)) //<Brian Vaughn>//
- **[d7dce572c](https://github.com/facebook/react/commit/d7dce572c )**: Remove internal `act` builds from public modules ([#21721](https://github.com/facebook/react/pull/21721)) //<Andrew Clark>//
- **[06f7b4f43](https://github.com/facebook/react/commit/06f7b4f43 )**: `act` should work without mock Scheduler ([#21714](https://github.com/facebook/react/pull/21714)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 568dc35...cae6350

jest_e2e[run_all_tests]

Reviewed By: JoshuaGross, ShikaSD

Differential Revision: D29555979

fbshipit-source-id: 0afc869cc007bce417f0020d3ee4dc8b0ea5beb9

* Before removing a task from queue, make sure it was executed

Summary:
Changelog: [internal]

If task that is being executed schedules a new task with higher priority, the new task will be dropped from the queue. To fix this, we always check if the top of the queue is what was executed and only then remove it.

Example:
Let's say there is task A with priority "normal".

When we execute task A (which is not removed from the queue until later), it adds a task B with "immediate" priority.
So priority queue now has two tasks: [1: B, 2: A]

After task A finishes, inside workLoop, it will pop from top of the priority queue. But task A is no longer top of the priority queue (this is the bug) and it pops B. B is never executed and A is executed twice.

Reviewed By: ShikaSD

Differential Revision: D29841433

fbshipit-source-id: b2f1474fdfc7b3e2d42bae5b7f4ac7e6c3a37b54

* Make mHybridData thread safe for EventEmitterWrapper

Summary:
In T94154173, when calling ```EventEmitterWrapper->invoke()```, hybrid function ```invokeEvent``` is null, even if we checked that ```mHybridData``` is valid before calling ```invokeEvent```.

**Theory:**

```invoke()``` is called from ```mqt_js``` thread, ```desotry()``` is called from ```main``` thread, which cause multi-thread access of```mHybridData```.

So if ```desotry()``` is called after ```isValid()``` check and before calling ```invokeEvent()```, ```invokeEvent``` could be destroyed and is null.

I can reproduce with above theory:

{F633411001}

**Fix:**

Make functions synchronized so ```mHybridData``` can be thread safe.

Changelog:
[Android][Fixed] - Make mHybridData thread safe

Reviewed By: RSNara

Differential Revision: D29792453

fbshipit-source-id: 8b4c754d53ece933be7b2cf99c6cd026b39e24ad

* Make initializeMessageQueueThreads() thread safe

Summary:
**Context:**
Issue:
```java.lang.IllegalStateException: Message queue threads already initialized
	at com.facebook.react.bridge.ReactContext.initializeMessageQueueThreads(ReactContext.java:100)
```

Possible root cause:
1, ReactContext.initializeMessageQueueThreads() can be called from different threads, so it's not thread safe
2, ReactContext.initializeMessageQueueThreads() is called again without detroying the threads.

**Fix:**
Make initializeMessageQueueThreads() thread safe. If this won't fix T93983690, I'll continue investigating with possible root cause 2.

Changelog:
[Android][Changed] - Make initializeMessageQueueThreads() thread safe

Reviewed By: GijsWeterings

Differential Revision: D29877386

fbshipit-source-id: 11b32c7184e9e8d6f882474fd607538df12276b7

* Handle OSS renderers in sync script

Summary: Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D29896358

fbshipit-source-id: 83a9c124a01945706c4bdced8cf6e997e14f831c

* Back out "Use atomic pointer to prevent race during teardown"

Summary:
Changelog: [internal]

Original commit changeset: 390e773283a7

Original diff didn't resolve crash T82119127. Let's back this out and investigate again.

Reviewed By: mdvacca

Differential Revision: D29909878

fbshipit-source-id: 54b054f4a5c97b8f6369f8790c2cf32a56c4fbd2

* Back out "Use atomic pointer for animationDelegate_ to prevent race during teardown"

Summary:
Changelog: [internal]

Original commit changeset: 6cb898caf7c2

This change doesn't fix LayoutAnimation crashes. Let's back it out.

Reviewed By: fkgozali

Differential Revision: D29909973

fbshipit-source-id: 34926ace220e6b269bb938a3da72c977b0608187

* add persistentScrollbar option example for ScrollView (#31895)

Summary:
There was an unused example in ScrollView example, so I've added the example to RNTester App

## 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 persistentScrollbar option example for ScrollView in RNTester App

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

Test Plan: - RNTester App builds and shows example properly on Android

Reviewed By: sshic

Differential Revision: D29881126

Pulled By: mdvacca

fbshipit-source-id: 9e7e61c9d3f712cb767a78e729469fc95cb9953e

* chore: fix dead link in comment (#31902)

Summary:
Fixed a link in a comment that lead to dead link

whatwg-url changed the source directory from `lib` to `src`

## 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 link in a comment

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

Test Plan: - [ ] Changed URL opens properly

Reviewed By: charlesbdudley

Differential Revision: D29915170

Pulled By: lunaleaps

fbshipit-source-id: 00b69db82f51d16cf887cd4540a159132ad7d771

* Remove gating for on demand view mounting

Summary:
Changelog: [internal]

This feature has shipped. I remove gating here.

Reviewed By: mdvacca

Differential Revision: D29906460

fbshipit-source-id: 23433cfd4d618633b135d8c858ce6cf90cfe9fa1

* Add RNTester cases for Animated Easing API

Summary:
- Update `RNTesterNavBar` to be positioned relatively to allow for scroll views to not be clipped
- Add EasingExample with example animations taken from https://reactnative.dev/docs/easing

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D29744160

fbshipit-source-id: d0e2112769d74dd34e11477f1d3b1f8f0ffebc03

* Animated Transform Styles Example

Summary: Changelog: [Internal] - Add an example to demo all the transform properties.

Reviewed By: charlesbdudley

Differential Revision: D29865790

fbshipit-source-id: 79174457071de8fca9b0aab8bf8dcc543ea9a0a3

* 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 (https://github.com/facebook/react-native/commit/5c0da011cbaa788c52519f8091157ca6d87d8abb) and D9173758 (https://github.com/facebook/react-native/commit/8b5e3fc16b1e58441318b6ada629dcff572dd120)

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 (https://github.com/facebook/react-native/commit/3d1afbbda301d48a75e45f73b96cd51ae5105dd8).

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 https://github.com/facebook/react-native/commit/d4ee734f3297463fe7b54af6d69e4ea151cf4cf9.

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 https://github.com/facebook/react-native/commit/df9cd05621f58fe5c67f889b741bfff20c780b0e

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](https://github.com/facebook/react-native/commit/a8337785539d572009d2cc4263aef7755ae03097)

## 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 i…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants