Commit Graph

950 Commits

Author SHA1 Message Date
Andrew Coates 138c88c7da Fix warnings around mixing int and size_t usage in unsafe ways (#34889)
Summary:
react-native-windows builds treat a lot of c++ compiler warnings as errors.  Including ones that cause value truncation when assigning `size_t` values to an `int`.

This fixes the compiler warning, by using `size_t` as the type for `i`, which matches `size`.  I then modified the loop to avoid the value underflow that occurs when decrementing an unsigned zero value.

## Changelog
[Internal] [Changed] - Fix compiler warnings around mixing int and size_t usage in unsafe ways

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

Test Plan: This code change was made in react-native-windows when integrating latest react-native changes.  -- our fabric implementation was able to run through this code without any issues.

Reviewed By: mdvacca

Differential Revision: D40158306

Pulled By: rozele

fbshipit-source-id: b6858cb953635b37fd63a88ed1a372eb3dc394f7
2022-10-06 16:25:44 -07:00
Samuel Susla 0857238633 Pass didUserCallbackTimeout argument to Scheduler's callback
Summary:
changelog: [internal]

RuntimeScheduler's callbacks previously did not pass down argument `didUserCallbackTimeout`. This was intentionally left out because React team intended to remove it. But, as it turns out, it was not removed and it is needed for Offscreen to not enter infinite render loop. In React, it is used here: https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberWorkLoop.new.js#L1022-L1028

Reviewed By: ryancat

Differential Revision: D40060377

fbshipit-source-id: c45719fbbd0275ab2bcf9a2bbf0191aaa96010cc
2022-10-05 10:35:33 -07:00
Ruslan Shestopalyuk aa5d43fe54 Merge enablePropIteratorSetter flags into a single one in CoreFeatures (#34869)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34869

Changelog: [Internal]

This merges all instances of `enablePropIteratorSetter` into a single one.

Both `AccesibilityProps` and `BaseTextProps` had their own instances if it, which is now redundant.

Reviewed By: cipolleschi

Differential Revision: D40062555

fbshipit-source-id: b6ccf5a9538612dd731a6f9c4eaceeebcb6d95be
2022-10-05 05:09:37 -07:00
Ruslan Shestopalyuk 9864586b21 Factor out feature flags for RN Fabric core
Summary:
A follow up to D38708718 (https://github.com/facebook/react-native/commit/403fea25f65a38f4b4d8e0edcf89741b29e62059) review, this factors feature flags for Fabric core code into a separate file, `CoreFeatures`.

Keeping them together is arguably better for maintenance and makes code easier to reason about.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D40007784

fbshipit-source-id: 1885d5d6200575c6015f063d8b05813b18b47ffb
2022-10-03 05:38:31 -07:00
Ruslan Shestopalyuk 110b191b14 Refactor ViewPropsMapBuffer -> general MapBuffer props mechanism
Summary:
Previously, ViewPropsMapBuffer conversions were hardcoded deep in Android infrastructrue. I've generalized this into a different mechanism to allow any Props struct to support MapBuffer props.

There are still some things that need to be cleaned up and this should be treated as experimental. One thing we likely want to do is remove the hardcoded IDs (fine for codegen'd code; less so for handwritten) and use compile-time-hashed IDs instead with human-readable string names.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D38708719

fbshipit-source-id: 64603dee7f21828be31346c555d99862dab304ea
2022-10-03 04:11:02 -07:00
Ruslan Shestopalyuk 2319f75c8e Support iterator-style prop parsing in ImageProps
Summary:
Support iterator-style prop parsing in ImageProps

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D38834100

fbshipit-source-id: 69274595cca8e6f40cd5e0ad9aac1582f57acc61
2022-10-02 03:38:07 -07:00
Ruslan Shestopalyuk 4766755420 Support iterator-style prop parsing in ParagraphProps
Summary:
Support iterator-style prop parsing in ParagraphProps

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D38833627

fbshipit-source-id: 31eac4e86c5855bb47f634da7cffaf2418273a36
2022-10-02 03:38:07 -07:00
Ruslan Shestopalyuk 7de2b6b415 Support iterator-style PropParsing for AndroidTextInput
Summary:
Support iterator-style PropParsing for AndroidTextInput

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D38833510

fbshipit-source-id: 4f424579a41e70fbe8c0eba430bd435dc60bfc04
2022-10-02 03:38:07 -07:00
Ruslan Shestopalyuk 403fea25f6 Refactor MapBuffer experimental setup: use one config for all Props, with a Trait to indicate support
Summary:
Instead of having a special flag just for View MapBuffer props, we now use one flag to indicate that MapBuffer should be used for all props; each XShadowNode must set a special trait indicating if that ShadowNode supports MapBuffer props.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D38708718

fbshipit-source-id: b398ec62a0db9c0ff23c0007c5503cf2838c4173
2022-10-02 02:46:25 -07:00
Nicola Corti 427ce5f2d2 Expose folly flags and make folly_runtime available to be consumed via prefab
Summary:
This removes the old way of consuming `libfolly_runtime.so` from
`Android-prebuilt.cmake` to using Prefab which is natively supported
by the Android pipeline.

Moreover, I've exposed a `folly-flags.cmake` file which can be used by libraries
to know which lists of flags they need to use for Folly.

Changelog:
[Internal] [Changed] - Move `folly_runtime` to be consumed via prefab

Reviewed By: cipolleschi

Differential Revision: D39928571

fbshipit-source-id: 4864c37813ec681a6a464c97de6dfc078f5553f1
2022-09-29 07:44:56 -07:00
Paige Sun 9a253d1864 Back out "Back out "[Venice][iOS] Fix: Install Fabric UIManager before main bundle execution""
Summary:
Changelog: [Internal][Bridgeless][iOS]

# Before diff
Be in Venice > run Metro > run FBiOS > navigate to any RN surface.

 `UIManagerBinding createAndInstallIfNeeded` happens After `ReactInstance loadScript -> evaluateJavaScript`: install Fabric UIManager before main bundle execution

Reviewed By: RSNara

Differential Revision: D39760231

fbshipit-source-id: f17bf02e9b1fb0f9b0ff24c86aa6dc9349c42192
2022-09-23 17:32:49 -07:00
Rubén Norte 30fe6b341b Restore flags to disable Fabric background executor
Summary:
We want to fix the order of execution of layout, layout effects and passive effects in React Native, but the use of the Fabric background executor for layout complicates this (and other things).

This brings back a flag to disable this background thread to do layout synchronously in JavaScript, before the execution of layout effects and passive effects.

This is expected to regress performance on some screens, so we need to address the antipatterns in those screens before shipping this.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D39727131

fbshipit-source-id: 4323b089234d3304ca3bfe5697668fb44ac64c12
2022-09-23 05:51:36 -07:00
Samuel Susla 15dbd9121d Back out "Fix: Install Fabric UIManager before main bundle execution"
Summary:
Original commit changeset: 4491d6de1109

Original Phabricator Diff: D39493654 (https://github.com/facebook/react-native/commit/447be629091579b8656e1b10e365f3429a61bbf3)

changelog: [internal]

Reviewed By: javache

Differential Revision: D39727129

fbshipit-source-id: 412a7fc5e4bf8db26cde7d420e71cf1f314cdc93
2022-09-22 06:36:59 -07:00
Paige Sun 447be62909 Fix: Install Fabric UIManager before main bundle execution
Summary:
Changelog: [Internal] Fix install Fabric UIManager before main bundle execution in Bridgeless

In iOS, fixed Bridgeless so that [UIManagerBinding::createAndInstallIfNeeded](https://github.com/facebook/react-native/blob/ce50c43986bae05ad62552be46f4d5bb4a46f097/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp#L24-L41) happens BEFORE the JS main bundle is evaluated.

Logic is unchanged in Android.

# Before
```
> UI [FBReactModule.mm:325] Initializing FBReactModule: start.
> UI [FBReactModule.mm:524] Initializing FBReactModule: end.
> UI [FBReactModule.mm:1839] Initializing RCTHost: start.
> UI [FBReactModule.mm:1891] Initializing RCTHost: end.
> UI[-[FBNavigationControllerObserver navigationController:willShowViewController:animated:]] <FBNewNavigationController: 0x7fd0e7859400> will show <FBReactRootViewController: 0x7fd0e7161a00; react_GemstoneHomeRoute> (animated: 1)
>   VJCPP ****** ReactInstance loadScript ->  evaluateJavaScript start      <--- loads Main Bundle
> UI[-[FBNavigationControllerObserver navigationController:didShowViewController:animated:]] <FBNewNavigationController: 0x7fd0e7859400> did show <FBReactRootViewController: 0x7fd0e7161a00; react_GemstoneHomeRoute> (animated: 1)
>   VJCPP ****** ReactInstance loadScript ->  evaluateJavaScript end
>   VJCPP ****** UIManagerBinding createAndInstallIfNeeded      <--- should happen BEFORE evaluateJavaScript

```

Reviewed By: RSNara

Differential Revision: D39493654

fbshipit-source-id: 4491d6de110966b2eb4f554ff4db8548899020e3
2022-09-14 14:51:27 -07:00
Paige Sun e2028a8cb8 Remove unused RuntimeExecutor from UIManagerBinding constructor
Summary:
Changelog: [Internal] Remove unused RuntimeExecutor from UIManagerBinding constructor

Since [UIManager is the class that has a reference to RuntimeExecutor](https://github.com/facebook/react-native/blob/ce50c43986bae05ad62552be46f4d5bb4a46f097/ReactCommon/react/renderer/uimanager/UIManager.h#L35-L36), there's no reason for `UIManagerBinding` to own a reference to RuntimeExecutor too.

The purpose of `UIManagerBinding` is to bind the Fabric `std::shared_ptr<UIManager>` in C++ to `global.nativeFabricUIManager` in JS.

Doing this cleanup to make the next diff easier.

Reviewed By: sammy-SC

Differential Revision: D39490927

fbshipit-source-id: 4c393dccc6985bef44e3b0afc32b9f79bea25f80
2022-09-14 14:51:27 -07:00
Paige Sun 4e70376dc7 Modularlize RCTBridgeModule.h 3/n - Move RCTTurboModuleRegistry.h to its own file in ReactInternal target (#34514)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34514

Changelog: [Internal][iOS] Modularlize RCTBridgeModule.h 3/n -  Move RCTTurboModuleRegistry.h to its own file in ReactInternal target

# Why clean up RCTBridgeModule.h?
Clean up one unnecessary import of RCTBridgeModule.h.

RCTBridgeModule includes a lot of header files, and this header is imported everywhere. The ultimate goal is that files (especially React Native infra files) should only import only what they need and not import the entirety of RCTBridgeModule.h whenever possible.

This way, certain headers that are Bridge-only can be compiled out of the new architecture with a flag.

Reviewed By: RSNara

Differential Revision: D38971168

fbshipit-source-id: 3b1b23d422f965a5a14bc4178d32b844906f2c8b
2022-09-09 15:10:14 -07:00
Paige Sun 5745c1df26 Modularlize RCTConstants.h - Move Bridge-only constants into a separate file
Summary:
Changelog: [Internal] Move Bridge-only constants into a separate file

- Move Bridge only constants from RCTBridge.h into  RCTBridgeConstants.h.
- Move shared constants from RCTBridge.h into RCTConstants.h.

This way, new architecture does not need to import RCTBridge.h just for the constants.

Reviewed By: sammy-SC

Differential Revision: D39085713

fbshipit-source-id: 40177cbed72a326b40ec448c98751d1dd3464504
2022-09-08 19:56:22 -07:00
Samuel Susla ce50c43986 Add more clang tidy rules
Summary:
changelog: [internal]

Add more clang tidy rules to prevent common class of bugs.

Reviewed By: javache

Differential Revision: D39245194

fbshipit-source-id: 5521c5c4653d7005b96ebba494e810ba5075afbc
2022-09-06 07:01:17 -07:00
Mitch Powell 1d3e5130f4 Back out "Mirror fbcode directory structure for container targets"
Summary:
build-break
overriding_review_checks_triggers_an_audit_and_retroactive_review

fbshipit-source-id: bd4b12f340a33160d84293c1b3d454360ec6b511
2022-08-30 21:42:26 -07:00
Mitch Powell 10ea6fb9a3 Mirror fbcode directory structure for container targets
Summary:
Mirrors the fbcode directory structure for the folly container subdirectory

skip-frl-buck-targeting

Reviewed By: mzlee

Differential Revision: D38632215

fbshipit-source-id: 93cf4ae018417803a84b3edc750feb4cf24e17a7
2022-08-30 10:04:49 -07:00
Pieter De Baets 202b17a149 Add key to prop conversion errors
Summary:
Improve errors thrown when prop conversion fails by adding the property being converted. Removes the specialization of convertRawProp for std::optional since we can handle that in a fromRawValue specialization instead.

To make this work, we need to remove noexcept from a number of calls. This noexcept behaviour was making these exceptions effectively uncatcheable. The original motivation of D23787492 (https://github.com/facebook/react-native/commit/57dd48b2464ac04b860f2f69cb4f131990fe4dbd) is correct, as we cannot reliably pass on exceptions to JS and assume that the state will be recoverable, so instead we log an error and carry on with the default value available. We should improve how the error gets reported to the user, as it will currently be hidden in logcat.

Changelog: [Internal]

Differential Revision: D39052812

fbshipit-source-id: 9692633930555e64a3769116fc484a19e534aa3f
2022-08-30 08:48:26 -07:00
Shawn Shihang Wei 04ee52b867 Revert D38938632: Add key to prop conversion errors
Differential Revision:
D38938632 (https://github.com/facebook/react-native/commit/7909b913ef98b66c6c09b3cbe69e2c2f85658e02)

Original commit changeset: 1dc9a544ca67

Original Phabricator Diff: D38938632 (https://github.com/facebook/react-native/commit/7909b913ef98b66c6c09b3cbe69e2c2f85658e02)

fbshipit-source-id: ddfe699ebf2ec7b118079d9ecb9ce77f2bf4a2ac
2022-08-25 15:18:01 -07:00
Pieter De Baets 7909b913ef Add key to prop conversion errors
Summary:
Improve errors thrown when prop conversion fails by adding the property being converted. Removes the specialization of convertRawProp for std::optional since we can handle that in a fromRawValue specialization instead.

To make this work, we need to remove noexcept from a number of calls. This noexcept behaviour was making these exceptions effectively uncatcheable. The original motivation of D23787492 (https://github.com/facebook/react-native/commit/57dd48b2464ac04b860f2f69cb4f131990fe4dbd) is correct, as we cannot reliably pass on exceptions to JS and assume that the state will be recoverable, so instead we log an error and carry on with the default value available. We should improve how the error gets reported to the user, as it will currently be hidden in logcat.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D38938632

fbshipit-source-id: 1dc9a544ca679463a8aad5cc632bd918f42b15d1
2022-08-25 08:15:06 -07:00
Pieter De Baets dd48509185 Unbreak LAYOUT_ANIMATION_VERBOSE_LOGGING
Summary:
Noticed this logging was broken when enabling the flag.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D38616851

fbshipit-source-id: acf0ab75918b389586cb713c2edf5a6bf83ee7a2
2022-08-24 05:09:12 -07:00
Lulu Wu c4ddaa8fdb Reland D38460202 and fix tests
Summary: Reland D38460202 (https://github.com/facebook/react-native/commit/e874e5facb60ff7057c0c95ca53948540ddb7137) and fix test errors.

Reviewed By: RSNara

Differential Revision: D38846070

fbshipit-source-id: 05a889aabe7e25225ff7464f69900c459c82dd47
2022-08-23 12:14:07 -07:00
Ravi Shah f5f6896e61 Revert D37055069: Add key to prop conversion errors
Differential Revision:
D37055069 (https://github.com/facebook/react-native/commit/80d626a66a1aba483e292ef21a96cb28b7e6c1c6)

Original commit changeset: 8ce121a9b187

Original Phabricator Diff: D37055069 (https://github.com/facebook/react-native/commit/80d626a66a1aba483e292ef21a96cb28b7e6c1c6)

fbshipit-source-id: b364e29f6c2d75c19392f705910d753a328e798d
2022-08-22 15:58:37 -07:00
Pieter De Baets 80d626a66a Add key to prop conversion errors
Summary:
Improve errors thrown when prop conversion fails by adding the property being converted. Removes the specialization of `convertRawProp` for `std::optional` since we can handle that in a `fromRawValue` specialization instead.

To make this work, we need to remove `noexcept` from a number of calls. This noexcept behaviour was making these exceptions effectively uncatcheable. The original motivation of D23787492 (https://github.com/facebook/react-native/commit/57dd48b2464ac04b860f2f69cb4f131990fe4dbd) is correct, as we cannot reliably pass on exceptions to JS and assume that the state will be recoverable, so instead we log an error and carry on with the default value available. We should improve how the error gets reported to the user, as it will currently be hidden in logcat.

Changelog: [Internal]

Reviewed By: JoshuaGross

Differential Revision: D37055069

fbshipit-source-id: 8ce121a9b187f068d3ab790c6fae66d53e6338d2
2022-08-22 09:57:10 -07:00
Huyue Gu 9e4114abe1 Revert D38460202: Replace Folly with MapBuffer for passing js error data
Differential Revision:
D38460202 (https://github.com/facebook/react-native/commit/e874e5facb60ff7057c0c95ca53948540ddb7137)

Original commit changeset: e13a47722964

Original Phabricator Diff: D38460202 (https://github.com/facebook/react-native/commit/e874e5facb60ff7057c0c95ca53948540ddb7137)

fbshipit-source-id: fd83562dc1ad76914d49ebd9a195095c55a8b38b
2022-08-18 13:39:09 -07:00
Lulu Wu e874e5facb Replace Folly with MapBuffer for passing js error data
Summary:
As title, replace json serialization/deserialization and folly with MapBuffer for js error handling in Android.

Changelog:
[Android][Changed] Replace Folly with MapBuffer for passing js error data

(Note: this ignores all push blocking failures!)

Reviewed By: RSNara

Differential Revision: D38460202

fbshipit-source-id: e13a47722964baa9e0a16bb138456a19350f809e
2022-08-18 13:03:30 -07:00
Samuel Susla 1bd27609b3 Delete feature flag enable_call_immediates_android
Summary:
changelog: [internal]

This is shipped, let's remove gating

Reviewed By: philIip

Differential Revision: D38745414

fbshipit-source-id: 21381a89b01040f2209aeb458cef2637d21e981d
2022-08-17 04:14:26 -07:00
Joshua Gross 543e11e5fd Fix PropSetter parsing of borderRadius
Summary:
Currently the PropSetter parser parses all border{TopLeft,TopRight,...}Radius props except for `borderRadius`.

This is the fix.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D38678226

fbshipit-source-id: 8c5d67a652c2b327aa50a997e8e886630fe139c0
2022-08-16 12:21:52 -07:00
Joshua Gross 04c75ba988 Support MapBuffer in TextInput State
Summary:
Support MapBuffer in TextInput State.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D38546271

fbshipit-source-id: 93e7fd79d9d8473dd646410f3047fcfafa8516f1
2022-08-16 12:21:52 -07:00
Nicola Corti 3d2185203b Do not store .cpp/.h files inside src/main/java - mapbuffer
Summary:
Currently we expose native code (.h, .cpp) inside the src/main/java folder.

This is making impossible for users on New Architecture to open the project
inside Android Studio.

The problem is that the src/main/java is reserved to Java/Kotlin sources only.
AGP 7.2 also removed support for mixed source roots:
https://developer.android.com/studio/releases/gradle-plugin#duplicate-content-roots

This is essentially forcing users to write Java code without any autocompletion
as all the React Native Java classes are considered C++ files.

I'm addressing this issue folder by folder by moving them
from ReactAndroid/src/main/java/com/facebook/... to ReactAndroid/src/main/jni/react/...

This is the diff for mapbuffer

Changelog:
[Internal] [Changed] - Do not store .cpp/.h files inside src/main/java - mapbuffer

Reviewed By: cipolleschi

Differential Revision: D38699253

fbshipit-source-id: c1c8f8693b6da4e3428f8f280e1ca4d5c5d0f853
2022-08-16 03:20:16 -07:00
Luna Wei dfcd9faaad Add support for pointerover and pointerout
Summary: Changelog: [Internal] - Add pointerover, pointerout events

Reviewed By: vincentriemer

Differential Revision: D38559454

fbshipit-source-id: 829b9f2f22e1e41a64dcce80fcc79ab9e6352dcf
2022-08-15 12:51:58 -07:00
Vincent Riemer 92e4ed6a28 Add iOS implementation of the button property of the PointerEvent object
Summary:
Changelog: [iOS][Internal] - Add iOS implementation of the button property of the PointerEvent object

This implements the `button` property on the PointerEvent object by storing the button which caused the down event in the `ActiveTouch` and reporting that button through `pointerdown` and `pointerup` events and -1 on all others. This diff also includes a small fix to the `pressure` property which was introduced due to `button` being correctly implemented.

Reviewed By: yungsters

Differential Revision: D38632543

fbshipit-source-id: 9dbbb23a9251f2e661faf37fdf206b9f0b26bc5f
2022-08-15 12:00:15 -07:00
Nick Gerleman 06b55a3d04 Enable -Wpedantic in OSS Android Targets (#34403)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34403

This change mirrors D38457812 (https://github.com/facebook/react-native/commit/063c2b4668b279ccbca639f98f7a0a5c4d7c5690) which added -Wpedantic to ReactCommon targets, but for the Android build used by OSS. This should ensure contributors see the same warnings locally as the internal build would produce.

Changelog:
[Android][Changed] - Enable -Wpedantic in OSS Android Targets

Reviewed By: cortinico

Differential Revision: D38632454

fbshipit-source-id: 19a036ee3f902eb9d47c568aef448af9d8562358
2022-08-13 00:12:42 -07:00
Oleksandr Melnykov 23429330a6 Back out "Roll out turbo_module_binding_mode experiment"
Summary: Changelog: [Internal]

Reviewed By: jpporto

Differential Revision: D38666524

fbshipit-source-id: af5b1cf2d2db505341ce0992401cb68909e1395b
2022-08-12 12:41:08 -07:00
Lulu Wu fc065151ce Add ability to store and retrieve a list of MapBuffer
Summary:
Add ability to store and retrieve a list of MapBuffer as an entry of MapBuffer.

```
Example:

MapBuffer1
{
 key1: "test string",
 key2: MapBuffer2,
 key3: [MapBuffer3, MapBuffer4]
}
```

Changelog:
[General][Added] Add ability to store and retrieve a list of MapBuffer

Reviewed By: JoshuaGross

Differential Revision: D38460204

fbshipit-source-id: 3e721418be2dca6d5f15f665753844d6f531e31c
2022-08-11 10:14:38 -07:00
Pieter De Baets 450fa4d1d3 Remove molly dep from react-native buck graph
Summary:
Folly's molly target combines a number of targets that are supposed to be useable on mobile. Since we're trying to move away from folly, we should instead list explicitly which parts of folly we're using so we can remove them over time, and track which targets no longer have any folly dependencies.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D38352060

fbshipit-source-id: 09d0d84793692f97f4d49390c99c38b23441df54
2022-08-11 04:53:34 -07:00
Nick Gerleman 063c2b4668 Enable -Wpedantic for targets inside ReactCommon
Summary:
React Native is compiled downstream with MSVC, meaning the introduction of code depending on language extensions specific to gcc/clang may cause breakage.

We can enable `-Wpedantic` to flag any behavior not officially supported by the specified C++ standard. This will includes rules beyond what MSVC has trouble with, but seems to not have too many "noisy warnings".

This change enables -Wpedantic in BUCK targets within ReactCommon.

This makes the OSS C++ build for Android/iOS slightly more permissive than the internal build, A followup is to add the changes to OSS build logic as well, to avoid contributors seeing more errors upon internal submission. (checking with cortinico on how to do this for Android).

react-native-windows uses a higher warning level than `-Wall`, which is an additional cause of compilation failures, but is not addressed as part of this change.

Changelog:
[Internal][Changed] - Enable -Wpedantic for targets inside ReactCommon

Reviewed By: rshest

Differential Revision: D38457812

fbshipit-source-id: 014da1ac0b7ad8f78154e6e447ed58def6bd0d47
2022-08-11 04:37:35 -07:00
Pieter De Baets 1a8ce7a26a Roll out turbo_module_binding_mode experiment
Summary:
We ran an experiment to test different implementations of TurboModules HostObjects, as the current one has various inefficiencies, such as re-creating HostFunctions on every property access. The strategy we found to be most efficient and flexible longer-term is to represent the TurboModule with a plain JavaScript object and use a HostObject as its prototype. Whenever a property is accessed through the prototype, we cache the property value on the plain object, so it can be efficiently resolved by the VM for future accesses.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D38355134

fbshipit-source-id: 59253091412d0c6827ad7a4b1ac7dc0c7fe89cc2
2022-08-10 04:54:25 -07:00
Nikita Lutsenko 610bb7f688 rn | Improve bridging, allowing implicit conversion of jsi types wrapped in SyncCallback/AsyncCallback/AsyncPromise.
Summary:
`toJs()` resolution trips up on converting the plain old jsi values.
In order to help it - remove the automatic inference of template types, since we already know that `T` in this case is going to be the concrete jsi type.
This allows using implicit conversions on Sync/Async Callback types, as well as AsyncPromise.

Without it - AsyncPromise/Callback trip up on trying to convert Convertor<T> to jsi type.

Changelog:
[General][Added] SyncCallback/AsyncCallback/AsyncPromise bridging types in C++ now allow wrapping JSI types.

Reviewed By: JoshuaGross

Differential Revision: D38529799

fbshipit-source-id: 860de2d771899f331bf1a4ff0dade4eccc875618
2022-08-09 16:41:34 -07:00
Sparsha Saha 54a4fcbfdc Removing reactnativeutilsjni as it is built from the same sources as reactnativejni (#34339)
Summary:
This Pull Request aims at removing the making of reactnativeutilsjni as it is built from the same sources as reactnativejni. It also replaces references to reactnativeutilsjni with reactnativejni.

This should get rid of `reactnativeutilsjni.so` while reusing `reactnativejni.so` in it's place. This should give us some size improvements in the finally built apk.
## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Android] [Changed] - Replaced reactnativeutilsjni with reactnativejni in the build process to reduce size

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

Test Plan:
1. Ran the CMakelist.txt file using CMake and I could see that reactnativeutilsjni.dir is no longer generated with my changes.
2. Built the aar from this branch in Android Studio and build happened successfully.

I am not sure if we could run any more tests. Please let me know in case anymore testing is required and I can do accordingly

Reviewed By: cortinico

Differential Revision: D38400481

Pulled By: genkikondo

fbshipit-source-id: 592736e56441328389ae89135667c336ff8018e6
2022-08-04 03:11:56 -07:00
Ruslan Shestopalyuk a142a78473 Fix regression when setting shadow node properties in D38272966 (github PR merge)
Summary:
Changelog:

[Android][Fixed] - Fix regression when setting shadow node properties.

Also simplified the corresponding macros to avoid using lambdas altogether, as they are not required.

Note that this **does not** modify any constexpr-related semantics of the existing code, as the main constexpr macro, `CONSTEXPR_RAW_PROPS_KEY_HASH` evaluation result is still contstexpr value, and the other ones already involved non-const parts (see my comments).

Reviewed By: NickGerleman

Differential Revision: D38356411

fbshipit-source-id: 22c330d3425c8aed36693f4652f1b257d2dc96be
2022-08-02 15:14:16 -07:00
Dark Knight 18b6e53c0b Revert D38280674: Multisect successfully blamed D38280674 for test or build failures
Summary:
This diff is reverting D38280674 (https://github.com/facebook/react-native/commit/a561df0e96da334a44e4e8b798c1be9e19fa1bc2)
D38280674 (https://github.com/facebook/react-native/commit/a561df0e96da334a44e4e8b798c1be9e19fa1bc2) has been identified to be causing the following test or build failures:
Tests affected:
- https://www.internalfb.com/intern/test/562950020230233/

Here's the Multisect link:
https://www.internalfb.com/intern/testinfra/multisect/1102425
Here are the tasks that are relevant to this breakage:
T93118125: [7 CRITICAL TEST FAILURES] 12 tests started failing for oncall marketplace_feed_experience in the last 2 weeks
We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.

 ---

Changelog:
[General][Changed] - Reverting "[react-native] Exit early if currentShadowNode cannot be casted" due to test failures

Differential Revision: D38338773

fbshipit-source-id: 0e0c11b1f5e27d98fdcfab34847a2fd0750ff5af
2022-08-02 00:11:58 -07:00
Chiara Mooney fc26dbfce0 Fix Macro Errors for Windows (#34299)
Summary:
Fix macro errors for Windows. Current syntax breaks the build of the React Common project on Windows because the ({...}) syntax is not supported; must be replaced with lambda expressions.

Resolves https://github.com/facebook/react-native/issues/34090

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Fixed] - Fix macro errors for Windows.

lyahdav JoshuaGross

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

Test Plan: Build on react-native-windows repo. Tested in RNW app.

Reviewed By: javache

Differential Revision: D38272966

Pulled By: NickGerleman

fbshipit-source-id: e76eac11cde173ef49465d01d793c593017f2ab7
2022-08-01 20:54:59 -07:00
David Vacca a561df0e96 Exit early if currentShadowNode cannot be casted
Summary:
This diff fixes the bug T127619309 by exit early during calculateTransformedFrames if currentShadowNode cannot be casted

This is a bug that fired in fb4a but we didn't have a way to reproduce locally.
We are going to release this and enable feature flag with a MC

changelog: [internal] internal

Reviewed By: sammy-SC

Differential Revision: D38280674

fbshipit-source-id: 1c42c17678d8473564e4075a78d3c688efed1a23
2022-08-01 13:57:36 -07:00
David Vacca 1e4ebf2531 Disable calculation of TransformedFrames in Layoutable ShadowNodex
Summary:
Calculation of TransformedFrames was a method introduced by D37994809 (https://github.com/facebook/react-native/commit/64528e5faa445907b8287b412c344f30c20fca61) to fix rendering of inverted flat lists.

We found that this operation is crashing in fb4a causing the UBN T127619309

This diff creates a feature flag to disable the calculation of TransformedFrames in Layoutable ShadowNodes. **The goal of this diff is to revert the behavior introduced by D37994809 (https://github.com/facebook/react-native/commit/64528e5faa445907b8287b412c344f30c20fca61)**

The featureFlag is disabled in fb4a and enabled in react AR (because ReactAr apps relies on the calculation of TransformedFrames and these apps are not affected)

The root cause of the bug will be fixed by D38280674 (which still requires more testing and investigation)

changelog: [internal] internal

Reviewed By: JoshuaGross

Differential Revision: D38286857

fbshipit-source-id: 721cd0554ae6a6b369b3f8dbb584160a270d0f18
2022-07-29 17:32:35 -07:00
Graham Mendick e24ce708ab Migrate needsCustomLayoutForChildren check to the new architecture (#34254)
Summary:
Fixes https://github.com/facebook/react-native/issues/34120

The new React Native architecture doesn't check `needsCustomLayoutForChildren` so it wrongly positions native views on Android. In https://github.com/facebook/react-native/issues/34120 there are videos comparing the positioning of a native action view in the old and the new architecture.

This PR passes the parent tag to the `updateLayout` method of the `SurfaceMountingManager`. The `SurfaceMountingManager` calls `needsCustomLayoutForChildren` on the parent view manager (copied the code from the `NativeViewHierarchyManager` in the old architecture).

**NOTE** - I wasn't sure where to get the parent shadow view from so I've put in my best guesses where I could and left it as `{}` otherwise.

## Changelog

[Android] [Fixed] - Migrate `needsCustomLayoutForChildren` check to the new architecture

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

Test Plan:
I checked the fix in the repro from https://github.com/facebook/react-native/issues/34165. Here is a video of the action view closing using the native button that is now visible in the new architecture.

https://user-images.githubusercontent.com/1761227/180607896-35bf477f-4552-4b8a-8e09-9e8c49122c0c.mov

Reviewed By: cipolleschi

Differential Revision: D38153924

Pulled By: javache

fbshipit-source-id: e2c77fa70d725a33ce73fe4a615f6d884312580c
2022-07-28 09:57:36 -07:00
Vincent Riemer 546c4b4c6c Add isPrimary property implementation to the PointerEvent object
Summary:
Changelog: [iOS][Internal] - Add isPrimary property implementation to the PointerEvent object

This diff adds the `isPrimary` property to the PointerEvent object iOS implementation. In addition this adds a related change where we "reserve" the 0 touch identifier for mouse events and the 1 identifier for apple pencil events. This is an easy way to ensure that these pointers are always consistent no matter what happens. Since mouse & pencil pointers should always be considered the primary pointer, that allows us to focus the more advanced primary pointer differentiation purely on touch events.

The logic for this touch event primary pointer differentiation is essentially setting the first touch it recieves as a primary pointer, setting it on touch registration, and sets all subsequent touchs (while the first touch is down) as not the primary pointers. When that primary pointer is lifted, the class property keeping track of the primary pointer is reset and then the **next** pointer (secondary pointers which had already started before the previous primary pointer was lifted are not "upgraded" to primary) is marked as primary. A new platform test is also included in this diff in order to verify the aforementioned behavior.

Reviewed By: lunaleaps

Differential Revision: D37961707

fbshipit-source-id: ae8b78c5bfea6902fb73094fca1552e4e648ea44
2022-07-26 11:41:48 -07:00