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

3454 Коммитов

Автор SHA1 Сообщение Дата
Andrei Shikov e5874d90e2 Folly_runtime for CMake
Summary:
Ports improvements from Android.mk setup to CMake, replacing folly_json and futures with runtime where plausible

Changelog: [Internal] - CMake folly_runtime setup

Reviewed By: cortinico

Differential Revision: D34854295

fbshipit-source-id: fa882a9cd0b78feb20f8abcc9350c27702375def
2022-03-16 08:10:55 -07:00
Andrei Shikov 6c5bd6d790 Hermes executor migration to CMake
Summary:
Adds CMake files to configure hermes-executor build, with the same setup as we have in Android.mk

Changelog: [Internal] - CMake build config for hermes executor

Reviewed By: cortinico

Differential Revision: D34811909

fbshipit-source-id: 2df6dbaf46131db87a25e26c83b38ba44f29d1d3
2022-03-16 01:47:05 -07:00
Nicola Corti 0d2ee7c17c Re-apply main changes to CMake files
Summary:
This Diff re-applies some of the changes that landed on main
to the CMake files we currently landed so far.

Changelog:
[Internal] [Changed] - Re-apply main changes to CMake files

Reviewed By: ShikaSD

Differential Revision: D34859685

fbshipit-source-id: 772a3aed05f56b6fbb2942bf9d1a5bd4581b48d5
2022-03-15 08:14:07 -07:00
Pieter De Baets 6c9de5543e Cleanup ScriptTag helpers on Instance
Summary:
We were opening the file multiple times just to read the same couple of bytes.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D34835972

fbshipit-source-id: 9de899f37a9193db4ab72e69e02e8d41e5515da0
2022-03-15 05:58:52 -07:00
Pieter De Baets be0ff779b1 Fix parseTypeFromHeader for Hermes bytecode
Summary: Changelog: [Internal] Fix bug where Hermes bytecode bundles were not always recognized

Reviewed By: motiz88

Differential Revision: D34718511

fbshipit-source-id: 5bbebe49962d098988d99153b0938fbb5d449ae6
2022-03-15 05:58:52 -07:00
Nicola Corti e12bc9cf62 Setup Globbing with CONFIGURE_DEPENDS inside CMake files.
Summary:
This Diff moves from specifying a list of files to use file(GLOB) with
CONFIGURE_DEPENDS on several CMakefiles.
I've updates those where we use globbing also inside buck.

Changelog:
[Internal] [Changed] - Setup Globbing with CONFIGURE_DEPENDS inside CMake files

Reviewed By: ShikaSD

Differential Revision: D34826311

fbshipit-source-id: 8fc654626c897cdc4cdd79c699ce19f1e5e1212f
2022-03-15 01:55:27 -07:00
Andrei Shikov 5d5addd661 Separate folly into runtime + folly_futures specific for hermes inspector
Summary:
Rearranges folly_futures configuration into a static library only required for `hermes-inspector` + `folly_runtime` which merges `folly_json` and mutex-related implementations `folly_futures` was used for. As `hermes-executor-debug` is removed by `vmCleanup` configurations later, it allows to shave additional 300KB from the release APK size.

Changelog: [Internal] - Rearrange folly build to reduce APK size

Reviewed By: cortinico

Differential Revision: D34342514

fbshipit-source-id: b646680343e6b9a7674019506b87b96f6007caf2
2022-03-13 15:15:21 -07:00
Andrei Shikov 0a004927ad Extract mapbuffer from reactutils module
Summary:
`MapBuffer` is not used in RN utils for anything shared for now, so we can remove it from the build config by reordering methods, shaving 20KB in APK size for each architecture.

Also applies clang-tidy rules to `MapBuffer`/`folly::dynamic` configurations.

Changelog: [Internal] - Remove `mapbuffer` dependency from `Android.mk` of reactutilsjni

Reviewed By: javache, cortinico

Differential Revision: D34620455

fbshipit-source-id: ad3717448f5c20fd071f71d436bb9dd00efe7eb0
2022-03-12 11:19:57 -08:00
Nicola Corti a3d9892ed9 Build Hermes from Source (#33396)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33396

This commit fully unplugs the `ReactAndroid` from using hermes from the NPM package and plugs the usage of Hermes via the `packages/hermes-engine` Gradle build.

I've used prefab to share the .so between the two builds, so we don't need any extra machinery to make this possible.

Moreover, I've added a `buildHermesFromSource` property, which defaults to false when RN is imported, but is set to true when RN is opened for local development. This should allow us to distribute the `react-native` NPM package and users could potentially toggle which source to use (but see below).

Changelog:
[Android] [Changed] - Build Hermes from Source

Reviewed By: hramos

Differential Revision: D34389875

fbshipit-source-id: 107cbe3686daf7607a1f0f75202f24cd80ce64bb
2022-03-11 15:23:36 -08:00
Scott Kyle 31f0796237 Add codegen for C++ TurboModule automatic type conversions
Summary:
This adds the *option* for C++ TurboModules to use a `*CxxSpec<T>` base class that extends the existing (and unchanged) corresponding `*CxxSpecJSI` base class with code-generated methods that use `bridging::calFromJs` to safely convert types between JSI and C++. If a type conversion cannot be made, then it will fail to compile.

Changelog:
[General][Added] - Automatic type conversions for C++ TurboModules

Reviewed By: christophpurrer

Differential Revision: D34780512

fbshipit-source-id: 58b34533c40652db8e3aea43804ceb73bcbe97a5
2022-03-11 12:47:51 -08:00
Scott Kyle 6697b7bb90 Add callFromJs bridging API
Summary:
This adds `bridging::callFromJs` that can call class instance methods with JSI arguments and will automagically convert types to the types expected by the method, or otherwise will fail to compile. The same type conversion back to JSI applies as well for the return value, if there is one.

This will allow C++ TurboModules to more easily define their interface in terms of C++ types instead of having to interact with JSI directly for everything, though it remains possibles for JSI values to pass through if that's what a given method wants.

Changelog:
Internal

Reviewed By: christophpurrer

Differential Revision: D34780511

fbshipit-source-id: 1f9caadeefa6d4023f679e95f3decc64d156b3f0
2022-03-11 12:47:51 -08:00
Scott Kyle 30cb78e709 New bridging API for JSI <-> C++
Summary:
This adds  `bridging::toJs` and `bridging::fromJs` functions that will safely cast to and from JSI values and C++ types. This is extensible by specializing `Bridging<T>` with `toJs` and/or `fromJs` static methods. There are specializations for most common C++ and JSI types along with tests for those.

C++ functions and lambdas will effortlessly bridge into JS, and bridging JS functions back into C++ require you to choose `SyncCallback<R(Args...)>` or `AsyncCallback<Args...>` types. The sync version allows for having a return value and is strictly not movable to prevent accidentally moving onto another thread. The async version will move its args onto the JS thread and safely call the callback there, but hence always has a `void` return value.

For promises, you can construct a `AsyncPromise<T>` that has `resolve` and `reject` methods that can be called from any thread, and will bridge into JS as a regular `Promise`.

Changelog:
[General][Added] - New bridging API for JSI <-> C++

Reviewed By: christophpurrer

Differential Revision: D34607143

fbshipit-source-id: d832ac24cf84b4c1672a7b544d82e324d5fca3ef
2022-03-11 12:47:51 -08:00
Scott Kyle 6a9497dbbb Move some classes to new bridging library (#33413)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33413

This moves `CallbackWrapper` and `LongLivedObject` into a new "bridging" library. This library is mostly intended for use by the native module system, but can also be used separately to "bridge" native and JS interfaces through higher-level (and safer) abstractions than relying JSI alone.

Changelog:
Internal

Reviewed By: christophpurrer

Differential Revision: D34723341

fbshipit-source-id: 7ca8fa815537152f8163920513b90313540477e3
2022-03-11 12:47:51 -08:00
Nicola Corti b676ca560d First Round of CMake files for React Android
Summary:
This is the first round of CMake files to support the React Native build on Android.
They're supposed to eventually replace the various Android.mk files we have around in the codebase.

So far we're not actively using them. This is the first step towards migrating our
setup to use CMake

Changelog:
[Internal] [Changed] - First Round of CMake files for React Android

Reviewed By: ShikaSD

Differential Revision: D34762524

fbshipit-source-id: 6671e203a2c83b8874cefe796aa55aa987902a3b
2022-03-11 11:39:23 -08:00
Arthur Kushka 009d80bf5a Dropped `using namespace` from TurboModuleUtils.h
Summary:
using namespace in header file is a bad practice due to many reasons as well as discouraged by `-Wheader-hygiene` compiler flag which is default for many apps

https://stackoverflow.com/questions/5849457/using-namespace-in-c-headers

Changelog:
[General][Fixed] - Fixed compilation warning due to `using namespace` being used as part of header

Reviewed By: nlutsenko

Differential Revision: D34788523

fbshipit-source-id: 2a50fbf2ac3371ff5670c600c7f5ad9055060ad2
2022-03-11 06:56:10 -08:00
Xavier Deguillard ece1dd4ed9 BUCK: define GLOG_NO_ABBREVIATED_SEVERITIES everywhere
Summary:
This is only defined on Windows, and thus code that compiles on all platforms
may successfully build on Linux/macOS, but not on Windows, making it
potentially harder to detect and debug. Let's unify all platforms to solve
this.

Changelog: [Internal]

Reviewed By: chadaustin

Differential Revision: D34648154

fbshipit-source-id: b2549bb3eb120e6207cab8baaafced8b1b18e6a7
2022-03-08 12:35:48 -08:00
John Porto c8067f1ffd Misc MsgGen fixes
Summary:
Fix a few issues with msggen:
1. run_msggen: fully-qualified path to clang-format
1. Updated the license for autogenerated files

Changelog: [Internal]

Reviewed By: neildhar

Differential Revision: D34114718

fbshipit-source-id: 831d4b20bfdc39cfa1226e2a32dcb445c8086ff3
2022-03-08 10:22:28 -08:00
Samuel Susla e97e3499c3 Avoid string copy in event dispatching
Summary:
Changelog: [internal]

To avoid unnecessary string copy in event pipeline, use move semantics.

Event pipeline has ownership of event type. Passing it by reference ends up in a copy when `RawEvent` object is constructed. To avoid this, pass string by value through each layer and use move semantics to avoid extra copies.

Reviewed By: javache

Differential Revision: D34392608

fbshipit-source-id: c11d221be345665e165d9edbc360ba5a057e3890
2022-03-08 04:28:51 -08:00
caioagiani 8200063ac6 fix: typos (#33040)
Summary:
Fix typos in:

- `Libraries/Renderer/implementations/ReactFabric-dev.js`: transfered -> **transferred**
- `Libraries/Renderer/implementations/ReactNativeRenderer-dev.js`: transfered -> **transferred**
- `ReactAndroid/src/main/java/com/facebook/react/modules/network/ProgressiveStringDecoder.java`: remainderLenght -> **remainderLength**
- `ReactAndroid/src/main/jni/first-party/yogajni/jni/ScopedGlobalRef.h`: Transfering -> **Transferring**
- `ReactCommon/react/renderer/graphics/Transform.h`:  tranformation -> **transformation**
- `packages/rn-tester/js/examples/ToastAndroid/ToastAndroidExample.android.js`: 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] - fix typos

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

Test Plan: Considering this only changes code comments, I don’t think this pull request needs a test plan.

Reviewed By: cortinico, pasqualeanatriello

Differential Revision: D34003812

Pulled By: dmitryrykun

fbshipit-source-id: 5c8699f8efcc4354854190a9aade30dbc5c90fdb
2022-03-08 03:58:58 -08:00
Richard Barnes 3b61f2108d use gmock 1.10 instead of 1.8
Summary: See D34622171 for details

Reviewed By: lehecka

Differential Revision: D34688121

fbshipit-source-id: 09a3c749e0803810dcdca362c4e58a3e6b99dd8a
2022-03-07 17:33:06 -08:00
Daniel Andersson e1dc9a756b Silence some warnings in xcode 13.3
Summary:
Silence some warnings in xcode 13.3 by explicitly defining some copy constructors in JSI and adding a compiler flag in Hermes.

Changelog:
[Internal][Fixed] - Build issues

Reviewed By: jpporto

Differential Revision: D34526541

fbshipit-source-id: 7029e3d20b9209007cf7e9f4c935338513ee1dd0
2022-03-07 11:52:51 -08:00
Diego Pasquali 7b05b091fd Integrated iOS-only `accessibilityLanguage` prop (#33090)
Summary:
This PR fixes https://github.com/facebook/react-native/issues/30891

This PR is going to add an `accessibilityLanguage` prop to all the available components. This props is currently working only on iOS and should follow the [guidelines of the relative configuration](https://developer.apple.com/documentation/objectivec/nsobject/1615192-accessibilitylanguage).

I'm in no way an expert on native programming (especially Objective-C) so I'm open to changes / improvements 🙂

## Changelog

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

[iOS] [Added] - Integrated the `accessibilityLanguage` prop to all the available components. The prop is available for any platform but it will work only on iOS.

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

Test Plan:
This has been tested using both the Simulator, checking for the `Language` attribute, and using a physical device with the Voice Over enabled.

<img width="1083" alt="Screenshot 2022-02-11 at 13 17 32" src="https://user-images.githubusercontent.com/5963683/153590415-65fcb4ff-8f31-4a0f-90e5-8eb1aae6aa3d.png">

Reviewed By: philIip

Differential Revision: D34523608

Pulled By: rh389

fbshipit-source-id: b5d77fc0b3d76ea8ed8f30c8385459ba98122ff6
2022-03-07 09:43:30 -08:00
Nikita Lutsenko 1f87729697 rn | cxx | Move the definitions of TurboModule virtual methods to declaration, to allow for use in context with RTTI.
Summary:
Not having this disallows including turbo module and extending in places where RTTI is enabled.
There is no additional includes or implementation changes - it merely allows for things to nicely link with other libraries.

Changelog: [General][Fixed] - Allow including TurboModule.h in mixed rtti/no-rtti environment, even if TurboModule.h/cpp is compiled without RTTI.

Reviewed By: appden

Differential Revision: D34637168

fbshipit-source-id: 2e5d9e546bdc5652f06436fec3b12f1aa9daab05
2022-03-04 19:04:36 -08:00
Scott Kyle 603620b739 Add asBool() method
Summary:
Changelog:
[General][Added] - Add asBool() method to JSI

Reviewed By: mhorowitz

Differential Revision: D34630901

fbshipit-source-id: 3007784618fcc0f7828eee42de5cbf2bd71258c5
2022-03-04 08:02:17 -08:00
Samuel Susla a159416333 Use std::optional instead of butter::optional
Summary: changelog: Use std::optional instead of butter::optional

Reviewed By: fkgozali

Differential Revision: D33352680

fbshipit-source-id: 45a53fec181a6ffb6218909bc23348f7c9f21ec4
2022-03-04 07:25:59 -08:00
Samuel Susla c2e4ae39b8 Add support for C++17 in OSS
Summary: changelog: Add support for C++17

Reviewed By: cortinico

Differential Revision: D34612257

fbshipit-source-id: 88a0307a750f2e0793a639b7a2b670a4571332fe
2022-03-04 07:25:59 -08:00
Gilson Takaasi Gil eb434c1c76 Revert D34351084: Migrate from googletest 1.8 to googletest 1.10
Differential Revision:
D34351084 (94891ab5f8)

Original commit changeset: 939b3985ab63

Original Phabricator Diff: D34351084 (94891ab5f8)

fbshipit-source-id: 2fd17e0ccd9d1f1d643f4a372d84cb95f5add1f8
2022-03-03 04:41:46 -08:00
Dimitri Bouche 94891ab5f8 Migrate from googletest 1.8 to googletest 1.10 (#67)
Summary:
X-link: https://github.com/facebookincubator/hsthrift/pull/67

Updating `googletest` from `1.8.0` to `1.10.0`

Reviewed By: mzlee, igorsugak, luciang, meyering, r-barnes

Differential Revision: D34351084

fbshipit-source-id: 939b3985ab63a06b6d511ec8711c2d5863bdfea8
2022-03-03 03:46:03 -08:00
Gal Shirin cfb11ca2f6 Fix xcodebeta build failure
Summary:
Changelog:
[iOS][Changed] - Removed methodName parameter that was used only for a warning message and moved the warning parameter to be calculated inline.

Reviewed By: fkgozali

Differential Revision: D34551444

fbshipit-source-id: 6ceba425b64df37b0dca7e222072f1836f151d83
2022-03-01 23:56:55 -08:00
Xin Chen 0975e96d53 Fix transform when calculate overflowInset
Summary:
This diff fixes overflowInset calculation when a shadow node has transform matrix from a transfrom prop in JS. Specifically, this fixed the use case when transform directly used on a view component. When using Animated.View, it will create an invisible wrapper which will behave correctly with existing logic. This diff bring both use cases to work properly.

When a shadow node has transform on it, it will affect the overflowInset values for its parent nodes, but won't affect its own or any of its child nodes overflowInset values. This is obvious for translateX/Y case, but not for scale case. Take a look at the following case:

```
     ┌────────────────┐                 ┌────────────────┐                      ┌────────────────┐
     │Original Layout │                 │  Translate AB  │                      │    Scale AB    │
     └────────────────┘                 └────────────────┘                      └────────────────┘
                                                        ─────▶           ◀─────                  ─────▶
┌ ─ ─ ─ ┬──────────┐─ ─ ─ ─ ┐     ┌ ─ ─ ─ ┬──────────┐─ ─ ─ ─ ─ ┐      ┌ ─ ─ ─ ─ ─ ┬──────────┐─ ─ ─ ─ ─ ┐
        │ A        │                      │ A        │                             │ A        │
│       │          │        │     │       │          │          │      ├ ─ ─ ─ ─ ─ ┼ ─ ─┌─────┤─ ─ ─ ─ ─ ┤
 ─ ─ ─ ─│─ ─ ─┌───┐┼ ─ ─ ─ ─              │          │                   ◀─ ─ ─    │    │AB   │  ─ ─ ─▶
│       │     │AB ││        │     │ ┌ ─ ─ ┼ ─ ─ ─ ┬──┴┬ ─ ─ ─ ─ ┤      │           │    │     │          │
        └─────┤   ├┘                      └───────┤AB │                            └────┤     │
│             │┌──┴─────────┤     │ │             │   │         │      │ │              │ ┌───┴──────────┤
              ││ABC         │                     │┌──┴─────────┐                       │ │ABC           │
│             │└──┬─────────┤   │ │ │             ││ABC         │    │ │ │              │ │              │
┌───ABD───────┴─┐ │             │                 │└──┬─────────┘    │   ▼              │ └───┬──────────┘
├─────────────┬─┘ │         │   │ │ ├───ABD───────┴─┐ │         │    │ ├────────────────┴──┐  │          │
 ─ ─ ─ ─ ─ ─ ─└───┘─ ─ ─ ─ ─    ▼   └─────────────┬─┘ │              ▼ │      ABD          │  │
                                  └ ┴ ─ ─ ─ ─ ─ ─ ┴───┴ ─ ─ ─ ─ ┘      ├────────────────┬──┘  │          │
                                                                        ─ ─ ─ ─ ─ ─ ─ ─ ┴─────┴ ─ ─ ─ ─ ─
```

For the translate case, only view A has change on the overflowInset values for `right` and `bottom`. Note that the `left` and `top` are not changed as we union before and after transform is applied.

For the scale case, similar things are happening for view A, and both `left`, `right`, and `bottom` values are increased. However, for View AB or any of its children, they only *appear* to be increased, but that is purely cosmetic as it's caused by transform. The actual values are not changed, which will later be converted during render phase to actual pixels on screen.

In summary, overflowInset is affected from child nodes transform matrix to the current node (bottom up), but not from transform matrix on the current node to child nodes (top down). So the correct way to apply transform is to make it only affect calculating `contentFrame` during layout, which collects child nodes layout information and their transforms. The `contentFrame` is then used to decide the overflowInset values for the parent node. The current transform matrix on parent node is never used as it's not affecting overflowInset for the current node or its child nodes.

This diff reflects the context above with added unit test to cover the scale and translate transform matrix.

Changelog:
[Android/IOS][Fixed] - Fixed how we calculate overflowInset with transform matrix

Reviewed By: sammy-SC

Differential Revision: D34433404

fbshipit-source-id: 0e48e4af4cfd5a6dd32a30e7667686e8ef1a7004
2022-03-01 14:33:04 -08:00
Janic Duplessis cff9590864 Implement Runtime.getHeapUsage for hermes chrome inspector (#33173)
Summary:
Reland of https://github.com/facebook/react-native/issues/32895 with fix for optional params object.

Original description:

I was looking at the hermes chrome devtools integration and noticed requests to `Runtime.getHeapUsage` which was not implemented. When implemented it will show a summary of memory usage of the javascript instance in devtools.

<img width="325" alt="image" src="https://user-images.githubusercontent.com/2677334/149637113-e1d95d26-9e26-46c2-9be6-47d22284f15f.png">

## Changelog

[General] [Added] - Implement Runtime.getHeapUsage for hermes chrome inspector

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

Test Plan:
I was able to reproduce the issue that caused the initial PR to be reverted using the resume request in Flipper. Pausing JS execution then resuming it will cause it to crash before this change, and works fine after.

Before

<img width="912" alt="image" src="https://user-images.githubusercontent.com/2677334/149637073-15f4e1fa-8183-42dc-8673-d4371731415c.png">

After

<img width="1076" alt="image" src="https://user-images.githubusercontent.com/2677334/149637085-579dee8f-5efb-4658-b0a8-2400bd119924.png">

Reviewed By: jpporto

Differential Revision: D34446672

Pulled By: ShikaSD

fbshipit-source-id: 6e26b8d53cd88cddded36437c72a01822551b9d0
2022-03-01 10:09:05 -08:00
David Vacca be9cf17316 Move TextLayoutManager constructor to Cpp file
Summary:
Move TextLayoutManager constructor to Cpp file

changelog: [internal] internal

Reviewed By: genkikondo

Differential Revision: D34246014

fbshipit-source-id: a85e144b05e2cefad8cb1757dad14bedacbb8d74
2022-02-27 22:23:48 -08:00
David Vacca 3fb3ce4fa2 Delete TextMeasurement destructor
Summary:
TextMeasurement destructor is not necessary, we are deleting it

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D34246015

fbshipit-source-id: 6ca4803fafc8b195828d546ba8fb45353257f383
2022-02-27 22:23:48 -08:00
David Vacca 926ab6ca26 Mark TextLayoutManager as not copyable / not movable
Summary:
TextLayoutManger should be not copyable / not movable

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D34246013

fbshipit-source-id: dc20db2ad9e2709ddca5bef5218356bd2b292c2d
2022-02-27 22:23:48 -08:00
Paige Sun 6e03945c7f Use @synthesize viewRegistry_DEPRECATED for Keyframes to remove RCTWeakViewHolder hack
Summary:
Changelog: [iOS][Internal] Use synthesize viewRegistry_DEPRECATED for Keyframes to remove RCTWeakViewHolder

Remove the `RCTWeakViewHolder` hack, since it can be replaced with `viewRegistry_DEPRECATED viewForReactTag`.

Reviewed By: RSNara

Differential Revision: D34468082

fbshipit-source-id: be41ed2df6ee195409724f6069fd99a793dca01a
2022-02-25 13:45:22 -08:00
Paige Sun 34c953f398 4/5 Attach @synthesize ivars to RCTViewManagers using RCTBridgeModuleDecorator in Bridgeless mode
Summary:
Changelog: [iOS][Internal] 4/5 Attach synthesize ivars to RCTViewManagers using RCTBridgeModuleDecorator in Bridgeless mode

- In RCTInstance, insert RCTBridgeModuleDecorator into RCTInstance into contextContainer
- In LegacyViewManagerInteropComponentDescriptor.mm, unwrap RCTBridgeModuleDecorator from contextContainer
- Then pass RCTBridgeModuleDecorator from LegacyViewManagerInteropComponentDescriptor to RCTLegacyViewManagerInteropCoordinator
- In RCTLegacyViewManagerInteropCoordinator, call `RCTBridgeModuleDecorator attachInteropAPIsToModule` to attach synthesize ivars to all RCTViewManagers.

This does not affect Bridge mode.

Reviewed By: RSNara

Differential Revision: D34439950

fbshipit-source-id: d814c56a52f226e3a2c96fea01efb51afc571721
2022-02-25 08:50:34 -08:00
Pieter De Baets dc50308994 Remove default usages of enable_exceptions/rtti
Summary: Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34379947

fbshipit-source-id: abff08ec99cff60d16ff82b7c0422d72caffd59b
2022-02-25 07:46:11 -08:00
Pieter De Baets 4b1c8584e1 Remove size_ field from RawPropsParser
Summary:
`size_` will always match `keys_.size()` so we don't have to keep track of it.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D34391445

fbshipit-source-id: f6c9316c989137425abfb7b3d72b571d08240f34
2022-02-25 04:08:01 -08:00
Andrei Shikov 78f6cdf2be Fix OSS native Android build (#33167)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/33167

The build is failing with:

```
error: undefined reference to 'folly::SharedMutexImpl<false, void, std::__ndk1::atomic, folly::SharedMutexPolicyDefault>::unlock_shared()'
```

Indicating missing link to `folly_futures`.

Changelog: [Internal]

Reviewed By: cortinico, GijsWeterings

Differential Revision: D34419236

fbshipit-source-id: ca777e0c3a13c2f23791a94b13de18911c93edd5
2022-02-23 09:23:21 -08:00
Andrei Shikov 1953f6f02e Exclude raw props from view shadow nodes
Summary:
With the `MapBuffer`-based props calculated from C++ props, there's no need to keep `rawProps` around for Android views.

This change makes sure that the `rawProps` field is only initialized under the feature flag that is responsible for enabling `MapBuffer` for prop diffing, potentially decreasing memory footprint and speeding up node initialization as JS props don't have to be converted to `folly::dynamic` anymore.

For layout animations, props rely on C++ values, so there's no need to update `rawProps` values either.

Changelog: [Internal][Android] - Do not init `rawProps` when mapbuffer serialization is used for ViewProps.

Reviewed By: mdvacca

Differential Revision: D33793044

fbshipit-source-id: 35873b10d3ca8b152b25344ef2c27aff9641846f
2022-02-22 17:23:05 -08:00
Andrei Shikov 733f228506 Diff C++ props for Android consumption
Summary:
Creates a mapbuffer from two ViewProp objects. This MapBuffer is used later instead of bag of props from JS to set the properties with platform ViewManager.

Changelog: [Internal] - Added MapBuffer diffing for ViewProps

Reviewed By: mdvacca

Differential Revision: D33735246

fbshipit-source-id: 10ad46251ea71aa844586624c888f5223fa44e57
2022-02-22 08:23:40 -08:00
Andrei Shikov da72b5d02c Add accessibility and view props required for Android to C++ layer
Summary:
Parses a set of props previously missing from C++ representation (they weren't required for iOS and core processing before).

Changelog: [Internal] - Added missing fields for Android to C++ view props

Reviewed By: sammy-SC

Differential Revision: D33797489

fbshipit-source-id: 1625baa0c1a592fcef409a5f206496dff0368912
2022-02-22 08:23:40 -08:00
Samuel Susla b8662f8f8a Remove mobile config remove_outstanding_surfaces_on_destruction_android
Summary:
changelog: [internal]

fewer flags = fewer problems.

Reviewed By: javache

Differential Revision: D34380114

fbshipit-source-id: c7213bd31e253fabeefc2514c7b51611d7c47e4e
2022-02-22 07:23:16 -08:00
Pieter De Baets d31c0c9109 Avoid string copy in RawPropsKey comparison
Summary:
Small performance improvement since we don't need to copy the char * into a string just for the sake of comparison.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D34351387

fbshipit-source-id: 10163164f6e95ab0737e8f865c37d8f0c3500662
2022-02-22 03:23:12 -08:00
Samuel Susla bb7214b9c4 Allow tests to be executed in platform agnostic environment
Summary:
changelog: [internal]

Make ManagedObjectWrapper compile in platform independent environment.

Reviewed By: ryancat

Differential Revision: D34302957

fbshipit-source-id: 50bf296983525c48cda1e532934b9998077c9fbf
2022-02-18 09:23:27 -08:00
Samuel Susla 5e88223d85 Add support for nested components in legacy interop
Summary: changelog: [internal]

Reviewed By: ShikaSD

Differential Revision: D34173837

fbshipit-source-id: 09fbf12e9d8eb13a170ff92afff97f203d0ef805
2022-02-18 07:11:44 -08:00
Pieter De Baets 45af635b1e Fix some nits/typos in MapBuffer
Summary:
Was trying out some behaviour when using the MapBuffer experiment and fixed some small issues.

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34108859

fbshipit-source-id: 550ca0847419006ec17472cc4b70d38fc8d05396
2022-02-15 14:06:42 -08:00
Neil Dhar 9010bfe457 Add PropNameID::fromSymbol
Summary:
Changelog:
[General][Added] - Add ability to access properties with symbol keys through JSI

Reviewed By: mhorowitz

Differential Revision: D33830544

fbshipit-source-id: 8de366b4c7d5ea9d2fd5df70dfb776a056e23806
2022-02-14 22:29:16 -08:00
Genki Kondo 49f3f47b1e Support color animation with native driver for iOS
Summary:
Adds support for Animated.Color with native driver for iOS. Reads the native config for the rbga channel AnimatedNodes, and on update(), converts the values into a SharedColor.

Followup changes will include support for platform colors.

Ran update_pods: https://www.internalfb.com/intern/wiki/React_Native/Preparing_to_Ship/Open_Source_Pods/

Changelog:
[iOS][Added] - Support running animations with AnimatedColor with native driver

Reviewed By: sammy-SC

Differential Revision: D33860583

fbshipit-source-id: 990ad0f754a21e3939f2cb233bcfa793ef12eb14
2022-02-10 11:18:39 -08:00
Andrei Shikov 980c52de41 Disable view flattening when the view has event handlers on Android
Summary:
The views with touch event props are currently flattened by Fabric core, as we don't take event listeners into account when calculating whether the view should be flattened. This results in a confusing situation when components with touch event listeners (e.g. `<View onTouchStart={() => {}} /> `) or ones using `PanResponder` are either ignored (iOS) or cause a crash (Android).

This change passes touch event props to C++ layer and uses them to calculate whether the view node should be flattened or not. It also refactors events to be kept as a singular bitset with 32 bit (~`uint32_t`).

Changelog: [Changed][General] Avoid flattening nodes with event props

Reviewed By: sammy-SC

Differential Revision: D34005536

fbshipit-source-id: 96255b389a7bfff4aa208a96fd0c173d9edf1512
2022-02-10 06:07:39 -08:00
John Porto b467094f18 Add StringPrimitive::create for UTF8 strings
Summary:
This is pre-work for adding the v8 stack trace API support.

Changelog: [Internal]

Reviewed By: kodafb

Differential Revision: D34048366

fbshipit-source-id: 9d2b469767f7669cb428c61b215f193894892c03
2022-02-10 05:00:32 -08:00
Chiara Mooney 42b391775f Fix ReactCommon Break for Windows (#33047)
Summary:
Changes to MapBuffer code in aaff15c...d287598 broke build for Windows. Errors included incompatible type conversions, the use of `__attribute__(__packed__)` which is only supported by GCC and Clang, and the usage of designated initializers which are only supported on C++20.

Changes here restore build on Windows.

## Changelog

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

[General] [Fixed] - Fix build break on Windows with ReactCommon

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

Test Plan: React Native project built on Windows and passes react-native-windows repository pipeline. These edits are currently merged into the main branch of react-native-windows.

Reviewed By: ShikaSD

Differential Revision: D34101367

Pulled By: philIip

fbshipit-source-id: 1596365c2e92f377c6375805b33de5e1c7b78e66
2022-02-09 13:03:10 -08:00
Andrei Shikov 3112238b14 De-duplicate conversion of SharedColor to Android int value
Summary:
Removes duplicated code in SharedColor conversions. The original copy was done for the MapBuffer experiment, as the method was returning `folly::dynamic` instead of integer. Nothing prevents us from returning integer here directly, so we can keep one implementation.

Changelog: [Internal] - Removed duplicated SharedColor conversion for Android

Reviewed By: javache

Differential Revision: D33797490

fbshipit-source-id: 196657f0616e6cb7e987225b76328fe77fd6c28a
2022-02-09 10:26:30 -08:00
Pieter De Baets a75bbe7552 Fix docs in ModalHostView headers
Summary:
Copy-paste error

Changelog: [Internal]

Reviewed By: genkikondo

Differential Revision: D34077530

fbshipit-source-id: 04ab17ba9308762361d993b7ed1b372af400b8d1
2022-02-09 03:03:09 -08:00
CodemodService FBSourceClangFormatLinterBot e737270d11 Daily `arc lint --take CLANGFORMAT`
Reviewed By: zertosh

Differential Revision: D34099214

fbshipit-source-id: 7a1fc8550968d8b87f016e4bf706252bf03e4483
2022-02-08 19:15:34 -08:00
Neil Dhar 5b66bb90c6 Add missing symbol handling in kindToString
Summary: Changelog: [Internal]

Reviewed By: kodafb

Differential Revision: D34062869

fbshipit-source-id: 08fed59d62b0d0a46e0868874a89b125731a44e5
2022-02-08 15:18:15 -08:00
Raphael Herouart 669cd0257c Test Chrome DevTools Notifications
Summary:
Some test to make sure hermes engine follows the Chrome DevTools Protocol for all implemented Debugger Notifications
Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34055503

fbshipit-source-id: 8c2dd1066ba2b68e395226f15954d303894d0365
2022-02-08 06:46:31 -08:00
Raphael Herouart 921ed737eb Test Chrome DevTools Protocol Responses Format
Summary:
Some test to make sure hermes engine follows the Chrome DevTools Protocol for all implemented Debugger Responses
Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34052619

fbshipit-source-id: d213ed41335b64bf3168a43ce043f2c57f05fc52
2022-02-08 06:46:30 -08:00
Samuel Susla d79f658016 Rename RuntimeScheduler::callImmediates to RuntimeScheduelr::callExpiredTasks
Summary:
changelog: [internal]

Rename method so it does not collide with immediates that already exist in React Native.

Reviewed By: javache

Differential Revision: D34041418

fbshipit-source-id: 0ae75b683983c3be50320b195a7068d7178b0ed8
2022-02-07 10:06:07 -08:00
Raphael Herouart 31a92b008d Add some tests for compliance to the Chrome DevTools Protocol
Summary:
Some test to make sure hermes engine follows the Chrome DevTools Protocol for all implemented Debugger Messages

Changelog: [Internal]

Reviewed By: ShikaSD

Differential Revision: D34042008

fbshipit-source-id: 3a074e9840706ca977ff86d050e67b0dcea5c7ef
2022-02-07 09:06:31 -08:00
Samuel Susla ee454e4f0b Add description to ConcreteComponentDescriptor::adopt
Summary: changelog: [internal]

Reviewed By: javache

Differential Revision: D34041312

fbshipit-source-id: 3b6d650034481813273f67444426e2fa5cb7d59f
2022-02-07 09:03:56 -08:00
Andrei Shikov 2bc883e6b7 Back out "Implement Runtime.getHeapUsage for hermes chrome inspector"
Summary:
The new messages are breaking SparkAR VSCode debugger
Original commit changeset: 49d863e6a58d
Original Phabricator Diff: D33616658 (3568a72987)
Changelog: [Internal]

Reviewed By: the-over-ape

Differential Revision: D34003669

fbshipit-source-id: 5327820cda60d5f58521da56e2e1f5d824bf861d
2022-02-04 07:20:31 -08:00
Samuel Susla 5e933fdd2a Yield for each access to the runtime
Summary:
changelog: [internal]

With multiple requests to the runtime, we need to make sure they are all granted before React continues with rendering. A boolean is not enough to track this. The first lambda that has VM will set it to false and subsequent requests will have to wait for React to finish rendering.

To prevent this, we can count how many lambdas are pending access to the runtime.

Reviewed By: ShikaSD

Differential Revision: D33792734

fbshipit-source-id: f785fae3575470179dd69acc6a466211b79b633b
2022-02-03 10:20:33 -08:00
Samuel Susla 491c4231db Pass raw ShadowNode instead of shared_ptr
Summary:
changelog: [internal]

pass raw ShadowNode instead of shared_ptr. Ownership is not transferred, shared_ptr is misleading.

Reviewed By: javache

Differential Revision: D33917010

fbshipit-source-id: 4d9fdd4b4e0376149f1719ad160b957de4afdce3
2022-02-03 04:30:10 -08:00
Janic Duplessis 3568a72987 Implement Runtime.getHeapUsage for hermes chrome inspector (#32895)
Summary:
I was looking at the hermes chrome devtools integration and noticed requests to `Runtime.getHeapUsage` which was not implemented. When implemented it will show a summary of memory usage of the javascript instance in devtools.

<img width="325" alt="image" src="https://user-images.githubusercontent.com/2677334/149637113-e1d95d26-9e26-46c2-9be6-47d22284f15f.png">

## Changelog

[General] [Added] - Implement Runtime.getHeapUsage for hermes chrome inspector

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

Test Plan:
Before

<img width="912" alt="image" src="https://user-images.githubusercontent.com/2677334/149637073-15f4e1fa-8183-42dc-8673-d4371731415c.png">

After

<img width="1076" alt="image" src="https://user-images.githubusercontent.com/2677334/149637085-579dee8f-5efb-4658-b0a8-2400bd119924.png">

Reviewed By: christophpurrer

Differential Revision: D33616658

Pulled By: ShikaSD

fbshipit-source-id: 49d863e6a58d4a92d4c86f9a288ac33ed8d2cb0d
2022-02-02 10:37:06 -08:00
John Porto eb08af57a9 Implement Runtime.callFunctionOn
Summary:
[Hermes][Inspector] Implement the CDP API for calling a function on an object.

Changelog: [Internal]

Reviewed By: avp

Differential Revision: D33722301

fbshipit-source-id: da26e865cf29920be77c5c602dde1b443b4c64da
2022-02-01 16:50:14 -08:00
Felipe Perez 3552ff0562 Back out "Delete RuntimeScheduler yielding mobile config"
Summary:
D33740360 (16ed62a850) broke Explore VR on React Native. The app would go into a loop on boot and not finish mounting. This is probably a product code issue, but it's not a trivial issue to solve. Unlanding to unblock the RN migration.

Changelog:

[internal] internal

Reviewed By: mdvacca

Differential Revision: D33918026

fbshipit-source-id: cc77c70ece9994d82c91f7ae8783e959629e9cfb
2022-02-01 15:17:14 -08:00
Samuel Susla 6351064b75 Introduce RuntimeScheduler::callImmediates
Summary:
changelog: [internal]

React on web uses microtasks to schedule a synchronous update for discrete event. Microtasks are not yet available in React Native and as a fallback, React uses native scheduler and task with immediate priority. Until Microtasks are in place, React Native needs to make sure all immediate tasks are executed after it dispatches each event.

I tried to stay as close to [microtask standard](https://developer.mozilla.org/en-US/docs/Web/API/queueMicrotask) as I reasonably could.

Once microtasks on RN are shipped, this code can be removed.

Reviewed By: mdvacca

Differential Revision: D33742583

fbshipit-source-id: eddebb1bd5131ee056252faad48327a70de78a4a
2022-01-28 16:35:18 -08:00
John Porto d2f5044c37 Catch exceptions thrown by user callbacks
Summary:
Calls to Inspector::evaluate() and Inspector::executeIfEnabled()
take a user-provided callback which are not try-guarded. This
means that, should the user code throw, the inspector's process
will likely die due to the unhandled exception. This change
makes sure that, if the user provided callback throws, then
the promise attached to those methods will be fulfilled by
an exception.

Change: [internal]

Reviewed By: avp

Differential Revision: D33852073

fbshipit-source-id: 7fbb6662b28d393a5d5b494c004aa9521e23ebb6
2022-01-28 13:38:27 -08:00
Xin Chen 8aa87814f6 Consider transform when calculating overflowInset values
Summary:
The fix in this diff seems simple, but it took some time to understand why this change fixed the issue that views animated use native driver out from their parent's layout are not getting touch events.

We introduced `overflowInset` to RN Android a while back to give each shadow node extra information to cover all its children's layout. These values (left, top, right, bottom extensions from the view's own layout) help us improve hit-testing algorithm used in touch events. We could ignore all subtrees that the touch point not in their parent's overflowInset box.

However, this was not working for native animation. When `userNativeDriver` is on, all animation happens without Fabric knows anything about them. The overflowInset is out of date with the final animated layout, which caused the issue that we ignored the animated view as we thought it's not under the pointer.

Here is a playground demo (P476407654) for the issue:

https://pxl.cl/1XfPL

We've tried to fix this by passing the final animated values via `passthroughAnimatedPropExplicitValues` added in D32539976. This is a prop that will get merged into `style` prop for [animation component](https://fburl.com/code/jybzfgu5). The transform values were already applied when measuring layout in [Pressability](https://fburl.com/code/5mect2k3), which uses [LayoutableShadowNode](https://fburl.com/code/qh8fufrw). However, this is not the case for overflowInset calculation. Hence, the fix here is to apply the transform matrix in Yoga before calculating the overflowInset.

Changelog:
[Android][Fixed] - Fix overflowInset calculation by using transform values

Reviewed By: ShikaSD

Differential Revision: D33806030

fbshipit-source-id: e438618e3d6e5b0333cff9ff9919b841d73b2e9d
2022-01-28 10:37:34 -08:00
David Vacca 4b7face721 Move pointerEvents from formsStacking -> formsView
Summary:
This was a bug, we are fixing it.

Move pointerEvents from formsStacking -> formsView and we are also removing "onLayout" from formsStackingContext

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D33846660

fbshipit-source-id: 6b65a9a7815972e34dafbc48b3d732d9b02d5e9f
2022-01-28 09:30:17 -08:00
Pieter De Baets 20b9ed91c0 Remove FBREMAP experiment
Summary:
The flag was removed in https://www.internalfb.com/diff/D28467996 (2c5f68df46) but the code was not removed yet.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D33792884

fbshipit-source-id: 0ae5d904ca2ca94437ca63b495d41e47585fde33
2022-01-27 12:02:19 -08:00
Pieter De Baets 86fa2a5106 Emit warning when dispatching event to null target
Reviewed By: ShikaSD

Differential Revision: D33767454

fbshipit-source-id: c2f10b6b857544c06780fb13b66417d12f9b8d2c
2022-01-26 11:24:32 -08:00
Samuel Susla b856465e3a Add missing header and initialisation in RuntimeSchedulerTest
Summary: changelog: [internal]

Reviewed By: ShikaSD

Differential Revision: D33789519

fbshipit-source-id: 395c0cc7ddd1d63fbe57efb8f3212e5f5647e2bd
2022-01-26 09:23:08 -08:00
Samuel Susla 9bf533e6b8 Remove shared_ptr from RuntimeScheduler::cancelTask interface and add comments
Summary:
Changelog: [internal]

Add comments and avoid using shared_ptr unnecessarily.

Why note shared_ptr? Using shared_ptr suggests we are transferring ownership of object, which we are not.

Reviewed By: javache

Differential Revision: D33741836

fbshipit-source-id: 56ebb098e6185793f05e2bb587005bb0f093c0c9
2022-01-26 09:23:08 -08:00
Samuel Susla 16ed62a850 Delete RuntimeScheduler yielding mobile config
Summary:
changelog: [internal]

Yielding in RuntimeScheduler is shipped. This diff removes the gating around it.

Reviewed By: sshic

Differential Revision: D33740360

fbshipit-source-id: 267372e81e66dda96e451435954a7c3546cc6fbe
2022-01-26 09:23:08 -08:00
Andrei Shikov 3c86e82a02 Namespace MapBuffer structs and typealiases by moving them into class
Summary:
Refactors MapBuffer-related `primitives.h` to be namespaced with `MapBuffer` class, to avoid name collisions and confusion later on.
Most of the size constants are moved to relevant .cpp files or updated to use `sizeof`.

Additionally, adds a little bit of documentation about `MapBuffer` serialization format.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33662487

fbshipit-source-id: 5a7a2b1c7f2bb13ee1edfc5fae51ba88c34f0d3c
2022-01-20 12:57:22 -08:00
Andrei Shikov adb2167640 Serialize and assert type information in mapbuffer
Summary:
Serializes type information along with key/value in MapBuffer, asserting the data type on Java side during read. At the moment, accessing value with incorrect will result in a crash.

Other changes:
Adds a `getType` method to verify types before accessing them.
Removes `null` as a type, as just not inserting value and checking for its existence with `hasKey` is more optimal.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33656841

fbshipit-source-id: 23a78daa0d84704aab141088b5dfe881e9609472
2022-01-20 12:57:22 -08:00
Andrei Shikov d287598d23 Allow random stores and accesses to MapBuffer values
Summary:
Removes the need to store keys in incremental order by sorting them after before inserting into MapBuffer.
Updates MapBuffer to support random access on C++ side, actually retrieving values by keys and not bucket index.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33611758

fbshipit-source-id: c81e970613c8ecc688bfacb29ba038bf081a0c0f
2022-01-20 12:57:22 -08:00
Andrei Shikov b173bf3c0e Minor MapBuffer renames for consistency
Summary:
Rename `_header` to `header_` to align with the C++ naming scheme we use.
Rename `readKey` to `readUnsignedShort` as purpose of the method have changed.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D33637127

fbshipit-source-id: a82f4d6c1b753b21e0567fbe919af98e4c78105d
2022-01-18 18:00:07 -08:00
Andrei Shikov c338fff521 Cast MapBuffer bytes to struct to read header
Summary:
The struct is copied directly to the buffer, so it is safe to read it back.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D33624036

fbshipit-source-id: 7ee2b28b815690ab471832c0c622a075b5dd7d78
2022-01-18 08:04:54 -08:00
Andrei Shikov 5b489d5f95 Use vector for dynamic data in MapBufferBuilder
Summary:
Replaces dynamic manually managed array with a vector of bytes, removing the need for managing memory manually.

This approach is a little bit slower than before, as vector is allocating memory more conservatively. This can be improved in the future by providing an estimate for the data size.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D33611759

fbshipit-source-id: a0e5e57c4e413206a9f891cd5630ecc9088a9bf7
2022-01-17 13:15:49 -08:00
Andrei Shikov b1ef4405ee Use struct for building mapbuffer buckets
Summary:
Instead of copying integer values into key/value data array, this implementation keeps a structured vector of `Bucket` structs (which is sized to be serialized later).

This approach provides multiple benefits to modify and access buckets (e.g. sort them based on the key, allowing for out of order inserts (D33611758))

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D33601231

fbshipit-source-id: 62ace1374936cb504836d6eae672e909ea404e3f
2022-01-17 13:15:49 -08:00
Andrei Shikov 0b48ef7ca8 Add more complex perf test for the mapbuffer
Summary:
Benchmarks performance/correctness of mapbuffer with several different types of data

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33608299

fbshipit-source-id: 81b1e195aecac60ad1cc3ca416d1cf7b09feab32
2022-01-16 23:07:40 -08:00
Andrei Shikov ea712f825a Use reference when copying strings into mapbuffer
Summary:
This method can produce unnecessary copy of the string, replacing it with reference to optimize.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33607765

fbshipit-source-id: e04eddffec063c0c8e173bfdf690e7b8e1050525
2022-01-16 23:07:40 -08:00
Andrei Shikov f33892081a Cleanup ReadableMapBuffer
Summary:
Cleans up `ReadableMapBuffer` APIs and migrates to use `std::vector` instead of raw pointer array.

Also uses `fbjni` utility to allocate the bytes instead of making manual JNI calls.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D33513027

fbshipit-source-id: afe7d320d12830503de4c9994117d849f0b25245
2022-01-12 08:13:32 -08:00
Andrei Shikov aaff15c2c8 Use std::vector to manage MapBuffer storage
Summary:
Replaces raw array pointer inside `MapBuffer` with `std::vector`, which is more conventional "safer" way of storing dynamically sized arrays.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D33512115

fbshipit-source-id: d875a2240f7938fd35c4c3ae0e7e91dc7456ff32
2022-01-12 08:13:32 -08:00
Moses DeJong 5baf6875f7 TurboModules: use weakSelf for block sent to main thread
Summary:
TurboModules: use weakSelf for block sent to main thread.

Changelog:
[iOS][Fixed] - Use weakSelf in objc block instead of self.

Reviewed By: RSNara

Differential Revision: D33488938

fbshipit-source-id: d03c98fb59fbd1fc4b67686251ebec541e5d3e6c
2022-01-11 23:21:51 -08:00
Samuel Susla bdd25ed6a3 Clean up ShadowTree::progressState
Summary:
changelog: [internal]

Use std::vector access operator without bounds checking.

Trying to resolve T108113554 and discovered this inefficiency.

Reviewed By: mdvacca

Differential Revision: D33349619

fbshipit-source-id: e9000a054ba9e7e6835105b7558dbf1a9a04deff
2022-01-05 09:10:06 -08:00
Samuel Susla 681ed402de Turning on clang tidy performance-*
Summary:
changelog: [internal]

Enable performance related clang tidy rules.

Reviewed By: javache

Differential Revision: D33350556

fbshipit-source-id: 486446ed0a1ac88af21b691ac6905b4f2359dafc
2022-01-05 05:53:13 -08:00
Samuel Susla d639fe1f3d Make iterators const in LayoutAnimationKeyFrameManager
Summary:
changelog: [internal]

Just making more stuff const.

Reviewed By: mdvacca

Differential Revision: D33254016

fbshipit-source-id: 9a170b025c065845432933bd851148599124b525
2022-01-04 11:42:16 -08:00
Andres Suarez 8bd3edec88 Update copyright headers from Facebook to Meta
Reviewed By: aaronabramov

Differential Revision: D33367752

fbshipit-source-id: 4ce94d184485e5ee0a62cf67ad2d3ba16e285c8f
2021-12-30 15:11:21 -08:00
Samuel Susla 8c6a98400e Introduce TextInput.onChangeSync
Summary:
changelog: [internal]

Add experimental `TextInput.onChangeSync` which delivers onChange event synchronously.

Reviewed By: ShikaSD

Differential Revision: D33188083

fbshipit-source-id: 1e1dcd0d71c7eec98d3d5f69967659e07ac4e6a6
2021-12-30 06:38:50 -08:00
Samuel Susla f85273d484 Enable modernize-use-transparent-functors clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-transparent-functors.html

Reviewed By: rubennorte

Differential Revision: D33297509

fbshipit-source-id: 4b5c38e6fe0eab9aa39131f0200cf9c5654ec19f
2021-12-23 10:21:10 -08:00
Samuel Susla b76a488199 Enable modernize-use-using clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-using.html

Reviewed By: rubennorte

Differential Revision: D33297576

fbshipit-source-id: 1124c410f0b950b0eb37e1b0e950ba9e76925dce
2021-12-23 10:21:10 -08:00
Samuel Susla 8d9101e578 Enable modernize-use-override clang tidy rule
Summary:
changelog: [internal]

You can read more about this on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-override.html

Reviewed By: rubennorte

Differential Revision: D33297524

fbshipit-source-id: 259aa6f0b3ceb0ef065497199f72760449634ffc
2021-12-23 10:21:10 -08:00
Samuel Susla 1d0495e0a2 Enable modernize-use-equals-delete clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-delete.html

Reviewed By: rubennorte

Differential Revision: D33296068

fbshipit-source-id: 72e7ae199da39527476494729b1ab862e7e989e4
2021-12-23 10:21:10 -08:00
Samuel Susla 76af846c1d Enable modernize-use-noexcept clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-noexcept.html

Reviewed By: rubennorte

Differential Revision: D33296107

fbshipit-source-id: 5a27b3e1c9e2da71a0eee149f25d9d70ca83b443
2021-12-23 10:21:10 -08:00
Samuel Susla 52b7828cdc Enable modernize-use-default-member-init clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-default-member-init.html

Reviewed By: rubennorte

Differential Revision: D33296545

fbshipit-source-id: e6813542b76e50db0a4b3ae9fdfafde2dbd8ac5b
2021-12-23 10:21:10 -08:00
Samuel Susla d8d4e95697 Enable modernize-use-nullptr clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html

Reviewed By: rubennorte

Differential Revision: D33296118

fbshipit-source-id: ba9de4611c0f0459db9cea56722385e2541b155e
2021-12-23 10:21:09 -08:00
Samuel Susla bf9872a7b5 Enable modernize-use-equals-default clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-equals-default.html

Reviewed By: rubennorte

Differential Revision: D33295116

fbshipit-source-id: d7da62c35e141fc2bf5a83c28f80f4f8d355c4cb
2021-12-23 10:21:09 -08:00
Samuel Susla 1251b2f993 Enable modernize-shrink-to-fix clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-shrink-to-fit.html

Reviewed By: rubennorte

Differential Revision: D33280814

fbshipit-source-id: f7b17e57b540cf4461dca1f3fa266b02f24ce455
2021-12-23 10:21:09 -08:00
Samuel Susla 9c5518f77e Enable modernize-use-emplace clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-emplace.html

Reviewed By: rubennorte

Differential Revision: D33295156

fbshipit-source-id: 91a7bd34d689506ea9a68462b050c41fdb3faa4e
2021-12-23 10:21:09 -08:00
Samuel Susla 6c7581c6b3 Enable modernize-unary-static-assert clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-unary-static-assert.html#:~:text=The%20check%20diagnoses%20any%20static_assert,%2B%2B17%20and%20later%20code.

Reviewed By: rubennorte

Differential Revision: D33281759

fbshipit-source-id: 0399229947dce5f9297c4f65567b299dc0dca7ba
2021-12-23 10:21:09 -08:00
Samuel Susla b9cbd5a104 Enable modernize-replace-random-shuffle clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-replace-random-shuffle.html

Reviewed By: rubennorte

Differential Revision: D33279255

fbshipit-source-id: 0802cbafee448cfd5eed7f866a44ae3f3c5eb0fd
2021-12-23 10:21:09 -08:00
Samuel Susla 9419bebb98 Enable modernize-use-bool-literals clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-bool-literals.html

Reviewed By: feedthejim

Differential Revision: D33295106

fbshipit-source-id: 34e68153a6796d5b9120166aeca6461ae0936e1e
2021-12-23 07:53:50 -08:00
Samuel Susla 474682dab7 Enable modernize-replace-auto-ptr clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-replace-auto-ptr.html

Reviewed By: fkgozali

Differential Revision: D33279163

fbshipit-source-id: b04c7fb4ff4caa0320c312ae187a7bcfe42cb3d3
2021-12-23 07:53:49 -08:00
Samuel Susla 028fb20e4b Enable modernize-raw-string-literal clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-raw-string-literal.html

Reviewed By: fkgozali

Differential Revision: D33277859

fbshipit-source-id: 2a1c980f72fee36451cc84ee0255c2e90a8f810a
2021-12-23 07:53:49 -08:00
Samuel Susla 5fa6c5a941 Enable modernize-pass-by-value clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-pass-by-value.html

# Isn't it wasteful to copy? Isn't reference more efficient?

This rule of thumb is no longer true since C++11 with move semantics. Let's look at some examples.

# Option one

```
class TextHolder
{
public:
   TextBox(std::string const &text) : text_(text) {}
private:
   std::string text_;
};
```

By using reference here, we prevent the caller from using rvalue to and avoiding copy. Regardless of what the caller passes in, copy always happens.

# Option two

```
class TextHolder
{
public:
   TextBox(std::string const &text) : text_(text) {}
   TextBox(std::string &&text) : text_(std::move(text)) {}
private:
   std::string text_;
};
```
Here, we provide two constructors, one for const reference and one for rvalue reference. This gives the caller option to avoid copy. But now we have two constructors, which is not ideal.

# Option three (what we do in this diff)

```
class TextHolder
{
public:
   TextBox(std::string text) : text_(std::move(text)) {}
private:
   std::string text_;
};
```
Here, the caller has option to avoid copy and we only have single constructor.

Reviewed By: fkgozali, JoshuaGross

Differential Revision: D33276841

fbshipit-source-id: 619d5123d2e28937b22874650366629f24f20a63
2021-12-23 07:53:48 -08:00
Samuel Susla 70b346fb9c Enable modernize-make-unique clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-make-unique.html

Reviewed By: feedthejim

Differential Revision: D33255905

fbshipit-source-id: a0c354dec37515db11633fb039de09bc97d6c228
2021-12-23 05:53:31 -08:00
Samuel Susla 6d1d2fe2b8 Enable modernize-use-auto clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-auto.html

Reviewed By: mdvacca

Differential Revision: D33281781

fbshipit-source-id: 8e23becb74305e282993fe6b3996fa1a5878cf98
2021-12-23 03:55:16 -08:00
Samuel Susla 4febfd9491 Enable modernize-return-braced-init-list clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-return-braced-init-list.html

Reviewed By: mdvacca

Differential Revision: D33279829

fbshipit-source-id: 3969eda9f0f3ed37c262d495c8e31bb4f5326eab
2021-12-23 03:55:16 -08:00
Samuel Susla c270b48f68 Enable modernize-redundant-void-arg clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-redundant-void-arg.html

Reviewed By: mdvacca

Differential Revision: D33278172

fbshipit-source-id: 5c3c6123290bd23edc7da4085277803d8745a3dd
2021-12-23 03:55:16 -08:00
Samuel Susla 5763133984 Enable modernize-make-shared clang tidy rule
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-make-shared.html

Reviewed By: ShikaSD

Differential Revision: D33254590

fbshipit-source-id: 1f5f9e7ec8e7d938490b10e880ba10a64c5ada7f
2021-12-22 08:22:44 -08:00
Samuel Susla 26fffe8cbf Enable modernize-loop-convert rule in clang-tidy
Summary:
changelog: [internal]

You can read more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-loop-convert.html

Reviewed By: ShikaSD

Differential Revision: D33253673

fbshipit-source-id: db2ec74cc584f2e8eb74ce54c4f50986d8168387
2021-12-22 08:22:44 -08:00
Samuel Susla bcc4ab35da Remove use of TextLayoutManager::Shared and SharedTextLayoutManager
Summary:
changelog: [internal]

For some reason, using `TextLayoutManager::Shared` in `TextInputShadowNode` trips up clang tidy linter. We have a plan to move away from `*::Shared` anyway, so let's remove it from `TextInputShadowNode` now.

Why do we want to move away from `*::Shared`?
Using `TextLayoutManager::Shared` is confusing for people unfamiliar with Fabric's codebase. It expresses a concept of immutability but uses term `shared`. Term shared is already used in C++  `std::shared_ptr`.

Reviewed By: fkgozali

Differential Revision: D33186422

fbshipit-source-id: 10ee588735997f5fedc372a1d1e3d9cd9684178a
2021-12-22 04:20:42 -08:00
Kevin Gozali f142bfed45 Butter C++: clarify goals/intent in the comment
Summary:
Just clarifying the purpose of this library.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D33245053

fbshipit-source-id: b4325415774ca33b34b5ba53d222a19f88e2175f
2021-12-20 23:38:52 -08:00
Kevin Gozali 6a93c07485 Butter C++: fixed clangtidy config
Summary:
Added missing `InheritParentConfig: true` per internal clang config.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D33244729

fbshipit-source-id: 9ae8f8265c202902447c8b784206f6c00222c43d
2021-12-20 23:38:52 -08:00
Kevin Gozali fb39d45ed5 C++ - better => butter
Summary:
Renaming the `better` utilities to `butter`:
- to prevent claims that this library is superior to others - it really depends on use cases
- to indicate ease of use throughout the codebase, easily spread like butter

Changelog: [C++][Changed] Renaming C++ better util to butter, used by Fabric internals

Reviewed By: JoshuaGross

Differential Revision: D33242764

fbshipit-source-id: 26dc95d9597c61ce8e66708e44ed545e0fc5cff5
2021-12-20 22:25:14 -08:00
Samuel Susla 8c3b839625 Enable modernize-deprecated-ios-base-aliases in clang-tidy
Summary:
changelog: [internal]

You can find more about this rule on https://clang.llvm.org/extra/clang-tidy/checks/modernize-deprecated-ios-base-aliases.html#:~:text=Detects%20usage%20of%20the%20deprecated,have%20a%20non%2Ddeprecated%20equivalent.

Reviewed By: ShikaSD

Differential Revision: D33237586

fbshipit-source-id: acc497fb3427f5ac2c7436af3d9627fbaed3d777
2021-12-20 11:22:43 -08:00
Samuel Susla b3fe2d40e8 Remove unused arguments
Summary:
changelog: [internal]

Linter was not happy about this.

Reviewed By: ShikaSD

Differential Revision: D33235690

fbshipit-source-id: 389a49afe2c828f60bfbfb1c6e92d2c74f676600
2021-12-20 11:22:43 -08:00
Samuel Susla eb35e4a4f6 Enable modernize-deprecated-headers rule in clang-tidy
Summary:
changelog: [internal]

You can find more about this rule on https://releases.llvm.org/6.0.1/tools/clang/tools/extra/docs/clang-tidy/checks/modernize-deprecated-headers.html

Reviewed By: ShikaSD

Differential Revision: D33235582

fbshipit-source-id: 28d38b4eab4ad535d87468bc8d64dc87c4b0aeca
2021-12-20 11:22:43 -08:00
Samuel Susla f7c96c000a Enable modernize-avoid-c-arrays in clang tidy
Summary:
changelog: [internal]

In an effort to make our codebase more approachable, I'm enabling more clang-tidy rules.

Read more about modernize-avoid-c-arrays in https://clang.llvm.org/extra/clang-tidy/checks/modernize-avoid-c-arrays.html

Reviewed By: ShikaSD

Differential Revision: D33187162

fbshipit-source-id: c6b3888f67d095274bb492a01132985ae506c0d5
2021-12-20 11:22:43 -08:00
Samuel Susla dc5cae5a6f Enable modernize-avoid-bind in clang tidy
Summary:
changelog: [internal]

I will be enabling more clang tidy rules in Fabric to make it easier for new contributors and standardise the codebase. \
You can read more about the rule in https://clang.llvm.org/extra/clang-tidy/checks/modernize-avoid-bind.html

Reviewed By: ShikaSD

Differential Revision: D33162192

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

Reviewed By: sota000

Differential Revision: D33110408

fbshipit-source-id: 8cd5004f5d40dde82fe4d6271d5b8598cd27ca31
2021-12-17 18:37:37 -08:00
Samuel Susla 6568bc4bb2 Execute only necessary minimum in sync mode in RuntimeScheduler
Summary:
changelog: [internal]

Only execute tasks that are expired when in synchronous mode.

Reviewed By: philIip

Differential Revision: D33062746

fbshipit-source-id: 1825cb572202d1f5dc18eb2b481dd3c20e8e91ba
2021-12-17 10:34:29 -08:00
Samuel Susla fd18225767 Add unit tests for RuntimeScheduler::executeNowOnTheSameThread
Summary: Changelog: [internal]

Reviewed By: philIip

Differential Revision: D33062204

fbshipit-source-id: f37375400fea645f5540b85c3c1ef6343e64be2e
2021-12-16 06:45:34 -08:00
Julio C. Rocha 1d45b20b6c Set CxxModule instance before retrieving Method vector (#32719)
Summary:
Allows `CxxModule` objects to set their `instance_` member before `getMethods()` is invoked, allowing for the `Method` callbacks to capture a weak reference to `getInstance()` if needed.

## 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] - Set CxxModules' Instance before retrieving their Method vector.

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

Test Plan: Ensure this statement swap does not break any scenarios with existing CI validation.

Reviewed By: JoshuaGross

Differential Revision: D32955616

Pulled By: genkikondo

fbshipit-source-id: fd7a23ca2c12c01882ff1600f5aef86b1fe4a984
2021-12-15 14:37:37 -08:00
Samuel Susla d902a89b40 Move surface registry code out of UIManagerBinding
Summary:
changelog: [internal]

Just moving code that doesn't belong to UIManagerBinding out of the class.

Reviewed By: philIip

Differential Revision: D33060412

fbshipit-source-id: 2d54929072cef14fd1fa6b70bde382ae21ecff45
2021-12-15 10:52:15 -08:00
Samuel Susla 34c4fdb8e2 Remove implicity type conversions from LayoutAnimations
Summary: changelog: [internal]

Reviewed By: philIip

Differential Revision: D33058920

fbshipit-source-id: 6d39e26c369dad409f5141dceae7554fe65daaba
2021-12-15 07:19:51 -08:00
David Vacca 8f6aee0df5 Create experiment to increase size of TextMeasureCache and enable in RNPanel apps
Summary:
Fabric uses a cache where it stores the result of the text measurement in C++ (to avoid unnecessary text measurement that are very costly). This cache has a "max size" of 256 and this size is not enough to store all the texts we have in the screen

In my tests, the amount of texts being measured are ~290 and after scrolling many times they increase to 611.

This diff increases the size of the TextMeasure to 1024 for users in the experiment. As a result this improves performance of HoverEvents by +5x times (see test plan)

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D33112788

fbshipit-source-id: e15feecf0f54da62b252892d37a64fb4ead29e22
2021-12-14 19:33:09 -08:00
Andrei Shikov 0088c22b3d Clang-tidy uimanager/scheduler modules
Summary:
Applies suggestions from default preset that make sense in our codebase

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D33010231

fbshipit-source-id: 6bc9edf01fd9bd9938d211e3494dd1a127b24eaa
2021-12-14 10:27:30 -08:00
Janic Duplessis 20b0eba581 Static link for hermes-inspector (#32694)
Summary:
Follow up to https://github.com/facebook/react-native/issues/32683 to also link hermes-inspector statically.

## Changelog

[Android] [Fix] - Static link for hermes-inspector

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

Test Plan: Tested a clean build and made sure hermes-inspector.so doesn't exist anymore.

Reviewed By: cortinico

Differential Revision: D32791208

Pulled By: ShikaSD

fbshipit-source-id: 6076b263469b9e2c6176d488d13292d4f1731dcc
2021-12-13 07:48:39 -08:00
Samuel Susla b30ff9853c Simplify construction of UIManagerBinding
Summary:
changelog: [internal]

Provide `UIManager` to `UIManagerBinding` in constructor to make the API safer.

Reviewed By: philIip

Differential Revision: D32668892

fbshipit-source-id: a15cd295196a60c3f46997e59c05c4f90503e18d
2021-12-13 06:52:37 -08:00
Andrei Shikov 1d4e7f6d40 Use reference for command args
Summary:
The IDE warning suggests that passing folly::dynamic by value will create a copy on each call.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D32978154

fbshipit-source-id: a47a60c332a9d299eb2110d3537dfab0bc2398b6
2021-12-09 09:47:38 -08:00
Samuel Susla f5f6fd70f2 Introduce TextInput.onKeyPressSync
Summary:
changelog: [internal]

Introduce a way to execute `onKeyPress` synchronously. This feature is experimental and will be changed in the future. It is not decided if marking native events as "sync" is going to be path forward with synchronous access.

NOTE: This is experimental API.

Reviewed By: ShikaSD

Differential Revision: D32882092

fbshipit-source-id: 68c66a9bb7c97758219e085c88a77f3c475c1eb3
2021-12-07 13:42:18 -08:00
Samuel Susla 69acb9569e Remove unused method from TextInputEventEmitter
Summary:
changelog: [internal]

Event `onChangeText` does not exist in TextInput. Let's remove this method to avoid confusion.

Reviewed By: philIip

Differential Revision: D32882056

fbshipit-source-id: 37eb260b84dd7d6cce412ce1bc39c0cbf9cab112
2021-12-07 13:42:18 -08:00
Samuel Susla fcda1ac514 Add support for synchronous completeRoot
Summary:
changelog: [internal]

Exposes a new flag on RuntimeScheduler: `unstable_getIsSynchronous`. Flag indicates if the current code is run synchronously and therefore commit phase should be synchronous.

Unit tests will be added later, to keep this diff short. This code path is not executed yet.

Reviewed By: mdvacca, ShikaSD

Differential Revision: D32677814

fbshipit-source-id: e01d4fff7e716d627ff99fe104965851138c3aef
2021-12-07 12:11:24 -08:00
Andrei Shikov c0710244b3 Clean up AndroidTextInputEventEmitter
Summary:
This class is not used and can be safely deleted

Changelog: [Internal] Delete unused Android event emitter

Reviewed By: mdvacca

Differential Revision: D32916706

fbshipit-source-id: 6dceb6b6ed9d201d96454bf0d646853c5c893d59
2021-12-07 11:09:22 -08:00
Samuel Susla 387e79f8aa Remove background_executor flag
Summary:
changelog: [internal]

Background executor has been shipped on both platforms for a long time.
I've kept the flag around because I wanted to run tests and compare Concurrent Mode vs Background Executor. The intention was to see if we can get rid of Background Executor to simplify the threading model.

Since then, React team has moved away from Concurrent Mode towards more gradual rollout of concurrent rendering and it no longer makes sense to do this comparison. Right now, we don't have a concern with concurrent rendering and Background Executor. If we ever want to run the an experiment, this gating will need to be added again.

Reviewed By: javache

Differential Revision: D32674798

fbshipit-source-id: a1e51c9c5b8e48efa4cb0f25379d58e7eb80ccd9
2021-12-02 15:32:28 -08:00
Samuel Susla 9e2ec4d3dd Make UIManager::animationTick const
Summary:
changelog: [internal]

UIManager::animationTick is thread safe. Let's make it obvious by marking the method const.

Reviewed By: javache

Differential Revision: D32669102

fbshipit-source-id: 49e35d0f0a5c5d1b03baa1cbf9cdece082909e85
2021-12-02 07:54:09 -08:00
Janic Duplessis b2cf24f41c Make hermes-executor-common a static lib (#32683)
Summary:
I've been seeing a couple crashes related to missing hermes-executor-common.so, seems to happen on specific android versions, but can't repro. I investigated this so file more and noticed it is incorrectly linked as a static library here b8f415eb6c/ReactAndroid/src/main/java/com/facebook/hermes/reactexecutor/Android.mk (L20). There doesn't seem to be any reason for this to be a shared lib so I changed it to be compiled as a static lib.

## Changelog

[Android] [Fixed] - Make hermes-executor-common a static lib

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

Test Plan:
- Verify there is no more hermes-executor-common-{release,debug}.so
- Test locally in an app to make sure it build and run properly.
- Verify that the crash happening on play store pre-launch report doesn't happen anymore.

Reviewed By: ShikaSD

Differential Revision: D32754968

Pulled By: cortinico

fbshipit-source-id: cb57e2d81edb4cbdb1f003dab45c53e594a5a62a
2021-12-01 11:19:23 -08:00
Felipe Perez 79d20a1717 Fix fromRawValue(EdgeInsets) from single float case falling through to float array
Summary:
If `value` is of type `float`, it will still fall through to the `react_native_assert` below, exploding. The `map` type is handled correctly.

Changelog: [Internal][Fixed] Fix fromRawValue(EdgeInsets) from single float case falling through to float array and exploding

Reviewed By: javache

Differential Revision: D32648848

fbshipit-source-id: e70cddd291a8f52d6ee3de5fef11b0bb7aee92cd
2021-11-30 10:38:22 -08:00
Andrei Shikov 041398a775 Compile platform Android components into static libraries
Summary:
Removes extra .so files by merging built-in components into libfabricjni.so
These components shouldn't be referenced in outside modules, so merging them is trivial atm.

Changelog:
[Internal][Android] - Compile native components into static libraries

Reviewed By: cortinico

Differential Revision: D32677572

fbshipit-source-id: fc1a6c5a2832ee49e438c30856562f85677514ea
2021-11-30 08:31:44 -08:00
Andrei Shikov 7eb1ff5048 Rename reactconfig module to react_config to align naming
Summary:
title

Changelog:
[Internal][Android] - Rename reactconfig c++ module

Reviewed By: cortinico

Differential Revision: D32677571

fbshipit-source-id: 41b4313a1f7c75da7204cf829ae3d0d700151eba
2021-11-30 08:03:27 -08:00
Samuel Susla a9815286c2 Remove redundant parameter from ShadowTreeRegistry::enumerate
Summary:
Changelog: [internal]

Nothing was using `stop` parameter, let's get rid of it.

Reviewed By: philIip

Differential Revision: D32669018

fbshipit-source-id: dc2d52048a2f7dd3785dd959270087001c778962
2021-11-30 04:32:02 -08:00
Nicola Corti b8f415eb6c Update LOCAL_SHARED_LIBRARIES to be a multiline string
Summary:
We have `LOCAL_SHARED_LIBRARIES` that are getting longer and are
making reviewing them on Diffs quite hard.
Having all the list of the dependency on a single line is suboptimal
and it makes hard to find duplicated entries.
I've updated the longest `LOCAL_SHARED_LIBRARIES` to be multilines and
I've sorted the entries here.

Changelog:
[Internal] [Changed] - LOCAL_SHARED_LIBRARIES

Reviewed By: ShikaSD

Differential Revision: D32695127

fbshipit-source-id: f5b381c501ddff083ef9f4baaca6c4c8c9523368
2021-11-29 13:01:51 -08:00
Nawbc 0872e220cf fix: Link incompatible target in debug mode (#32595) (#32648)
Summary:
Build from source crash in debug mode on other linux distributions except ubuntu

Changelog:  Link incompatible target in debug mode (https://github.com/facebook/react-native/issues/32595)

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

Reviewed By: ShikaSD

Differential Revision: D32642360

Pulled By: cortinico

fbshipit-source-id: 6b35c560aca3d2e8d30b24a3b800ebfd9b35bda2
2021-11-25 00:27:27 -08:00
Nicola Corti a5469f9d7f Update libruntimeexector to be a shared lib rather than a static lib
Summary:
AGP 7.x is changing the path where we can find
the precompiled static libraries. Therefore is getting complicated
to share prebuilt `.a` files. I'm updating `libruntimeexecutor` to be
a shared library instead so this will solve this issue for now.

Changelog:
[Internal] [Changed] - Update libruntimeexector to be a shared lib rather than a static lib

Reviewed By: ShikaSD

Differential Revision: D32646112

fbshipit-source-id: ce42e930076c1d3b5f54f3d8adcca1c38909d0fb
2021-11-24 10:58:54 -08:00
Samuel Susla c10dc49368 Fix typo in TextInputEventEmitter::onScroll
Summary:
changelog: [internal]

Fix JS Exception "unsupported top level event type".

Reviewed By: ShikaSD

Differential Revision: D32649068

fbshipit-source-id: bc65722ff1d4f6237074ca246906fcb6604411d3
2021-11-24 10:07:05 -08:00