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

22484 Коммитов

Автор SHA1 Сообщение Дата
Kacie Bawiec 2824b68ee8 Remove defaultProps from KeyboardAvoidingView
Summary:
Changelog:
[General][Removed] Remove defaultProps from KeyboardAvoidingView

Reviewed By: lunaleaps

Differential Revision: D27770146

fbshipit-source-id: 61d56c50978cc67287d56349283959b9a32c9a0b
2021-04-16 18:30:22 -07:00
Héctor Ramos bdfe2a5179 Avoid encoding local path in Podfile.lock
Summary:
The `SPEC CHECKSUM` for `FBReactNativeSpec` in `packages/rn-tester/Podfile.lock` and in standalone apps's `ios/Podfile.lock` varies between development machines. This is caused by local paths in the output of `pod ipc spec FBReactNativeSpec.podspec`, such as `output_files` and `prepare_command`. This causes the Podfile.lock to constantly change when pod install is run on different developers' machines.

The codegen script and CocoaPods configuration have been updated to use relative paths.

Closes https://github.com/facebook/react-native/issues/31193

Changelog: [Internal] [Codegen] Avoid encoding local path in Podfile.lock

Reviewed By: fkgozali

Differential Revision: D27754337

fbshipit-source-id: 2f5607d4e1ce21489f28f394cb852c36cace6798
2021-04-16 14:42:34 -07:00
Carlos Cuesta 697164077c Disable `accessibilityState` when `TouchableWithoutFeedback` is `disabled` (#31297)
Summary:
Disable `accessibilityState` when the `TouchableWithoutFeedback` is `disabled`. This fixes https://github.com/facebook/react-native/issues/30953

## Changelog

[General] [Changed] - Disable `accessibilityState` when the `TouchableWithoutFeedback` is `disabled`.

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

Test Plan: Tested the `TouchableWithoutFeedback` component on an Android device

Reviewed By: nadiia

Differential Revision: D27770689

Pulled By: kacieb

fbshipit-source-id: a317246021354ed288b093f8a5e6fbba43d3a04e
2021-04-16 14:37:38 -07:00
Riley Dulin 9e21d54cfc Depend on fbjni directly instead of native/fb
Summary:
The Inspector uses fbjni/JThread.h on Android platforms to get a Java
thread (with a class loader). Use a smaller scope dependency to bring
in fewer things.

Changelog: [Internal]

Reviewed By: neildhar

Differential Revision: D27799508

fbshipit-source-id: 3e1e00cf65596d12c9128fe636ed970238f4aba2
2021-04-16 11:48:21 -07:00
Samuel Susla 318e9f283e Execute multiple tasks within single dispatch
Summary:
Changelog: [internal]

This brings native scheduler close to React's scheduler. React's scheduler executes all tasks in the queue within a single dispatch (they use setTimeout(0) for dispatch) and makes sure to not schedule two dispatches.

Relevant JS code:
https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L359

Reviewed By: JoshuaGross

Differential Revision: D27793200

fbshipit-source-id: 4af13d95cfe4d33d0945f25929ccbea5f9ce5710
2021-04-16 08:16:41 -07:00
Tim Yung d46c87efe4 Back out "Update React DevTools deps from 4.6 -> 4.12"
Summary:
Reverts D27764688 (5a2693d78f) due to a bug with "Invalid hook call." being erroneously reported. We will upgrade again after that bug is resolved.

Changelog:
[Internal]

Reviewed By: fkgozali

Differential Revision: D27813660

fbshipit-source-id: 84a12f19cf1bb7e8aebef0da3ff6f7022c391d3e
2021-04-15 21:16:29 -07:00
Héctor Ramos ae07c53d0b Resolve "fatal: not a git repository" error outside of git repositories
Summary:
CocoaPods will display a "fatal: not a git repository" when these podspecs are consumed within Facebook's internal Mercurial repository due to the reliance on `git` to obtain the current commit hash.

In these cases, the podspec is being consumed locally and the commit hash is unnecessary.

The error is removed by avoiding the use of `git` if the current working directory is not a git repository (or any of the parent directories).

Changelog:
[Internal] [iOS] - Remove CocoaPods error within Facebook's repository

Reviewed By: fkgozali

Differential Revision: D27750974

fbshipit-source-id: 99159611c580baf5526f116948c5ff60e1c02e5c
2021-04-15 13:30:31 -07:00
Ramanpreet Nara e1eb938c9d Create rn_codegen BUCK macro (#31340)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/31340

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D27669950

fbshipit-source-id: 3129d87da8f74d896c0b9e82799b8896b3ed7635
2021-04-15 13:27:38 -07:00
Kacie Bawiec 1747536007 Clean up the initialization of instance variables in ScrollView
Summary:
This is a small cleanup to move initialization out of the `constructor` as it is unnecessary, and it is currently double initializing a few values.

Changelog:
[General][Changed] Clean up the initialization of instance variables in ScrollView

Reviewed By: nadiia

Differential Revision: D27631320

fbshipit-source-id: 762277e4993a9ce86d444ff2d9e845c93e94d1a8
2021-04-15 12:41:48 -07:00
Joshua Gross bd1d4e9f4f StubViewTree: reenable asserts in Delete mutation path
Summary:
I had intended to make this change as part of the stack I landed earlier, but I had some poorly resolved merge conflicts that left this path disabled.

I verified that T76057501 no longer repros and ran unit tests.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D27788467

fbshipit-source-id: 42148b887c6b3c0e815f1805e6bfb3ee58503e48
2021-04-15 11:22:19 -07:00
CodemodService FBSourceClangFormatLinterBot e6dc3717e9 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D27789747

fbshipit-source-id: ef4882e92d7755669083573c43ae6c5088bf01ab
2021-04-15 04:27:14 -07:00
Samuel Susla 8f3ffcf0bb Add unit tests for RuntimeScheduler::cancelTask
Summary:
Changelog: [internal]

Add unit tests for RuntimeScheduler::cancelTask

Reviewed By: JoshuaGross

Differential Revision: D27764482

fbshipit-source-id: 3833e49dd49865be4126bc5c3eb95a40d04bba99
2021-04-15 02:44:13 -07:00
Samuel Susla 4c1fd979a0 Add tests for RuntimeScheduler::scheduletTask and RuntimeScheduler::getShouldYield
Summary:
Changelog: [internal]

Add tests for `RuntimeScheduler::scheduleTask` and `RuntimeScheduler::getShouldYield`

Reviewed By: JoshuaGross

Differential Revision: D27764464

fbshipit-source-id: 8f95dfd9ec1ddf9a0ee17d489961b19e4ceaa9de
2021-04-15 02:44:13 -07:00
Samuel Susla e3a4de8b55 Add unit tests for RuntimeScheduler::now
Summary:
changelog: [internal]

Add unit tests for `RuntimeScheduler::now`

Reviewed By: JoshuaGross

Differential Revision: D27763852

fbshipit-source-id: 1edec8e8338e9d9798b95c55d07114be05f555b8
2021-04-15 02:44:13 -07:00
Samuel Susla eb49f95048 Bootstrap unit tests for RuntimeScheduler module
Summary:
changelog: [internal]

Create module for tests.

Reviewed By: JoshuaGross

Differential Revision: D27764408

fbshipit-source-id: 22681c99d64666bb3a04e961ceeba470062abc51
2021-04-15 02:44:12 -07:00
Joshua Gross dc80b2dcb5 Add mounting layer test that stress-tests differ on (un)flattening
Summary:
Add mounting layer test that stress-tests differ on (un)flattening.

This fails before D27759380 and D27730952, and passes after.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D27767219

fbshipit-source-id: a7e186e510f95792da6f98f80fcae5ff8ac74775
2021-04-14 19:50:10 -07:00
Joshua Gross d1b1e8b80d Differ: ensure all ShadowViews generated by differ have correct LayoutMetrics
Summary:
While I think this was a very marginal bug with no known issues in the wild, incorrect layout values were sometimes being propagated to certain nodes. This would only occur during complex nested (un)flattening operations and may only impact node consistency, specifically with setting the "previous" ShadowView of mutation instructions, specifically REMOVE and DELETE. Even in rigorous testing I had trouble hitting this case and it didn't seem to impact the "next" values in CREATE, INSERT, or UPDATE.

The issue: previously `sliceChildShadowNodeViewPairsV2` assumed that the node it's operating on is a child of a non-flattened view, and the baseline origin is `{0,0}`. You can see when `sliceChildShadowNodeViewPairsRecursivelyV2` is called, a `layoutOffset` is passed in. If we ever got a list of a node that was in a flattened parent by calling `sliceChildShadowNodeViewPairsV2`, we would incorrectly assume that baseline layoutOffset for the node is `0,0`.

Now, we store the layoutOffset in the ShadowViewNodePair and can retrieve it when getting child pairs of a node.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D27759380

fbshipit-source-id: a89756190a1cb377bcc55ff31799c2afbaecdaa9
2021-04-14 19:50:10 -07:00
Joshua Gross c22b874fd6 Differ: ensure ownership of all ShadowView/ShadowNode pairs, ensure consistency of nodes
Summary:
Previously, `ShadowViewNodePair::List` owned each `ShadowViewNodePair` but whenever we put `ShadowViewNodePair` into a TinyMap, those were unowned pointer references. This worked... 99% of the time. But in some marginal cases, it would cause dangling pointers, leading to difficult-to-track-down issues. So, I'm moving both of these to be unowned pointers and keeping a `std::deque` that owns all `ShadowViewNodePair`s and is itself owned by the main differ function. See comments for more implementation details. I'm moderately concerned about memory usage regressions, but practically speaking this will contain many items when a tree is created for the first time, and then very few items after that (space complexity should be similar to `O(n)` where `n` is the number of changed nodes after the last diff).

See comments as to why I believe `std::deque` is the right choice. Long-term there might be data-structures that are even more optimal, but std::deque has the right tradeoffs compared to other built-in STL structures like std::list and std::vector, and is probably better than std::forward_list too. Long-term we may want a custom data-structure that fits our needs exactly, but std::deque comes close and is possibly optimal.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27730952

fbshipit-source-id: 2194b535439bd309803a221188da5db75242005a
2021-04-14 19:50:10 -07:00
Joshua Gross b9828a8afa Differ: fix edge-case where we "REMOVE" an older version of a ShadowNode
Summary:
I am fixing an extremely marginal case that probably impacts nothing in production, but in theory, could - see next diff in stack for the assert that is being hit.

TL;DR in marginal, complex cases with a lot of un/flattening, we can generate the following sequence of mutations:

```
UPDATE node V1 -> V2
REMOVE node V1
```

That is incorrect, and what we actually want is:

```
UPDATE node V1 -> V2
REMOVE node V2
```

While this, again, impacts /nothing/ in prod that we know of, it would be good to get this correct so that we can enable stricter asserts (see next diff).

This will also help with debugging LayoutAnimations.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D27697788

fbshipit-source-id: 47f34fe3e8107167b3df4db841d2cc14c58cb31d
2021-04-14 19:50:09 -07:00
Joshua Gross 39b8233c93 Copy Differ implementation to new file, feature-flag-gate new differ
Summary:
Changes in following diffs will be gated by this feature flag.

The differ in the new file is copied from the current stable implementation and will not be modified until it's deleted.

Changelog: [Internal]

Reviewed By: sammy-SC, mdvacca

Differential Revision: D27775698

fbshipit-source-id: 03d9518ffd2b1f25712386c56a38bd2b4d839fc2
2021-04-14 19:50:09 -07:00
Joshua Gross 5eba5c11b0 Differ: improvements to logging
Summary:
First, I make the breadcrumbs mechanism (landed just this week) more readable - I forgot to add separators between the breadcrumbs.

Second, there is a path that I am 99% sure we never hit. I've had comments to that effect for a ~year, but now I'm adding a falsey assert. If we don't hit it in prod after a few months I'll be more comfortable just deleting the branch entirely (while probably keeping the assert).

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27697786

fbshipit-source-id: 6d74d1703b2212d069fbed510f2655ec17294458
2021-04-14 19:50:09 -07:00
Joshua Gross c83562eb1c StubViewTree: move assert to get better debug logging
Summary:
Move this assert so the debug logging executes first; in the case where this assert fires, we'll get a little more information (for Android, where attaching a Cxx debugger is a bit harder vs iOS).

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27585132

fbshipit-source-id: e3f4cc3d78587744b9e73db685eda1fd6c36ca9d
2021-04-14 19:50:09 -07:00
Joshua Gross 2d7560d7b9 StubViewTree: enable stricter REMOVE asserts
Summary:
With all known remaining issues (outside of LayoutAnimations, potentially) resolved, enable this assert.

Note for future readers: this is the first time this particular assert has EVER been enabled widely, so if we hit this assert in dev, it's great signal for debugging BUT does not necessarily indicate any wide-spread problems in prod, or with any subsystems. This will simply help us become "more correct" over time.

It is possible, but not extremely likely, that cleaning up things that cause this assert will improve stability/crashes.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27697787

fbshipit-source-id: 28fa34eba70548f5001bbd47f41dbe3c6ff3b4c1
2021-04-14 19:50:09 -07:00
Kevin Gozali 0cab4469b2 iOS: Introduced RCT_NEW_ARCHITECTURE build flag to separate old vs new architecture
Summary:
In order to move away from the legacy system (bridge etc), we need to decouple the new architecture assumptions from it. This flag and assertion functions will help track the runtime and report violations along the way. The goal is to have 0 violation before switching over to the pure new architecture.

Note: this is not used right now.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D27783246

fbshipit-source-id: 61f0d77c129bddcde7f24a803432f2d359c5bff3
2021-04-14 19:47:31 -07:00
Brian Vaughn 5a2693d78f Update React DevTools deps from 4.6 -> 4.12
Summary:
Update `react-devtools-core` and `react-devtools` dependencies for RN, VSCode, Sonar, etc.

# Changelog:

[General][Changed] - Upgraded react-devtools-core dependency to 4.12.0

Reviewed By: gaearon

Differential Revision: D27764688

fbshipit-source-id: faa179cf4be3b49b14244d47ee0b91ae63138b8b
2021-04-14 13:37:43 -07:00
Kacie Bawiec 328f4ee06b Clean up imports and update KeyboardAvoidingView to @flow strict-local
Summary:
Changelog:
[General][Changed] Clean up imports and update KeyboardAvoidingView to flow strict-local

Reviewed By: lunaleaps, nadiia

Differential Revision: D27720919

fbshipit-source-id: 9863c2de0ad34889dbde87c7d5ad9316bda24649
2021-04-14 12:03:47 -07:00
Jorge Rossi d9a86aa651 Convert SafeAreaView to ES Module (#31344)
Summary:
Convert SafeAreaView to ES Module (https://github.com/facebook/react-native/issues/31330).

## Changelog

[General] [Changed] - Converted `SafeAreaView` to ES Module.

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

Test Plan: Tested that `npm test` passes.

Reviewed By: kacieb

Differential Revision: D27767463

Pulled By: lunaleaps

fbshipit-source-id: fd3aee58ae6d621a292ff3360d8833f5e5007d52
2021-04-14 11:48:42 -07:00
Kacie Bawiec 50c3dd3860 Update View to use import instead of require
Summary:
Changelog:
[General][Changed] Update View to use import instead of require

Reviewed By: lunaleaps

Differential Revision: D27747147

fbshipit-source-id: 49bd705bd475ca518829d3364550c14ec2ac1da8
2021-04-14 11:10:31 -07:00
Peter Argany 9729d4dfeb Revert a small change to UIManagerBinding
Summary:
Changelog: [Internal]

This reverts a small change from D26885562 (ea1f9531f0). I'm not sure if this change was made intentionally (feel free to reject this diff if it was luluwu).

Before D26885562 (ea1f9531f0), if `RN$Bridgeless` was truthy and `RN$stopSurface` was falsey, then the function returned. After D26885562 (ea1f9531f0), it ran the else clause (which shouldn't be run in bridgeless mode IIUC).

Reviewed By: mdvacca

Differential Revision: D27751583

fbshipit-source-id: daaf5c72fec11f4b2e21d1d2926a5026b984461f
2021-04-14 10:37:50 -07:00
Joshua Gross ff47b0eecd Mounting: log more information in iOS-only REMOVE assert
Summary:
Log a little more information in the iOS-only assert checking that the REMOVE index is correct.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D27632457

fbshipit-source-id: 56e668dc2f22841e3cf3d838ba605d63cc7c1bad
2021-04-14 10:34:57 -07:00
Joshua Gross 88c3090066 Correct LayoutMetrics comparison and make debuggable
Summary:
Allow conversion of LayoutMetrics to DebuggableString.

We also skipped a field in comparison. It probably isn't impactful in terms of production issues, but still wasn't correct.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D27709451

fbshipit-source-id: 987fc2de0a4562a295d6cbeffdd922cbf056b811
2021-04-14 09:41:41 -07:00
Brian Vaughn 60a18c138c Don't disconnect DevTools WebSocket connection on Cmd+D
Summary:
When the React Native Cmd+D menu is opened, something re-runs module initialization code (including DevTools backend initialization) which recreates the `WebSocket` and kills any already-connected frontend.

It's not clear to me why this is done. (Intentional? Accident?) But it makes it difficult to connect the React Native Inspector and DevTools together without multiple reloads. This Diff prevents the Cmd+D menu from killing the `WebSocket` connection as a workaround. A better long-term fix would (probably) be to not eagerly re-run these modules.

## Changelog

[General] [Fixed] - Don't disconnect DevTools WebSocket connection on Cmd+D

Reviewed By: fkgozali, sammy-SC

Differential Revision: D27742376

fbshipit-source-id: 60ab3e4763da6b055c28c7aafc6d460e7f4a601d
2021-04-14 07:42:38 -07:00
CodemodService FBSourceBuckFormatLinterBot 73b9f78e33 Daily `arc lint --take BUCKFORMAT`
Reviewed By: zertosh

Differential Revision: D27761011

fbshipit-source-id: 6231e04819b758d0daa1c78b412742be9b23cf3f
2021-04-14 04:05:56 -07:00
Samuel Susla 06753d431a Add expiration date to Task and use it to determine priority
Summary:
Changelog: [internal]

To prevent starvation, this diff implements expiration time as a way to order tasks in priority queue. This stops higher priority tasks from preventing lower priority tasks from running. The same mechanism is implemented in [JavaScript's scheduler](https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js).

Reviewed By: mdvacca

Differential Revision: D27707887

fbshipit-source-id: 3dc734c856a166ef5c17c5045ebd429565ba79f0
2021-04-14 02:53:24 -07:00
Samuel Susla 240588b6d4 Implement RuntimeScheduler::now
Summary:
Changelog: [internal]

Implement RuntimeScheduler::now and exposite it to JavaScript. JavaScripts expects miliseconds and is using `performance.now()` call to get this value.

More about `performance.now()`: https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
JavaScript implementation in Scheduler: https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L71-L82

Reviewed By: JoshuaGross

Differential Revision: D27675512

fbshipit-source-id: bce5ac700e71b1722cd280dfbdd15e141783a3a5
2021-04-14 02:53:24 -07:00
Samuel Susla 52f1d54509 Add implementation for requestPaint
Summary:
Changelog: [internal]

requestPaint is unimplemented on JavaScript scheduler:

https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L445

Reviewed By: mdvacca

Differential Revision: D27651947

fbshipit-source-id: 1e3cece8cbcd330f2408887ceb283ca61374f5bd
2021-04-14 02:53:23 -07:00
Samuel Susla cc3e87c45b Implement RuntimeScheduler::getShouldYield
Summary:
Changelog: [internal]

Implement RuntimeScheduler::getShouldYield and expose it through JSI.
For now we are only returning `false`. The value is backed by atomic_bool and in the future we will be able to indicate that React should yield to native.

JavaScript implementation:
https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L439-L441

Reviewed By: JoshuaGross

Differential Revision: D27648579

fbshipit-source-id: b9313e2efbd9daae8975357df9de803f24a35e89
2021-04-14 02:53:23 -07:00
David Vacca aee07e1203 Integrate react_native_asserts into mapbuffer
Summary:
Integrate react_native_asserts into mapbuffer

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D27753092

fbshipit-source-id: dbeb7f140f3096c8153e2f6bced4e4d9d88b48b8
2021-04-13 21:32:17 -07:00
Kudo Chien e57de5f32f Fix CI "Build Tests: Android Instrumentation Tests" errors (#31352)
Summary:
To fix [the CI error](https://app.circleci.com/pipelines/github/facebook/react-native/8708/workflows/d584348e-941f-4653-96c2-46375894dfaa/jobs/196410)
  There are two errors:
  `error: undefined reference to '__android_log_write'` which solved by adding `-llog` linker flag.

  `ld: error: cannot find -lc++` which workaround by static linking.
  For the root cause, I am thinking that is after [NDK r19](https://developer.android.com/ndk/guides/other_build_systems),
  the `-target` should specificy api level.
  However, buck does not add this accordingly, e.g. `-target armv7-none-linux-androideabi`
  Given wrong target will make NDK to have `cannot find -lc++` error.
  The workaround is to use static linking.
  Since it was an oss_cxx_library, the change should not have impact to Facebook internal testing.

## Changelog

[Internal] [Fixed] - Fix CI "Build Tests: Android Instrumentation Tests" errors

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

Test Plan: Make CI green

Reviewed By: JoshuaGross

Differential Revision: D27757838

Pulled By: fkgozali

fbshipit-source-id: 8f9c80a89c6240938218abacb8a82e3e2e71adbc
2021-04-13 21:25:31 -07:00
Samuel Susla 08ef1df1ba Implement RuntimeScheduler::cancelTask
Summary:
Changelog: [internal]

Implement RuntimeScheduler::cancelTask and expose it through JSI.

JavaScript implementation:
https://github.com/facebook/react/blob/master/packages/scheduler/src/forks/SchedulerNoDOM.js#L384-L397

Reviewed By: mdvacca

Differential Revision: D27648071

fbshipit-source-id: 91ae92b336017596fb658831824e971c7e047cd2
2021-04-13 01:55:04 -07:00
Samuel Susla 3c14c196ca Add return value to RuntimeScheduler unstable_scheduleCallback
Summary:
Changelog: [internal]

unstable_scheduleCallback needs to return reference to the created task so it can be cancelled later.

Reviewed By: mdvacca

Differential Revision: D27622779

fbshipit-source-id: 54160015c7f98e123d08c2e13efac4f498d3ba5e
2021-04-13 01:55:04 -07:00
Samuel Susla 2779129434 Add minimal implementation of RuntimeScheduler::scheduleTask
Summary:
Changelog: [internal]

Add minimal implementation of schedule task. More features and proper scheduling will be added later.

Reviewed By: mdvacca

Differential Revision: D27622138

fbshipit-source-id: b2e4623d38e7217290a6a3c59ccc10a1c13e3a4f
2021-04-13 01:55:04 -07:00
Samuel Susla 71b5178230 Make glog exported depencency of debug module
Summary:
Changelog: [internal]

`glog` needs to be exported dependency because it is used in public headers.

Reviewed By: mdvacca

Differential Revision: D27617632

fbshipit-source-id: 91aa27b641286002a80a8cd5ef2e6fe6c266b452
2021-04-13 01:55:03 -07:00
Samuel Susla 8d5c22edfd Add runtime scheduler priorities
Summary:
Changelog: [internal]

Add runtime scheduler priorities

Reviewed By: JoshuaGross

Differential Revision: D27618305

fbshipit-source-id: 95e4e02f3473acb41bca0c22df7b271a8d710f34
2021-04-13 01:55:03 -07:00
Mike 1b0683533a Android: Fix switch ripple color (#30685)
Summary:
fix https://github.com/facebook/react-native/issues/22370

Use `RippleDrawable` to change ripple color.
According to the [document](https://developer.android.com/reference/android/graphics/drawable/RippleDrawable?hl=en), `RippleDrawable` is added in API 21, so warped the code in the `if` statement for version checking.

## 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 wrong ripple color on Switch component

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

Test Plan:
1. Create an empty app with react-native 0.63.4, copy&paste the App.js from issue https://github.com/facebook/react-native/issues/22370
2. Apply the code for fixing to `node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/views/switchview/ReactSwitch.java`
3. Configure the project to let it Build from ReactAndroid
4. Check if ripple color has changed correctly
5. Use different color on each state and check if it is working

Test device: Android emulator, Pixel 4, API 30

## Screenshot

### Before
Ripple is always in default color

https://user-images.githubusercontent.com/48589760/103573532-5b4cec80-4f09-11eb-96d7-f75efa6779d9.mov

### After
Ripple color has changed with thumb color

https://user-images.githubusercontent.com/48589760/103573216-d95cc380-4f08-11eb-98fb-494e28c12a9f.mov

Check different color on each state

https://user-images.githubusercontent.com/48589760/103573227-de217780-4f08-11eb-8992-ede5d1dd89c1.mov

Reviewed By: mdvacca

Differential Revision: D27636802

Pulled By: lunaleaps

fbshipit-source-id: fa23cc8b51c642e5e5d9c73371c8ccef3741fd14
2021-04-12 13:57:27 -07:00
Andrei Shikov a17e3cf893 Avoid mounting tree on mode change if it wasn't commited
Summary:
Changelog: [Internal]

Calls to `surfaceHandler.start()` and `setDisplayMode(DisplayMode::Visible)` in quick succession on different threads can cause a race condition between mount and commit operations.

The mountingCoordinator will try to mount an empty revision without any commits causing it to fail with:
```
TransactionTelemetry.cpp:108: function getCommitStartTime: assertion failed (commitStartTime_ != kTelemetryUndefinedTimePoint)
```
which is called from [Binding.cpp](https://www.internalfb.com/intern/diffusion/FBS/browse/master/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.cpp?lines=791-791&blame=1).

This change avoids this initial commit by verifying we had at least 1 revision commited before mounting it.

Reviewed By: sammy-SC

Differential Revision: D27430174

fbshipit-source-id: d208d55f02cd218a316d6fea62d0106c2bcb4be8
2021-04-12 13:17:52 -07:00
Andrei Shikov 214aaf2703 Move surface handler registration to Binding.cpp
Summary:
Changelog: [Internal]

Inverts registration of a SurfaceHandler with the scheduler: instead of passing a scheduler to the SurfaceHandlerBinding, we can now query the SurfaceHandler and register it in place.

Reviewed By: JoshuaGross

Differential Revision: D27624541

fbshipit-source-id: db5d7f1375fad72a805309a3fcd5a33080e4a4a7
2021-04-12 13:17:52 -07:00
Andrei Shikov 5cba7c0ce7 Add a way to prerender the surface
Summary:
Changelog: [Internal]

Links APIs in Fabric and Venice to create a surface without a view and mount it separately when surface is started the usual way.

Reviewed By: mdvacca

Differential Revision: D27339365

fbshipit-source-id: d1b674ce856957465eb6f3a5d7f26eb0ab625353
2021-04-12 13:17:52 -07:00
Nadiia D d65b5895ce Rewrite Modal to a functional component and add gating for the change
Summary:
Changelog:
[Internal][Added] - Use injected Modal if set

Due to Modal uses AppContainer in a dev env, in the StrictMode we'll get warnings about legacy context API usage from inside the AppContainer.

It's a gnarly change to get rid of that legacy context so I'll be following up with additional code change prep steps towards the eventual removal of the legacy context.

Reviewed By: lunaleaps

Differential Revision: D27611218

fbshipit-source-id: f79475845e763527fff9ecfdbf3e581c4666e015
2021-04-12 12:47:00 -07:00
Tim Yung cb6cbd12f8 EventEmitter: Deprecate `removeSubscription`
Summary:
Deprecates `EventEmitter#removeSubscription`. This required temporarily introducing a new `__removeSubscription` method that is only invoked by `EmitterSubscription`. This is necessary so that we do not completely break usages of `EventEmitter` that are supplying constructor arguments (which is also deprecated, but still supported until the next release).

Calling this method will now cause a warning to appear with instructions to instead invoke `remove()` on the subscription itself.

Lastly, changed `console.error` deprecation notice to instead use `console.warn`. This is in line with the principle that errors are "broken today" and warnings will be "broken tomorrow".

Changelog:
[General][Deprecated] - `EventEmitter#removeSubscription` is now deprecated.

Reviewed By: rubennorte

Differential Revision: D27704279

fbshipit-source-id: 581f5b2ab46b1bcfc1d20898b3d3392988dccbd5
2021-04-12 12:43:07 -07:00