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

21779 Коммитов

Автор SHA1 Сообщение Дата
Joshua Gross 4f3b174120 Guard against setId being called on the ReactRootView outside of RN core
Summary:
The RootView being managed by Fabric should have an id of View.NO_ID when it is "handed over" to RN. This is true for Fabric and non-Fabric
and setting a custom id on the ReactRootView has never been supported. I'm temporarily (?) adding an additional check earlier and into ReactRootView to hopefully
catch any of these issues early.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26077509

fbshipit-source-id: 59e1ec080504e50698acc654c29120f039238a96
2021-01-26 10:51:28 -08:00
Joshua Gross 335d9d88e1 Fix `sendAccessibilityEvent` in Fabric
Summary:
This logic got reversed.

Changelog: [internal]

Differential Revision: D26070642

fbshipit-source-id: 4c68e4af25d4907746a09e7a3afe175d88a25f95
2021-01-26 00:50:56 -08:00
Valentin Shergin 9e16ac93ed Fabric: Simplifications in UIManagerBinding::completeRoot
Summary:
This is a small simplification of the logic we have in UIManagerBinding choosing the way to call `completeRoot`. It removes an additional check for for `sharedUIManager->backgroundExecutor_` not being empty. We don't need it because it never changes and we already have the same check several lines above.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D25953674

fbshipit-source-id: 683b3e51a792160d480551a65c40492ce28938e4
2021-01-25 21:57:58 -08:00
Valentin Shergin 75a678ddb2 Fabric: `RCTParagraphComponentView` now respects the `accessible` property
Summary:
In RN, a <Text> node can be marked "not-accessible" by specifying `accessible=false`. This diff implements this for Fabric.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D24386225

fbshipit-source-id: 576f4cbe1916e90034f8c9f06f19cea1992e7abd
2021-01-25 21:11:44 -08:00
David Vacca dd60414578 Change flow types of RefreshControl.size prop
Summary:
This diff changes the flow types of RefreshControl.size prop from 'int' to string'. For more context see previous diff of the stack.
This diff will be landed as soon as the native release containing D25933458 (65975dd28d) goes to production.

It's important to clarify that there are currently no usages of this prop in production

Changelog: [Android][Changed] - RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large'

Reviewed By: JoshuaGross

Differential Revision: D25933457

fbshipit-source-id: 2f34566f2f8a097e6d40f63c09ecb3ada2fd8409
2021-01-25 21:05:56 -08:00
Joshua Gross 5792c32e36 Fix race between stopSurface and PreAllocateMountItem
Summary:
There is a race between PreAllocateMountItems executing and killing off stale SurfaceMountingManagers.

For now I'm simplifying the "eviction" mechanism. We just keep up to 15 SurfaceMountingManagers around and start evicting them from the least-recently-referenced one.

Hopefully this logic can be simplified in the future.

I'm also sneaking in a small perf optimization for PreAllocateMountItem: don't queue them if the associated surface is already stopped, because chewing through a bunch of dead PreAllocateMountItems on the UI thread can be expensive.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26059378

fbshipit-source-id: 3b2503d7d8e5f045ae741d0d4a5880d1b37758d2
2021-01-25 20:30:38 -08:00
Andrei Shikov 9f7bd62f6c Back out "Add codegen debug logging to check CI issues"
Summary: Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25995374

fbshipit-source-id: 2b08c7023e19db74f741401b3aed8ad5eb0e23e7
2021-01-25 15:22:02 -08:00
Valentin Shergin 9117840f1c Fabric: Removing `Scheduler::rootComponentDescriptor_`
Summary:
This diff simplifies `ShadowTree` constructor by removing `rootComponentDescriptor` argument. It was previously stored and supplied by `Scheduler`; now `ShadowTree` class allocates one instance of it for all instances of `ShadowTree`. The `RootComponentDescriptor` instance of it is only needed to clone a `RootShadowNode` instance; it cannot issue events, state updates, or anything like that because it does not have React counterpart.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: JoshuaGross, sammy-SC

Differential Revision: D26048466

fbshipit-source-id: ec02b1b4bcc917efe17cef58112fa870b341c85f
2021-01-25 14:12:14 -08:00
Joshua Gross 47cd7edf14 Fix race between initial updateRootLayoutSpecs and startSurface
Summary:
In some cases, onMeasure/onLayout are called on the RootView before `startSurface` in Fabric has been able to set surfaceId on the RootView.

With the new SurfaceMountingManager, this causes a crash because we need a valid surfaceId to perform an operation. Before the SurfaceMountingManager refactor, a surfaceId of 0 would be passed to `mBinding.setConstraints` in the FabricUIManager, and setConstraints in C++ noops if there's an invalid surfaceId.

For now, FabricUIManager will also fail silently if the surfaceId is invalid when updateRootLayoutSpecs is called, just to be conservative and to be consistent with previous behavior. This will be upgraded to a hard-crash in the future.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26051266

fbshipit-source-id: ca2d80f899cdba9b3962af68546bd83b77be0680
2021-01-25 12:53:08 -08:00
generatedunixname89002005325674 d368d11a0f Daily `arc lint --take GOOGLEJAVAFORMAT`
Reviewed By: zertosh

Differential Revision: D26043994

fbshipit-source-id: 7e49a747e07fb7dcb01c92bba7cb88d9e3266f69
2021-01-25 04:19:55 -08:00
David Vacca 164e133a98 Remove usage of FabricUIManager Module related to NativeDriverAnimations
Summary:
This diff removes references to FabricUIManager from UIManagerModule, these callsited were originally used for NativeAnimatedDriver, but they are not used anymore

changelog: [internal] internal

Reviewed By: JoshuaGross, shergin

Differential Revision: D26035388

fbshipit-source-id: d4825af17f6948d922c42670f2c7b02498c12039
2021-01-25 03:05:33 -08:00
Joshua Gross 5d62b4a19a Rename Event.dispatchV2 -> dispatchModern
Summary:
See title. dispatchV2 was just introduced yesterday, so nothing relies on it yet / it's safe to rename (there are no released versions of RN with `dispatchV2`).

And... dispatchModern is a better name.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26039008

fbshipit-source-id: 009ae721b8caef23a389c33b51f6f8952a6a73da
2021-01-24 22:13:11 -08:00
maltoze 2aab894acf Add AbortController to eslint globals (#30691)
Summary:
Fix eslint complaining about AbortController not being defined.

## 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
-->

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

Reviewed By: TheSavior

Differential Revision: D25926479

Pulled By: mdvacca

fbshipit-source-id: aee7ef3e46331a389085e26eb3b601e9a6cf0910
2021-01-23 13:37:39 -08:00
Ramanpreet Nara 3dab9a0d01 Make parser return empty schema when parsing non-spec files
Summary:
Right now, running the codegen parser on regular JavaScript files causes it to throw an error:

https://www.internalfb.com/intern/diffusion/FBS/browsefile/master/xplat/js/react-native-github/packages/react-native-codegen/src/parsers/flow/index.js?commit=1e93f27aac8890f1731650fdcc38b702ae8874e2&lines=59-63%2C106-107

This makes the parser less usable, because you can't simply loop over a list of JavaScript files, and run codegen on them. You need to do some filtering beforehand, or surround each invocation of the parser with a try/catch.

Our codegen schema supports the idea of an empty schema:

```
{
  modules: {}
}
```

To improve the parser's ergonomics, this diff migrates the codegen parser over to returning the empty schema when it cannot detect a Component or NativeModule spec inside a JavaScript file.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D26034052

fbshipit-source-id: c2f15aba9c0e052012396eaed2034537f5918e33
2021-01-23 02:02:57 -08:00
Joshua Gross 595b569ead Fix EventEmitter crash for events that are sent to a stopped surface
Summary:
In SurfaceMountingManager/MountingManager/FabricUIManager infra, we try to blackhole events that are sent to a stopped surface. In this case I just forgot to add a null check. Add here to protect against events sent to stopped surfaces - for example, if a TextInput is focused when the surface is stopped, a "blur" event will be sent and will crash here otherwise. Now it blackholes silently, as expected.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26031260

fbshipit-source-id: 9936466ca2d00267efaf7fa594c9bcd59f7aad2a
2021-01-22 19:32:15 -08:00
Joshua Gross ee10932e26 Support RCTModernEventEmitter in for ReactTextInput* Event classes
Summary:
Support RCTEventEmitterV2 in ReactTextInput*Event classes for optimal Fabric perf. Backwards-compatible with non-Fabric renderer.

Changelog: [Changed][Android] Old native ReactTextInput*Event creation APIs have changed, and will be removed in the (distant) future. The old methods will work for now with minor perf implications for Fabric.

Reviewed By: mdvacca

Differential Revision: D26031261

fbshipit-source-id: 7c972ecfd1e395104c4639995bb5ecc5f7c6baae
2021-01-22 19:32:15 -08:00
Joshua Gross ddabf3fd56 Support RCTModernEventEmitter in ImageLoadEvent
Summary:
Support RCTEventEmitterV2 in ImageLoadEvent for optimal Fabric perf. Backwards-compatible with non-Fabric renderer.

Changelog: [Changed][Android] Old native ImageLoadEvent creation APIs have changed, and will be removed in the (distant) future. The old methods will work for now with minor perf implications for Fabric.

Reviewed By: mdvacca

Differential Revision: D26029773

fbshipit-source-id: c8e00e06a2f9d6682367f9099bdf7f5fc12890e0
2021-01-22 19:32:15 -08:00
Joshua Gross 62f0dee235 Migrate ScrollEvent to RCTModernEventEmitter
Summary:
Motivation: perf, simplicity, adhering to new SurfaceMountingManager APIs available to us. Backwards-compatible with events sent through old system or Fabric, to Fabric or non-Fabric Views.

Changelog: [Changed][Android] Old Native method to create ScrollEvent has been deprecated and will be removed at some point in the (distant) future

Reviewed By: mdvacca

Differential Revision: D26027105

fbshipit-source-id: b9dba5b56c2bfed3b8fc4488c54b271b85ab5fa0
2021-01-22 19:32:14 -08:00
Joshua Gross 708038d80e Refactor EventEmitters to take optional surfaceId, migrate TouchEvent
Summary:
Refactor EventEmitters to take an optional SurfaceId that Fabric will use, and non-Fabric will not.

Migrating touches is a good proof-of-concept for how this could be used generally, and as it turns out, TouchEvent's API is more flexible than most other event APIs (because it uses a dictionary to pass data around, so we can just stuff SurfaceId into it - not efficient, but flexible).

All new APIs are backwards-compatible and designed to work with old-style events, with Fabric and non-Fabric. Native Views that migrate to the new API will be backwards-compatible and get an efficiency boost in Fabric.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26025135

fbshipit-source-id: 5b418951e9d0a3882f2d67398f2aaadac8a3a556
2021-01-22 19:32:14 -08:00
Joshua Gross 2fbbdbb2ce Create V2 EventEmitter (ModernEventEmitter) interface that surfaceId can be passed into
Summary:
Create V2 EventEmitter that surfaceId can be passed into, with a backwards-compat layer, and some debug-only logging to help assist with migration.

Changelog: [Changed][Android] RCTEventEmitter has been deprecated in favor of RCTModernEventEmitter for optimal Fabric support; RCTEventEmitter will continue to work in Fabric, but there are minor perf implications.

Reviewed By: mdvacca

Differential Revision: D26027104

fbshipit-source-id: 784ca092bbc88d19c82f6c42537c34460d96de86
2021-01-22 19:32:14 -08:00
Joshua Gross 8357b39908 Rename String surfaceID to surfaceName/moduleName, add int surfaceId to ThemedReactContext
Summary:
There's a field called `surfaceID` in a couple of classes that isn't the same as the integer `surfaceId` in Fabric.

For consistency, I've deprecated a couple of them, or renamed when appropriate.

In addition, now we're passing the actual integer surfaceId into the ThemedReactContext. This means that every single View created in Fabric gets annotated with the surfaceId it's in. Currently this isn't used, but the idea is that now each View has a mapping back to its surface, which could be used to simplify / optimize operations with SurfaceMountingManager. In particular, we might be able to use this in the future to optimize animations and/or event emitters.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26021571

fbshipit-source-id: b7db7de123db07fa928a6f815be86bdbb030e62c
2021-01-22 19:32:14 -08:00
Joshua Gross e7783ff9ad Rename addRootView -> startSurface in Fabric, and deprecate existing `addRootView` sites
Summary:
Deprecate addRootView, use startSurface consistently in Fabric.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26021147

fbshipit-source-id: e23b9294695609f766e382917ae1874fc8a1b27d
2021-01-22 19:32:13 -08:00
David Vacca 505f9fc749 Add logging to analyze Bug in BottomSheetRootViewGroup
Summary:
This diff adds logs and soft errors to analyze task T83470429

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D26032513

fbshipit-source-id: e6ee3f8a6ac942e794439396e1a9f7d6157d20a5
2021-01-22 18:44:36 -08:00
Hans Halverson 8d81ae8f2b Deploy Flow v0.143.1
Summary: Changelog: [Internal]

Reviewed By: dsainati1

Differential Revision: D26022576

fbshipit-source-id: 004ecc4d1c80381947a95495fc9b6245cbafa82b
2021-01-22 18:16:50 -08:00
Ron Edelstein aa65be8ef8 Make autoglob a required parameter of robolectric tests
Reviewed By: strulovich

Differential Revision: D26013246

fbshipit-source-id: fd7f014cc55c8640b96032d843aa2ce81ac9bfa8
2021-01-22 16:35:08 -08:00
Luna Wei 1a8d641469 Refactor SectionListExample
Summary:
Changelog:
[General][Changed] - Refactor SectionListExample in RNTester to functional component

Reviewed By: nadiia

Differential Revision: D25986316

fbshipit-source-id: b448316d1563cb1433cc36fe150ad8b4c0e45f54
2021-01-22 13:47:50 -08:00
Luna Wei d0a455b3c3 Refactor pressItem
Summary:
Changelog:
[General][Changed] - Refactor pressItem, a RNTester util for list based components to not pass state around.

Reviewed By: nadiia

Differential Revision: D25986318

fbshipit-source-id: d0dd85f783a83f73f83cfb1bd19d144c37af9ef9
2021-01-22 13:47:49 -08:00
Luna Wei 335f6de00a Refactor renderSmallSwitchOption
Summary:
Changelog:
[General][Changed] - Refactor `renderSmallSwitchOption`, a RNTester util for list based components to not pass state around.

Reviewed By: nadiia

Differential Revision: D25986317

fbshipit-source-id: cbbd71cc1b1bab71ecd007980f2813f7a066b3f2
2021-01-22 13:47:49 -08:00
Nadiia D 881860886c TextInput: sort props
Summary:
Changelog:
[General][Changed] - Refactor TextInput component

Reviewed By: lunaleaps

Differential Revision: D26009114

fbshipit-source-id: 25676a93d59d43ec6c5073fc481d4b9cd20e2f9a
2021-01-22 13:13:57 -08:00
Valentin Shergin 92da2c1779 Fabric: Fixed <ScrollView> jumps during overscroll gesture
Summary:
Normally, UIScrollView adjust `contentOffset` inside `setContentSize` to prevent over-scroll. In most cases, it works fine but in a case when the ScrollView is in the middle of user interaction the over-scroll is perfectly acceptable. So, to work around this issue we disable `setContentOffset` when we update `contentSize` and the gesture interaction is in progress.

Changelog: [Internal] Fabric-specific internal change.

Reviewed By: sammy-SC

Differential Revision: D26001133

fbshipit-source-id: 19b67289b2c142facd4f516a740180c87f90bc2d
2021-01-22 08:53:45 -08:00
Joshua Gross 29eb632f1c Refactor MountingManager into MountingManager + SurfaceMountingManager
Summary:
This refactors MountingManager into a minimal API that shims into a more fully-featured SurfaceMountingManager. The SurfaceMountingManager keeps track of surface start/stop, surface ID, and surface Context.

This solves a number of issues around (1) race conditions around StopSurface/StartSurface, (2) memory management of Views, (3)

Concrete improvements:

1. Simpler to reason about race conditions around StopSurface/StartSurface.
2. 1:1 relationship between SurfaceId and all Views/tags.
3. When surface is stopped, all descendent Views can be GC'd immediately.
4. Fixed separation of concerns and leaky abstractions: surfaceId/rootTag and Surface Context are now stored and manipulated *only* in SurfaceMountingManager.
5. Simpler StopSurface flow: we simply remove references to all Views, and the Fragment (outside of the scope of this code) removes the RootView. This will trigger GC and we do ~0 work. Previously, we ran a REMOVE and DELETE instruction and kept track of each View in a HashMap. Now we can simply delete the map and move on.

The caveat: NativeAnimated (or other native modules that go through UIManager). APIs like `updateProps` currently uses only the ReactTag and does not store SurfaceId. This is a good argument for moving away from ReactTag, at least in its current incarnation, but: for now this requires that you do a lookup of a ReactTag across N surfaces (worst-case) to determine which Surface a ReactTag is in.

So, to summarize, the "con" of this approach is that now `getSurfaceManagerForViewEnforced` could be slower. It is used in:
* NativeAnimatedModule calls `updateProps` through UIManager
* FabricEventEmitter calls `receiveEvent` on FabricUIManager directly
* On audit, I could find zero native callsites to `sendAccessibilityEvent` through UIManager

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26000781

fbshipit-source-id: 386ae40c4333f8c584e05818c404868dbee6ce73
2021-01-21 23:47:34 -08:00
Joshua Gross 82e9cb1b4e Add SurfaceId to ShadowView
Summary:
See title. Not used in this diff; see next diff in stack.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D26001014

fbshipit-source-id: 475eb265f1c27bd9aff978a49652764a50287e47
2021-01-21 23:47:34 -08:00
Ramanpreet Nara 5a2099fe7d Rename rn_codegen_modules(native_module_spec_name => name)
Summary: Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25963929

fbshipit-source-id: 4c82562404a21b5a1789d11ae2d228411329fee5
2021-01-21 19:04:54 -08:00
Ramanpreet Nara 93e4170d03 Rename NativeModule schema targets
Summary:
NativeModule schema targets will now take the form '{library_name}-codegen-modules-schema'.

NOTE: Will launch the necessary diffs to make the same refactor in our component codegen.

Changelog: [Internal]

Differential Revision: D25968071

fbshipit-source-id: 1d7c9f4679e4ae6c26c9a29a74fa7b7ea76460eb
2021-01-21 19:04:53 -08:00
Ramanpreet Nara d2bbedad1a Rename intermediary module codegen targets
Summary: Changelog: [Internal]

Reviewed By: PeteTheHeat

Differential Revision: D25963082

fbshipit-source-id: 54ed496a6e8bab224f6145539c63cb006e619900
2021-01-21 19:04:53 -08:00
Nick Gerleman c66aa8abc0 Fix a couple of missing display names in integration test components (#29902)
Summary:
IntegtationTestsApp looks for a display name of each component to register it in the AppRegistry, along with show its name in the tests lists. Add the missing display names back to these tests.

## Changelog

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

[iOS] [Fixed] - Fix a couple of missing display names in integration test components

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

Test Plan: All integration tests now show up in the list.

Reviewed By: TheSavior

Differential Revision: D25998969

Pulled By: appden

fbshipit-source-id: 45e5544c8df60a67615b75d85195f3080a42a0b8
2021-01-21 11:29:48 -08:00
Brandon Baumgarten 17aa1e320e Fix image loop counter on iOS 14 (#30744)
Summary:
Animated gifs, which do not loop, currently animate twice on iOS 14.
See: https://github.com/facebook/react-native/issues/30147

## Changelog

[iOS] [Fixed] - Animated images without loop no longer animate twice

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

Test Plan:
Run the example app with any animated gif. I attached a gif, which is affected.

![checkmark](https://user-images.githubusercontent.com/54310840/104746529-b2e02900-574f-11eb-9870-0c03c769c990.gif)

Reviewed By: sammy-SC

Differential Revision: D25977626

Pulled By: PeteTheHeat

fbshipit-source-id: 889d4a7bed8f7a7be6a9a427501d0071b7c02b8c
2021-01-21 10:56:14 -08:00
Samuel Susla 768ecc2906 Implement ScrollView.indicatorStyle
Summary: Changelog: [internal]

Differential Revision: D25996218

fbshipit-source-id: 38b521b0ac52635a2c6341450592e6dd27be00f4
2021-01-21 09:59:40 -08:00
Samuel Susla fa728b27e6 Implement ScrollView.scrollIndicatorInsets
Summary: Changelog: [internal]

Reviewed By: shergin

Differential Revision: D25996025

fbshipit-source-id: 3528914af278dcbe522e247660b8afc19628eb6e
2021-01-21 09:59:40 -08:00
Joshua Gross a715c5eba7 Addressing leaked Views in Fabric MountingManager
Summary:
MountingManager keeps a map of tags to Views, and attempts to clean it up by (1) deleting tags when they're explicitly deleted, (2) recursively deleting all Views when the View hierarchy is torn down.

However, there appear to be.... substantial gaps here. In tests, when navigating between screen X -> screen Y -> back to X (triggering a StopSurface), each "StopSurface" resulted in 200-600 Views being leaked (!).

What is causing these leaks? Well, for one, the "dropView" mechanism isn't perfect, so it might be missed Views. Second, Views don't always guarantee that `reactTag == getId()`, so that could result in leaks. Third, View preallocation on Android complicates things: Views can be preallocated and then never even inserted into the View hierarchy, so DELETE mutations could never be issued. Fourth, StopSurface is also complicated on Android (largely because of View preallocatioAndroid (largely because of View preallocation).

So, I introduce a new mechanism: keep a list of all tags for a surface, and remove all tags for a surface when the surface is torn down. This should be fool-proof: it handles preallocation and normal creation; it can handle deletes; and we're guaranteed that tags cannot be added after a surface is stopped.

Is this overly complicating things? Well, hopefully we can simplify all of this in the longterm. But until we get rid of View Preallocation, it seems like we need this mechanism - and View Preallocation might be around for a while, or forever.

Other thoughts: it's possible that using other data-structures could be more efficient, but I'm guessing the perf implications here are marginal (compared to the insane amount of memory leaks we're fixing). It could also simplify things to have a SurfaceMountingManager interface that implies all actions happen on a specific surface, including teardown.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25985409

fbshipit-source-id: f55b533770b1630c6c2a9b7a694d953aa3324428
2021-01-20 17:46:30 -08:00
Peter Argany b32e996898 Fix RCTNetworking yellow box
Summary:
Since `RCTNetworking` overrides init, it requires main queue setup. Native module infra currently throw a yellowbox if a module forgets it.

This diff fixes that.

{F361182429}

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D25962402

fbshipit-source-id: d847117cbfe0a191dc1882898711693c6fda68cd
2021-01-20 12:57:40 -08:00
Samuel Susla 8695980e1e Add experiment to clean up resources when the app is backgrounded
Summary:
Changelog: [internal]

Setup an experiment to measure impact of releasing resources when the app enters background.

Reviewed By: JoshuaGross, shergin

Differential Revision: D25952690

fbshipit-source-id: acfaa4a1689cc03c6020fdee62d3594859c9da3d
2021-01-20 10:08:13 -08:00
Valentin Shergin 6079256fcc Fabric: `SchedulerToolbox::commitHooks`, a way to pass commit hooks to UIManager via Scheduler API
Summary:
Even though CommitHooks, in general, should be implemented as part of the Core and explicitly registered inside the code, sometimes it's handy to pass specify some additional commit hooks during Scheduler initialization (e.g. hooks that are parts of DevEx tools). Now it's possible.

We will use it soon in Timeline feature.

Changelog: [Internal] Fabric-specific internal change.

Differential Revision: D25920577

fbshipit-source-id: 00f33b7b576c9812afd70c364b5cceb3521da16b
2021-01-19 20:57:55 -08:00
Dulmandakh 8a5fd8ea95 fix glog pod install with Xcode 12 (#30372)
Summary:
Today I created a project with RN 0.63 and it failed to **pod install**, and after some investigation I found following error. It's caused by Xcode 12 because it dropped support for 32 bit architectures, but following script sets architecture to armv7 which is 32bit.

This will change architecture to arm64, 64 bit.

```
configure:3727: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.1.sdk    conftest.c  >&5
clang: error: invalid iOS deployment version 'IPHONEOS_DEPLOYMENT_TARGET=12.0', iOS 10 is the maximum deployment target for 32-bit targets [-Winvalid-ios-deployment-target]
configure:3731: $? = 1
```

## Changelog

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

[IOS] [Changed] - fix glog pod install with Xcode 12

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

Test Plan: Create a new project using react-native init, and it'll fail to do pod install. When this change applied, it'll do it successfully.

Reviewed By: fkgozali

Differential Revision: D25957237

Pulled By: PeteTheHeat

fbshipit-source-id: 4ecfaee29da4171fb190352927ec47dbb73fbaa0
2021-01-19 13:45:15 -08:00
Mike Vitousek b20698d81e Remove generate-tests setting from flowconfigs in xplat
Summary:
The old generate-tests mode for checking generics is now defaulted to `false`, and the code path that the setting supports is getting deleted, so .flowconfigs no longer should specify that `generate-tests=false`

Changelog: [Internal]

Reviewed By: panagosg7

Differential Revision: D25958102

fbshipit-source-id: a15926f04bd8cd4337f489cddbb8e385821243bc
2021-01-19 13:31:45 -08:00
Panagiotis Vekris d9c84f078d misc Flow library fixes & suppressions
Summary:
The current version of Flow fails to report some errors in library definitions. I'm
working on a Flow fix that would surface these errors. In preparation for this, this diff:

* replaces `FbtErrorListener` (missing) with `IFbtErrorListener` in fbt.js
* fixes typos in several files
* suppresses missing names with `[cannot-resolve-name]`
* adds `sourceMapTarget` option in babel-generator

Changelog: [Internal]

Reviewed By: jbrown215

Differential Revision: D25839533

fbshipit-source-id: 947207db9238aa10663616d59080440d2ac6f243
2021-01-19 11:55:09 -08:00
Joshua Gross 9b1f3b16b0 Back out hacks to fix T83141606
Summary:
Original commit changeset: 3ed8e78e31b0

Backing-out D25938851 (69b3016171) and D25935785 (bdea479a1f). Based on analysis documented in T83141606, I believe this issue should be fixed in JS.

Additionally, this crash actually has nothing to do with (un)flattening or the differ; it is a side-effect of stale ShadowNodes being cloned, which I believe is either UB or a contract violation. Either way, it should probably be fixed either in JS, or in node cloning. So this isn't the right solution for this issue and should be reverted.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25949569

fbshipit-source-id: 8cf1094a767da98fff4430da60d223412e029545
2021-01-19 00:29:41 -08:00
sirpy 8facc865ab fix: save connection url as class variable
Summary:
Conform with Websocket javascript api.
related to web3js issues: https://github.com/ethereum/web3.js/issues/2864 https://github.com/ethereum/web3.js/issues/2602

Reviewed By: javache

Differential Revision: D25927475

Pulled By: TheSavior

fbshipit-source-id: 26b2df0565dac581d546b6824dd4f0fc2c8cdc32
2021-01-18 21:58:53 -08:00
David Vacca 65975dd28d Change type of SwipeRefreshLayoutManager.size prop from Int to String
Summary:
This diff changes the type of the SwipeRefreshLayoutManager.size prop from Int to String in Fabric.

The current implementation of this prop allows JS developers to use "int" type when fabric is enables and "int or string" types when using Fabric is disabled.
Since long term we want to only support "string" type for this prop, I'm changing the type of the prop to be String.

After my diff Fabric will start supporting only "string" types, non fabric screens will keep supporting "int or string" values.

**Will this break production?**
No, because there are no usages of RefreshControl.Size prop in fbsource

**What about if someone start using this prop next week?**
IMO It's very unlikely because of the nature of this prop, I will be monitoring next week and if there's an usage it will be detected by flow when trying to land D25933457.

Changelog: [Android][Changed] - RefreshControl.size prop changed its type to string, the valid values are: 'default' and 'large'

Reviewed By: JoshuaGross

Differential Revision: D25933458

fbshipit-source-id: 55067d7405b063f1e8d9bb7a5fd7731f5f168960
2021-01-17 02:57:02 -08:00
Joshua Gross 69b3016171 Followup to D25935785: mark more mutation instructions as "recreated"
Summary:
As a follow up to D25935785 (bdea479a1f), there are more cases where nodes are "recreated" due to unflattening.

This has no impact anywhere (yet) as far as I'm aware, but could fix the same issues as D25935785 (bdea479a1f) (on Android only).

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D25938851

fbshipit-source-id: 3ed8e78e31b0b911e274ecc395a43bc6cb6d5f9d
2021-01-16 23:34:37 -08:00