Commit Graph

38536 Commits

Author SHA1 Message Date
Nick Gerleman b6dfec38e0 C++ style enums 9/N: FlexDirection (#39484)
Summary:
X-link: https://github.com/facebook/yoga/pull/1394

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

Moves internal usages of YGDirection to Direction.

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49336066

fbshipit-source-id: b49e1ffcd79a427e36ea8d2c26debaa98ef3e4c9
2023-09-19 16:30:02 -07:00
Nick Gerleman e9b5f0fabb C++ style enums 8/N: Direction (#39483)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39483

X-link: https://github.com/facebook/yoga/pull/1392

Moves internal usages of YGDirection to Direction.

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49335231

fbshipit-source-id: 459fe820c91be88734cebaa8655cd3f0afda83bf
2023-09-19 16:30:02 -07:00
Riccardo Cipolleschi 95fb44848a Make the codegen test package private (#39543)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39543

As per title, this is a test package that should not be public, nor published.

## Changelog:
[Internal] - Make the react-native-codegen-test package private

Reviewed By: cortinico

Differential Revision: D49418378

fbshipit-source-id: 2bea9a42c647b2aed97a1b27a74a9d611b254f1f
2023-09-19 10:54:56 -07:00
Ruslan Shestopalyuk d4c2d9dc97 Avoid potential racing condition when looking up mark names in PerformanceObserver (#39535)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39535

## Changelog:
[Internal] -

When looking up a mark by name (to be used by a measure for timing), there was a potential racing condition, which would cause issues if there is another thread e.g. logging a mark at the same time.

This fixes it.

Reviewed By: dmytrorykun

Differential Revision: D49416336

fbshipit-source-id: 28e20956f9aeafd79eb07130ea9dcd269086ea63
2023-09-19 09:10:40 -07:00
Rubén Norte 8fe2da5391 Add Systrace instrumentation to RuntimeScheduler (#37880)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37880

This adds systrace sections for the most relevant parts of `RuntimeScheduler`. This helps us identify how things are scheduled, which in this case makes it obvious we're not dispatching events the most efficient way (as top-level callbacks in the runtime executor instead of as tasks in the scheduler).

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D46556399

fbshipit-source-id: 93a13a2c5ec18a34712546889de21792671d5d2c
2023-09-19 09:03:33 -07:00
Rubén Norte b38a9dedd3 Extract task execution to a separate method in RuntimeScheduler (#37881)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37881

Small refactor in preparation to add systrace markers for several methods in RuntimeScheduler.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D46556398

fbshipit-source-id: a0b92ea9173a55ec5a845bcfa278018ec3349e1f
2023-09-19 09:03:33 -07:00
Tim Yung 8b768f144a RN: Switch EventEmitter to Array.from(...) (#39525)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39525

Switches `EventEmitter#emit` to use `Array.from` instead of the spread operator.

This should be functionally identical (with marginally less overhead of the runtime having to determine the type of `registrations`), but there seems to be [some unexpected Babel configurations in the community](https://github.com/facebook/react-native/issues/35577#issuecomment-1723218934) that causes this line of code to do the wrong things.

Although we should independently root cause the Babel plugin configuration problems, this change might provide immediate relief and is also not any worse (e.g. in terms of code readability). This also adds a descriptive comment explaining the intention of the call to `Array.from`.

Changelog:
[Fixed][General] - Fix a potential bug in `EventEmitter` when used with certain Babel configurations that incorrectly polyfill the spread operator for iterables.

Reviewed By: javache

Differential Revision: D49389813

fbshipit-source-id: 7caf63734fc047496afe2f1ed6d918c22747258a
2023-09-19 08:04:17 -07:00
Peter Abbondanzo 5323221d14 Log a soft exception from accessibility event exceptions (#37002)
Summary:
This PR attempts to solve [this issue](https://github.com/facebook/react-native/issues/33021) I created last year, where accessibility events can fire after a view has been unmounted, causing the entire application to crash. This newly added try/catch block is modeled and copies verbiage exactly from the Fabric implementation of accessibility events [here](https://github.com/facebook/react-native/blob/2d9c81780c2bb3c2c2dc8875147261c9a1843eb4/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEventMountItem.java#L30-L43) and [here](https://github.com/facebook/react-native/blob/2d9c81780c2bb3c2c2dc8875147261c9a1843eb4/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/mounting/mountitems/SendAccessibilityEventMountItem.java#L30-L43).

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[ANDROID] [FIXED] - Fixed an issue where calling `Accessibility.setAccessibilityFocus` on an unmounted component would crash

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

Test Plan:
1. I reimplemented the crash demo from the Snack showcased in [this issue](https://github.com/facebook/react-native/issues/33021). I created the branch [here](https://github.com/Abbondanzo/react-native/pull/1/files), although I may archive or delete this repo in the future so the link is not permanent
1. I disabled the new Fabric architecture. This crash only occurs in the old architecture
1. I pressed the button that would set accessibility focus on an unmounted component, and it logs a soft exception as seen in the screenshot below. I've also attached a screenshot from an identical soft exception that already gets logged by Fabric
1. In both cases, the app continues to function as expected

|Example SoftException from this change|Example SoftException from Fabric (no changes to this code)|
|-|-|
|![image](https://user-images.githubusercontent.com/10366495/233423632-9eaa7c06-90a0-4e5c-ad65-5cc98ea52dc6.png)|![image](https://user-images.githubusercontent.com/10366495/233423233-f8f0bdb4-7f90-44f8-92aa-27992f60ccf3.png)|

Reviewed By: cipolleschi

Differential Revision: D49270491

Pulled By: cortinico

fbshipit-source-id: a489f160be44d78afb751527f70aa88e8a463ee0
2023-09-19 06:45:19 -07:00
Samuel Susla 06d40f4b33 remove dependency on butter from build files (#39522)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39522

changelog: [internal]

butter is not used in these modules. Remove it as dependency.

Reviewed By: rubennorte

Differential Revision: D49368308

fbshipit-source-id: 4251ea29033db9a03a75840609d909e68aed8c6c
2023-09-19 06:00:54 -07:00
Nick Gerleman 3b5bea01d0 Simplify bitfields (#39485)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39485

X-link: https://github.com/facebook/yoga/pull/1393

These were previously packed into structs to allow zero initializing all the flags at once without needing a ctor. C++ 20 has in-class member initializer support for bitfields, which makes these look more like normal member variables.

Setting enum values is a bit jank right now, due to relying on C enums which are effectively int32_t, along with GCC `-Wconversion` being a bit aggressive in needing to explicitly mask. I have some ideas to fix this later (e.g. using scoped enums internally).

bypass-github-export-checks

Changelog:
[General][Breaking] - Require C++ 20 when including renderer headers

Reviewed By: sammy-SC

Differential Revision: D49265967

fbshipit-source-id: 6ab935a866196df06e742c821f3af88eb4d18e1a
2023-09-19 01:28:35 -07:00
Nick Gerleman 3275b606a4 Breaking: Use C++ 20 (#39437)
Summary:
X-link: https://github.com/facebook/yoga/pull/1382

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

Have been running into places where C++ 20 makes life easier for use like `std::bit_cast` (that one is easy to polyfill), in-class member initializer support for bitfields, designated initializers, defaulted comparison operator, concepts instead of SFINAE, and probably more.

Our other infra is in the process of making this jump, or already has. This tests it out everywhere, across the various reference builds, to see if we have any issues.

This is a bit more aggressive than I had previously communicated, but n - 1 is going to be a better long term place than n - 2.

If we wanted to use `std::bit_cast` we would need one of:
1. GCC 11+ (~2.5 years old)
1. Clang 14 (~2.5 years old)
1. VS 16.11 (~2 years old)

For mobile this means:
1. NDK 26 (still in Beta 😭)
1. XCode 14.3.0 (~6 months old)

https://en.cppreference.com/w/cpp/compiler_support/20

That isn't quite doable yet, but we can start taking advantage of language features in the meantime. More of these will be supported in older toolchains.

Anyone needing support for older C++ versions can lag behind on more recent changes. E.g. Yoga 2.0 supports C++ 14.

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D49261607

fbshipit-source-id: ceb06eac20dfe93352d7b796d6847a7314069cf3
2023-09-19 01:28:35 -07:00
Intl Scheduler d859bd965e translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907941370560
Sandcastle Job Instance ID: 27021598813353392
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D49399828

fbshipit-source-id: 3e01a2c205774cfdaccc69950a4f4c536d2e5707
2023-09-18 18:30:25 -07:00
Alex Hunt 1ac3dab6e5 Improve "Open Debugger" error guidance (#39521)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39521

Minor Dev Menu changes:

- Improve guidance when failing to connect to the debugger.
- Align "Show Element Inspector" wording on iOS.

Changelog: [Internal]

Reviewed By: blakef

Differential Revision: D49375789

fbshipit-source-id: 092da6cae1a62a1bcc4dc877ab01369db6876741
2023-09-18 11:18:59 -07:00
Rubén Norte 77df5a9c29 Fix broken profiling on builds with debugger enabled (#39517)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39517

Fixes broken profiling on builds with debugger enabled.

Changelog: [internal]

Reviewed By: luluwu2032

Differential Revision: D49370067

fbshipit-source-id: eb76dcda69856bc0828c92513e88e86168d1805a
2023-09-18 08:54:21 -07:00
Dmitry Rykun 8498976b55 Enable Fabric interop in bridgeless mode on iOS (#39495)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39495

We've put `[self unstable_registerLegacyComponents]` inside `#if RCT_NEW_ARCH_ENABLED` block, but we've missed the fact that it was inside the `else` clause of the `if (enableBridgeless)` statement. So it wasn't actually enabled for bridgeless mode regardless of `RCT_NEW_ARCH_ENABLED`.
This diff fixes that, and registers legacy components for the bridgeless mode as well.

Changelog: [Internal]

Reviewed By: NickGerleman, cipolleschi

Differential Revision: D49323913

fbshipit-source-id: 5b8e4ffc6ea1cdf5bbdecbddd5274d70c9b2eeab
2023-09-18 08:23:34 -07:00
Nick Gerleman 0f099616ad Fix C++ 20 compatibility issues in headers consumed by RN modules (#39499)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39499

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D49360870

fbshipit-source-id: 5261e1e3cce4f9c9e95a694c699629fa2d4dda3d
2023-09-18 06:54:30 -07:00
Samuel Susla 7c928fffcc Remove use of folly::F14FastMap from React Native (#39496)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39496

changelog: [internal]

Remove use of folly::F14FastMap in favour of std::unordered_map.

Reviewed By: fkgozali

Differential Revision: D48968297

fbshipit-source-id: fa1e80534f817e1e37f932558c09e418a23383e8
2023-09-18 06:27:45 -07:00
Riccardo Cipolleschi 29adb8de98 Implement version parsing and connect to RNTester (#39502)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39502

This diff adds the parsing of the package.json to retrieve the version of react native and it matches it against a regex to decide whether to enable or not the New Architecture.

This change depends on [this CLI's PR](https://github.com/react-native-community/cli/pull/2076).

## Changelog:
[Android][Added] - Parse RN Version to decide whether to enable the New Arch or not.

Reviewed By: cortinico

Differential Revision: D49270012

fbshipit-source-id: 5164a1ddd26f1822c0d717a7a9e2416ec38d78a2
2023-09-18 06:12:19 -07:00
Riccardo Cipolleschi 55a0425fb2 Add helper types and function for double publishing (#39501)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39501

This change introduce a new model to parse the React Native package.json.
The objects are not connected but they will be used in the next diff

## Changelog:
[Android][Added] - Add a couple of types in the RNGP for json parsing.

Reviewed By: cortinico

Differential Revision: D49270044

fbshipit-source-id: 42a855bb85a5f8e1b1249ab3ebee974ce3fb93fd
2023-09-18 06:12:19 -07:00
Riccardo Cipolleschi c6d14f6e16 Make New Architecture Examples in RNTester work properly (#39500)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39500

When working on RNTeaster, we discovered that the Kotlin migration. broke something.

This diff make sure we can test RNTester

## Changelog:
[Internal] - Make RNTester's New Architecture Example execute again

Reviewed By: cortinico

Differential Revision: D49154282

fbshipit-source-id: cb1f6b076b129dc088cf2cbb5799b373b6afdcda
2023-09-18 06:12:19 -07:00
Riccardo Cipolleschi 8a5b2d6735 Add ld_classic flag to Hermes when building for Xcode 15 (#39516)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39516

With Xcode15, Apple rewrote the C++ linker.
This is a breaking change that does not work with weak symbols.
As a workaround, apple is suggesting to add `-ld_classic` to the linker in order to readd support for weak symbols. The flag does not exists for Xcode 14.3 or lower, so we need to add it conditionally.

With this change, we introduce a couple of checks in the Hermes build logic:
1. Detect the version of Xcode that is used
2. Add the new flag to `HERMES_EXTRA_LINKER_FLAGS` if Xcode version is 15.

## Changelog:
[Internal] - Make hermes build properly with Xcode 15

Reviewed By: cortinico, dmytrorykun

Differential Revision: D49368675

fbshipit-source-id: 62d8ed81855c426f56ed94b6a2d6da2eb882b355
2023-09-18 06:11:10 -07:00
Riccardo Cipolleschi 47de1f6e56 Bumping the resource class for Analyze-pr to Medium (#39504)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39504

We are receiving "killed" signals in CircleCI for the analyze_pr jobs.
Looking at the doc, it seems that it is due to us allocating to much memory.

As a mitigation, let's bumpt the executor to Medium.

## Changelog:
[Internal] - Bump executors for Analyze-PR to Medium to avoid choking

## Facebook:

Small machines consume 5 cred/min. Medium consume 10.
On average, the job takes 7 min to complete. So we are paying 35 credits per job. We will be paying 70 creds.
The upper bound cost is $ 0.042 per execution.
In the past month we were running 1820 jobs. We will be spending 1820 * 0.042  = $76.44 per month, rather than $38.22.
This is roughly $500/year.

We can fix the script with a different approach in the future.

Reviewed By: cortinico, dmytrorykun

Differential Revision: D49368118

fbshipit-source-id: 7e04e4be79b0f07d02338834e543b707c93c4363
2023-09-18 04:51:26 -07:00
Nicola Corti a24990c878 Remove unused downloadAll task (#39443)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39443

This task is unused in CI now and we can safely remove it from our build files.

Changelog:
[Internal] [Changed] - Remove unused downloadAll task

Reviewed By: mdvacca, cipolleschi

Differential Revision: D49233339

fbshipit-source-id: 558b44612b71bb1cb220cc21b8339835ae235302
2023-09-18 04:46:42 -07:00
Nicola Corti 1b7e26cccb Remove unused canLoadFile function from HermesExecutor.java (#39481)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39481

This function is hardcoded to `true` and is never used, so I'm removing it.
I found no relevant usages in OSS so that can probably go.
Also see: https://github.com/facebook/react-native/issues/39292 where it got reported.

Changelog:
[Android] [Removed] - Remove unused `canLoadFile` function from HermesExecutor.java

Reviewed By: yungsters, mdvacca

Differential Revision: D49320244

fbshipit-source-id: e680aeb9a9e9e837c35b61eef43b3744ee68a726
2023-09-18 03:40:04 -07:00
Riccardo Cipolleschi 0dbd621c59 Fix Xcode 15 RC issues (#39474)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39474

When it comes to Xcode 15 RC, we are aware of two issues:
1. `unary_function` and `binary_function` not available in Cxx17
2. [Weak linking](https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking) is not supported anymore.

This change should fix both of the issues, adding the flags to allow for `unary_function`and `binary_function` to be called and adding the `-Wl -ld_classic` flag to `OTHER_LDFLAGS` in case Xcode 15 is detected.

## Changelog:
[Internal] - add the `_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION` and the `-Wl -ld_classic` flags to projects when needed

Reviewed By: dmytrorykun

Differential Revision: D49319256

fbshipit-source-id: bb895f1e60db915db79684f71fa436ce80b42111
2023-09-18 02:45:12 -07:00
Riccardo Cipolleschi 21763e85e3 Bump IPHONEOS_DEPLOYMENT_TARGET to 13.4 for 3rd party pods (#39478)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39478

When testing Xcode 15, we realized that a few pods we do not control directly have the IPHONEOS_DEPLOYMENT_TARGET set to old versions of iOS.
We can update that setting to silence the warning with Cocoapods and this is what this script does.

Notice that bumping that setting generated other warning as some APIs have been deprecated.

## Changelog:
[Internal] - Bump min IPHONEOS_DEPLOYMENT_TARGET for 3rd party pods

Reviewed By: dmytrorykun

Differential Revision: D49274837

fbshipit-source-id: 584d105c76d654daa2ecf5eb2f1b9381e70f567a
2023-09-18 02:45:12 -07:00
Saad Najmi 0ab8b40fd6 Remove Xcode 12.5 post install workaround (#39482)
Summary:
Now that we updated folly in https://github.com/facebook/react-native/commit/17154a661fe06ed25bf599f47bd4193eba011971, we should pick up https://github.com/facebook/folly/commit/4a8837f3226152c2106be366ecae3a228cde4f45 and probably don't need this post install phase anymore

## Changelog:

[IOS] [REMOVED] - Remove Xcode 12.5 post install workaround

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

Test Plan: CI should pass

Reviewed By: cipolleschi

Differential Revision: D49328614

Pulled By: NickGerleman

fbshipit-source-id: 05fa0b6d41d07ac552e2b536fbf3a732a31ba713
2023-09-17 19:55:02 -07:00
Intl Scheduler 441822923c translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907941319941
Sandcastle Job Instance ID: 1053036626
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D49356785

fbshipit-source-id: 52769b9e93c7eac3f03d557cec21f621150d86a1
2023-09-17 09:06:33 -07:00
Samuel Susla d7d030a2cd Remove folly::F14FastSet from React Native (#39490)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39490

changelog: [internal]

Removing use of folly::F14FastSet to reduce the dependency on Folly library.

Reviewed By: rshest

Differential Revision: D48967273

fbshipit-source-id: 6b67e674667b13ce8c9a80b2b1682f0b120c71ac
2023-09-16 17:29:09 -07:00
Alex Hunt 3bc402f612 Remove Flipper actions in Dev Menu, add new Open Debugger action (Android) (#39254)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39254

## Context

RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641

## Changes

- Removes Flipper-backed "Launch Debugger" and "Launch React DevTools" actions from the Dev Menu.
- Adds replacement "Launch Debugger" action triggering the new one-click Hermes debugger flow for 0.73.

Changelog:
[Android][Changed] Remove Flipper actions in Dev Menu, add new Open Debugger action

#rn-oss-skip-export

Reviewed By: cortinico

Differential Revision: D46187942

fbshipit-source-id: 6f2123a98558922f0110349e93b9156312604dff
2023-09-16 13:48:24 -07:00
Alex Hunt 5bfc507655 Remove Flipper actions in Dev Menu, add new Open Debugger action (iOS) (#39124)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39124

## Context

RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641

## Changes

- Removes Flipper-backed "Launch Debugger" and "Launch React DevTools" actions from the Dev Menu.
- Adds replacement "Launch Debugger" action triggering the new one-click Hermes debugger flow for 0.73.

Changelog:
[iOS][Changed] Remove Flipper actions in Dev Menu, add new Open Debugger action

Reviewed By: motiz88, blakef

Differential Revision: D46220076

fbshipit-source-id: 7fd47dff4b4e29a8dda77fa98369cc7e5219fa7b
2023-09-16 13:48:24 -07:00
Samuel Susla d0531379d9 Remove Folly::small_vector (#39442)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39442

changelog: [internal]

Delete folly:small_vector. folly:small_vector was not used on Android, fragmenting platforms.
Additionally, we want to remove dependency on Folly from React Native.

Reviewed By: NickGerleman, rshest

Differential Revision: D48966287

fbshipit-source-id: 000b4d58d54b6100aeac016af53b5e5f8cbee705
2023-09-16 09:41:06 -07:00
Intl Scheduler 5bc7b1efcf translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907941282347
Sandcastle Job Instance ID: 31525198440982364
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D49348245

fbshipit-source-id: 906d73d14e3ea548f2f4948a2e8e6f2c509f0a2e
2023-09-16 05:18:51 -07:00
Phillip Pan ccfd4c080c deprecate hasConstants from ReactModule annotation (#39489)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39489

## Changelog
[Android][Deprecated] - deprecate hasConstants from ReactModule annotation

this is not used in our framework anymore, deprecating

Reviewed By: cortinico

Differential Revision: D49262867

fbshipit-source-id: 90e5ee75cf20345c6121e77a3328f9c96f104cdb
2023-09-16 01:35:01 -07:00
Phillip Pan 9f52378cc1 deprecate hasConstants from ReactModuleInfo (#39459)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39459

## Changelog
[Android][Deprecated] - ReactModuleInfo constructor with getConstants arg is deprecated

introducing a new constructor that doesn't use getConstants and updating the internal codebase to use it. deprecated the old one since it's been copypasta'd a lot in oss.

Reviewed By: cortinico

Differential Revision: D49262824

fbshipit-source-id: 1a4d36b3153d8ce0ee869b8635c94005fe7c9594
2023-09-16 01:35:01 -07:00
David Vacca 49197411d8 Create FeatureFlag to gate Stable API for Turbo Module (#39479)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39479

The goal of this diff is to create a feature flag that will be used to enable/disable Stable API for Turbo Module.
This featureflag will be used to experiment with the new API in fb4a

changelog: [intenral] internal

Reviewed By: arushikesarwani94

Differential Revision: D49212022

fbshipit-source-id: 4f4830f11ba18ad849dc8b35f4e178e938b03fc9
2023-09-15 17:37:58 -07:00
Phillip Pan 2be409ff55 hot fix for incorrect url parsing
Summary:
in this diff, we backout D49335986 to fix the issue where we are losing context from decoding an encoded string all at once via `NSURL URLWithString....`. this fixes the category of issues in https://fb.workplace.com/groups/rn.support/posts/25183724564582821.

however, this will regress the original issue that this fixed (https://fb.workplace.com/groups/rn.support/posts/25129344753354136), where encoding square brackets in the URI is causing percents to be re-encoded, resulting in a mixed uri with mixed encoding, i.e. `%2522%5B%5D`. we will be fixing this by not serving decoding brackets in our php serializer which was originally be the follow-up fix, since that does not respect the RFC.

bypass-github-export-checks

Reviewed By: fkgozali

Differential Revision: D49336101

fbshipit-source-id: 2012390b237de8a16a5e60e880905cec48584873
2023-09-15 14:53:26 -07:00
Alex Hunt 850e550422 Add serverBaseUrl option, set client-accessible URL value externally (#39456)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39456

**Fixes new debugger launch flow on Android:**

D49158227 aimed to improve proxy-safe behaviour for remote dev servers by auto-detecting the appropriate server URL for clients using the `Host` header (etc) from the HTTP request. However, this approach broke the local case for Android emulators and externally connected devices since they would originate from a device-relative server hostname — e.g. `10.0.2.2` for the stock Android emulator.

https://pxl.cl/3mVmR

This commit reverts to an explicit approach where callers specify the base URL to the dev server that should be addressible from the development machine — now as a single `serverBaseUrl` option.

**Changes**

- Adds new `serverBaseUrl` option to `createDevMiddleware`, designed to be the base URL value for constructing dev server URLs returned in endpoints such as `/json/list`.
    - This changes little for the `localhost` case (now enabling `https://` URLs), but enables remote dev server setups to specify this cleanly.
- Updates call site in `community-cli-plugin`.

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D49276125

fbshipit-source-id: 2b6a8507073649832993971aa9d0870f54c9bd44
2023-09-15 13:11:04 -07:00
Sunbreak fd32931f95 Clean header-only SchedulerToolbox (#39455)
Summary:
Clean header-only `SchedulerToolbox.cpp`

## Changelog:

[INTERNAL] [REMOVED] - Clean header-only SchedulerToolbox

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

Test Plan: Compile success

Reviewed By: NickGerleman

Differential Revision: D49289800

Pulled By: arushikesarwani94

fbshipit-source-id: c177ab982e69a41126ab24c244b7f125e6a3d2bb
2023-09-15 11:12:09 -07:00
Arushi Kesarwani 8d2af4978a Adding UIManagerProvider interface (#39432)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39432

For the removal of JSI Module adding the `UIManagerProvider` interface as this will replace the `JSIModuleProvider`

Adding the `Deprecated` annotation since this would be deprecated later as part of Stable APIs with bridge removal and not encouraged usage.

Changelog:
[Internal] internal

Reviewed By: cortinico

Differential Revision: D49257901

fbshipit-source-id: 176ae03368309b56f7a7608419f1776baf4b512a
2023-09-15 10:28:04 -07:00
Samuel Susla 1ac7e92e53 Fix RawProps folly::dynamic ctor to give option to avoid copy (#39473)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39473

changelog: [internal]

avoid copy of folly::dynamic if possible.

Reviewed By: javache

Differential Revision: D49312487

fbshipit-source-id: cd7b1e9b5a6376168d472c311637fa1b076d61e3
2023-09-15 09:35:02 -07:00
Nicola Corti 1ff2dd29b4 Fix typo inside DefaultNewArchitectureEntryPoint (#39477)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39477

There is a typo inside `DefaultNewArchitectureEntryPoint` that we want to fix before this becomes part of the public API.

Changelog:
[Internal] [Changed] - Fix typo inside DefaultNewArchitectureEntryPoint

Reviewed By: sammy-SC, cipolleschi

Differential Revision: D49320026

fbshipit-source-id: 8cf4d2027860b8d2fafd2b8abc51e68392e6343e
2023-09-15 08:56:01 -07:00
Nate Stedman 88395bb17d Update ktfmt component on FBS:master
Reviewed By: hick209

Differential Revision: D49300079

fbshipit-source-id: 7e704e2366feee3f6f2c25ac25d3daea407e71f9
2023-09-15 07:19:43 -07:00
Juliovaz d208dc422c Update description about jsBundleURLForBundleRoot method (#39265)
Summary:
Update comment in RCTBundleURLProvider.h to use correct `jsBundleURLForBundleRoot` import with `fallbackExtension` instead `fallbackResource`

## Changelog:

- Update comment in `jsBundleURLForBundleRoot` definition on RCTBundleURLProvider.h file.

Pick one each for the category and type tags:

[IOS][CHANGED] - Updated comment in RCTBundleURLProvider.h to instance correct jsBundleURLForBundleRoot:fallbackExtension method.

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

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D49227104

Pulled By: GijsWeterings

fbshipit-source-id: 6ccfb984ab6c1e858f1c568b2dd8f4626e133ffb
2023-09-15 03:57:28 -07:00
Nick Gerleman a931867286 Fix formatting in folly_flags.cmake and template pbxproj (#39465)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39465

Separate a definition onto a separate line.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D49309462

fbshipit-source-id: 98726dfb3d2c79faca0fac758164186eb4c651b5
2023-09-15 03:43:04 -07:00
Nick Gerleman 5ea0b449e2 Fix podspecs building with C++ 14 (#39464)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39464

We currently have 854 warnings emitted due to nested namespaces being a C++ 17 extension lol.

This sets the standard explicitly to C++ 20 in the specs emitting the warnings (mostly RCT-Text).

It is undesirable that we add hundreds of warnings to the CocoaPods build without signal. Our Buck build and OSS Android build both treat warnings as errors. But... that is for another day.

Changelog: [Intenrnal]

Reviewed By: cortinico

Differential Revision: D49303081

fbshipit-source-id: 1233e9d51426fb8dbd8ca39a771e2fef3d0df856
2023-09-15 02:47:07 -07:00
Adam Averay 9ca16605e0 Feature: Improvements to automaticallyAdjustKeyboardInsets (#37766)
Summary:
This is a reopened version of https://github.com/facebook/react-native/issues/35224 by isidoro98 which was closed without explanation, updated to resolve new merge conflicts and now includes an example in the RN-Tester app. Aside from that it is unchanged. Here is isidoro98's description from their original PR:

This PR builds on top of https://github.com/facebook/react-native/issues/31402, which introduced the `automaticallyAdjustsScrollIndicatorInsets` functionality. It aims to fix one of RN's longstanding pain point regarding the keyboard.

The changes provide a better way of handling the `ScrollView` offset when a keyboard opens. Currently, when a keyboard opens we apply an **offset** to the `Scrollview` that matches the size of the keyboard. This approach is great if we are using an `InputAccessoryView` but if we have multiple `TextInputs` in a `ScrollView`; offsetting the content by the size of the keyboard doesn't yield the best user experience.

## Changelog:

[iOS] [Changed] - Scroll `ScrollView` text fields into view with `automaticallyAdjustsScrollIndicatorInsets`

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

Test Plan:
The videos below compare the current and proposed behaviors for the following code:

```js
<ScrollView
  automaticallyAdjustKeyboardInsets
  keyboardDismissMode="interactive">
  {[...Array(10).keys()].map(item => (
    <CustomTextInput placeholder={item.toString()} key={item} />
  ))}
</ScrollView>
```

| Current behaviour | Proposal |
|-|-|
| ![https://user-images.githubusercontent.com/25139053/200194972-1ac5f1cd-2d61-4118-ad77-95c04d30c98d.mov](https://user-images.githubusercontent.com/25139053/200194972-1ac5f1cd-2d61-4118-ad77-95c04d30c98d.mov) | ![https://user-images.githubusercontent.com/25139053/200194990-53f28296-be11-4a47-be70-cec917d7deb1.mov](https://user-images.githubusercontent.com/25139053/200194990-53f28296-be11-4a47-be70-cec917d7deb1.mov) |

As can be seen in the video, the **current behavior** applies an offset to the `ScrollView` content regardless of where the `TextInput` sits on the screen.

The proposal checks if the `TextInput` will be covered by the keyboard, and only then applies an offset. The offset applied is not the full size of the keyboard but instead only the required amount so that the `TextInput` is a **specific** distance above the top of the keyboard (customizable using the new `bottomKeyboardOffset` prop). This achieves a less "jumpy" experience for the user.

The proposal doesn't change the behavior of the `ScrollView` offset when an `InputAccessory` view is used, since it checks if the `TextField` that triggered the keyboard is a **descendant** of the `ScrollView` or not.

## Why not use other existing solutions?

RN ecosystem offers other alternatives for dealing with a keyboard inside a ScrollView, such as a `KeyboardAvoidingView` or using third party libraries like `react-native-keyboard-aware-scroll-view`. But as shown in the recordings below, these solutions don't provide the smoothness or behavior that can be achieved with `automaticallyAdjustsScrollIndicatorInsets`.

| KeyboardAvoidingView | rn-keyboard-aware-scroll-view |
|-|-|
| ![https://user-images.githubusercontent.com/25139053/200195145-de742f0a-6913-4099-83c4-7693448a8933.mov](https://user-images.githubusercontent.com/25139053/200195145-de742f0a-6913-4099-83c4-7693448a8933.mov) | ![https://user-images.githubusercontent.com/25139053/200195151-80745533-16b5-4aa0-b6cd-d01041dbd001.mov](https://user-images.githubusercontent.com/25139053/200195151-80745533-16b5-4aa0-b6cd-d01041dbd001.mov) |

As shown in the videos, the `TextInput` is hidden by the keyboard for a split second before becoming visible.

Code for the videos above:

```js
// KeyboardAvoidingView
<KeyboardAvoidingView
  style={{flex: 1, flexDirection: 'column', justifyContent: 'center'}}
  behavior="padding"
  enabled>
  <ScrollView>
    {[...Array(10).keys()].map(item => (
      <CustomTextInput placeholder={item.toString()} key={item} />
    ))}
  </ScrollView>
</KeyboardAvoidingView>
```

 ```js
// rn-keyboard-aware-scroll-view
<KeyboardAwareScrollView>
  {[...Array(10).keys()].map(item => (
    <CustomTextInput placeholder={item.toString()} key={item} />
  ))}
</KeyboardAwareScrollView>
```

Reviewed By: sammy-SC

Differential Revision: D49269426

Pulled By: javache

fbshipit-source-id: 6ec2e7b45f6854dd34b9dbb06ab77053b6419733
2023-09-15 02:34:40 -07:00
Nick Gerleman 17154a661f C++ 20 all the things (#39454)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39454

1. Build with C++ 20 everywhere.
2. Update folly in OSS build to avoid a warning, and let us opt out of heavy bits required for supporting coroutines (we are still more than a year behind).
3. Update the folly podspec for the new version of folly
4. Update the many, many, copy/pasted header search paths for folly dependencies to be able to resolve fmt, now exposed to folly headers
4. Replaces a deprecated atomic usage with equivalent.
5. Fixes a deprecated implicit capturing `this` by value in lambda (same behavior, added a TODO because it seems sus)

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D49271685

fbshipit-source-id: 16610f7bcd1032d5796cc11f1cfa92a33d8c2593
2023-09-15 01:17:55 -07:00
David Vacca e513a50fe1 Introducing LazyTurboModuleManagerDelegate (#39462)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39462

In this diff I'm introdcuing the new UnstableAPI called LazyTurboModuleManagerDelegate.
The goal of this class is to provide a Lazy registration of TurboModules without relying on ReactModule annotations neither the TurboReactPackage#getReactModuleInfoProvider method.

This is not the final implementation, it's just a prototype that will be used to experiment and learn about perf implications.

This class will be used in the next diffs of the stack

changelog: [intenral] internal

Reviewed By: cortinico

Differential Revision: D49172555

fbshipit-source-id: 1609c523e6e72f2aa42ca7cc35e9170104a101db
2023-09-14 23:45:17 -07:00
David Vacca 040d13960f Create empty constructor on ReactPackageTurboModuleManagerDelegate (#39461)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39461

In this diff I'm creating an empty constructor on ReactPackageTurboModuleManagerDelegate. This will be used in the next diffs of the stack.
I'm also resorting methods for better read of the class

changelog: [intenral] internal

Reviewed By: arushikesarwani94

Differential Revision: D49172554

fbshipit-source-id: 54073c86c87aa145b12e783d8d8f75cd1f5b228c
2023-09-14 23:45:17 -07:00