Commit Graph

29068 Commits

Author SHA1 Message Date
Alex Hunt 3ef7de848d Improve remote debugging LogBox message, cleanup unused openURL method (#39582)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39582

Some tidying up around remote JS debugging while testing. See also https://github.com/react-native-community/cli/pull/2083.

## Changelog:
[iOS][Breaking] - Remove `openURL` method from `RCTInspectorDevServerHelper`

Reviewed By: cipolleschi

Differential Revision: D49499068

fbshipit-source-id: 843ef6cf1af658756466854fc1a0b3edd91c1f37
2023-09-22 04:43:11 -07:00
Willa Kong 8c5340fd96 Revert D49413562: Static view configs take precedence over native view configs
Differential Revision:
D49413562

Original commit changeset: d65776cd43ea

Original Phabricator Diff: D49413562

fbshipit-source-id: e0f8670f0725412740142fd2c41e1eaeb9ca4c8a
2023-09-21 19:20:42 -07:00
Saad Najmi 8fa1127c35 updateIphoneOSDeploymentTarget -> updateOSDeploymentTarget (#39570)
Summary:
While merging new commits into React Native macOS, I noticed https://github.com/facebook/react-native/pull/39478/

I would like to also set `MACOS_DEPLOYMENT_TARGET` in our fork, and thought this slight rename would be something I can do upstream

## Changelog:

[Internal] - updateIphoneOSDeploymentTarget -> updateOSDeploymentTarget

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

Test Plan: CI should pass

Reviewed By: NickGerleman

Differential Revision: D49514693

Pulled By: ryancat

fbshipit-source-id: b4dafb1f9736d2977510712652cb8097263c489d
2023-09-21 19:14:34 -07:00
Nick Gerleman 7a8251ec7d Remove FloatOptional related TODOs
Summary:
These were added quite a while ago, and the proprosed change doesn't really make sense to pursue, since FloatOptional is a C++ wrapper around a Float, and the public API is entirely C.

bypass-github-export-checks

Reviewed By: rshest

Differential Revision: D49476343

fbshipit-source-id: f83cc99adda75fc0dba96e063cca92510c3d2ef0
2023-09-21 18:14:46 -07:00
David Vacca f39952ba78 Update UnsupportedOperationException message in TurboReactPackage (#39564)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39564

Update UnsupportedOperationException message in TurboReactPackage

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D49440132

fbshipit-source-id: 09ee013fcad8d18259f35b57564ea9a382907841
2023-09-21 12:22:02 -07:00
Adam Grzybowski 783150f37b Don't use setState for disabled KeyboardAvoidingView to avoid re-renders (#38074)
Summary:
There are two reasons to apply these changes:
- We don't need to re-render the `KeyboardAvoidingView` if it is disabled. It may be especially useful in combination with [react-navigation](https://reactnavigation.org/) where we could disable `KeyboardAvoidingView` for screens that are not focused
- They fix the problem with the `KeyboardAvoidingView` wrapped inside the [react-freeze](https://github.com/software-mansion/react-freeze) component. Similarly, as above, it is useful when we want to freeze screens that are not visible for the user.

## Changelog:
[GENERAL] [CHANGED] Don't use setState for disabled KeyboardAvoidingView to avoid re-renders

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

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

Test Plan: - Check if the KeyboardAvoidingView works as expected.

Reviewed By: sammy-SC

Differential Revision: D49148391

Pulled By: blakef

fbshipit-source-id: c4b7bde696d2249cbf4ad12c77058183b632464d
2023-09-21 11:43:41 -07:00
Alex Hunt 1e44a5f518 Bump CLI to 12.0.0-alpha.15 (#39576)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39576

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D49496981

fbshipit-source-id: bae2a5fed9d795afcd58e8e24c3ff47c01707d4e
2023-09-21 10:18:51 -07:00
Elmer Banda 1bda78f2fa Add mock removeEventListener and currentState method for AppState (#39578)
Summary:
Add mock removeEventListener and currentState method for AppState

When testing the React Native page by Jest, the error TypeError: import_react_native.AppState.removeEventListener is not a function will be reported.

## Changelog:

[General] [ Changed ] - Add mock removeEventListener and currentState method for ```AppState```

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

Test Plan:
Print AppState module output
```
AppState: {
      addEventListener: [Function: mockConstructor] {
        _isMockFunction: true,
        getMockImplementation: [Function (anonymous)],
        mock: [Getter/Setter],
        mockClear: [Function (anonymous)],
        mockReset: [Function (anonymous)],
        mockRestore: [Function (anonymous)],
        mockReturnValueOnce: [Function (anonymous)],
        mockResolvedValueOnce: [Function (anonymous)],
        mockRejectedValueOnce: [Function (anonymous)],
        mockReturnValue: [Function (anonymous)],
        mockResolvedValue: [Function (anonymous)],
        mockRejectedValue: [Function (anonymous)],
        mockImplementationOnce: [Function (anonymous)],
        mockImplementation: [Function (anonymous)],
        mockReturnThis: [Function (anonymous)],
        mockName: [Function (anonymous)],
        getMockName: [Function (anonymous)]
      },
      removeEventListener: [Function: mockConstructor] {
        _isMockFunction: true,
        getMockImplementation: [Function (anonymous)],
        mock: [Getter/Setter],
        mockClear: [Function (anonymous)],
        mockReset: [Function (anonymous)],
        mockRestore: [Function (anonymous)],
        mockReturnValueOnce: [Function (anonymous)],
        mockResolvedValueOnce: [Function (anonymous)],
        mockRejectedValueOnce: [Function (anonymous)],
        mockReturnValue: [Function (anonymous)],
        mockResolvedValue: [Function (anonymous)],
        mockRejectedValue: [Function (anonymous)],
        mockImplementationOnce: [Function (anonymous)],
        mockImplementation: [Function (anonymous)],
        mockReturnThis: [Function (anonymous)],
        mockName: [Function (anonymous)],
        getMockName: [Function (anonymous)]
      },
      currentState: [Function: mockConstructor] {
        _isMockFunction: true,
        getMockImplementation: [Function (anonymous)],
        mock: [Getter/Setter],
        mockClear: [Function (anonymous)],
        mockReset: [Function (anonymous)],
        mockRestore: [Function (anonymous)],
        mockReturnValueOnce: [Function (anonymous)],
        mockResolvedValueOnce: [Function (anonymous)],
        mockRejectedValueOnce: [Function (anonymous)],
        mockReturnValue: [Function (anonymous)],
        mockResolvedValue: [Function (anonymous)],
        mockRejectedValue: [Function (anonymous)],
        mockImplementationOnce: [Function (anonymous)],
        mockImplementation: [Function (anonymous)],
        mockReturnThis: [Function (anonymous)],
        mockName: [Function (anonymous)],
        getMockName: [Function (anonymous)]
      }
    }
```

Reviewed By: yungsters

Differential Revision: D49504249

Pulled By: robhogan

fbshipit-source-id: c0528ca9da4711f4c39bd2db29bcd34e77c6d4d2
2023-09-21 10:05:13 -07:00
Riccardo Cipolleschi 42d090c94c Fix local e2e script by copying the hermes' ruby files to the right folder (#39580)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39580

While testing other features, I realized that the script to generate a project locally, starting from the template, has a bug for which we were using the outdated `hermes-engine.podspec` coming from the Hermes repo to build hermes.

This change fixes this by moving our files to the right folder.

## Changelog:
[Internal] - Fix local e2e test script copying hermes rubyscript over

Reviewed By: dmytrorykun

Differential Revision: D49497716

fbshipit-source-id: f1d582ec9d9c8007cbd2f9c876c061af12735f83
2023-09-21 07:36:28 -07:00
Dmitry Rykun 1c1652d5a9 Static view configs take precedence over native view configs (#39534)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39534

Fetching native view configs is computationally intensive work, so if some component has both native and static VCs, we should try static first.
This diff changes the `NativeComponentRegistry` so it tries to get static view config first, and then native view config as a fallback.
This diff also removes setting `RuntimeConfigProvider` from RNTester. As it was there for the same purpose of inverting that precedence.
Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D49413562

fbshipit-source-id: d65776cd43eaa97d880b76385423c65e4e8744ba
2023-09-21 07:22:05 -07:00
Lulu Wu 72bf2e87e2 Enable Bridgeless for template (#39527)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39527

So that Templace is able to switch to Bridgeless

Reviewed By: fkgozali

Differential Revision: D49150891

fbshipit-source-id: 782a6ffc4f8b21c0106458f6f16043df65ccd183
2023-09-21 06:56:19 -07:00
Riccardo Cipolleschi 780567c727 Refactor publish-npm args to be more safe (#39532)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39532

This change refactors how we handle the parameters of publish-npm so we can only accept the build types we actually support.

## Changelog:
[Internal] - Make publish-npm args stricter

Reviewed By: cortinico

Differential Revision: D49374263

fbshipit-source-id: a17ddecc0ddcb30858dd0baaab8990ae765d304f
2023-09-21 04:35:41 -07:00
Alex Hunt eaec4f7fda Fix Codegen build script on EdenFS (#39566)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39566

Fixes running the `build.sh` script for `react-native-codegen` when on [EdenFS](https://github.com/facebook/sapling). This would previously fail due a filesystem "unable to copy extended attributes" error.

This only affects development within the React Native monorepo. Practically, this equates to a workflow improvement for Meta engineers when creating `RNTester` builds.

NOTE: **This is temporary**. The change from `mv` to `cp -R` makes this script more expensive, which will make Android builds via Gradle take slightly longer. I have a WIP cleanup planned which will 1/ move `react-native-codegen` to the [shared monorepo build setup](https://github.com/facebook/react-native/pull/38718), and 2/ drop this step entirely from the Android Gradle build.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D49468891

fbshipit-source-id: 25d5db81798cf8ab150a135174a45f4d4c2cb5a2
2023-09-21 04:09:43 -07:00
Nick Gerleman ea85b31354 Remove usage of Dimension arrays and YGDimension as index (#39567)
Summary:
X-link: https://github.com/facebook/yoga/pull/1402

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

This change hides away most usages of YGDimension as an index. We do this for a couple reasons:

1. Right now the style interface may return a full array of resolved edge or dimension values, as a CompactValue. As we abstract away from CompactValue, and move towards ValuePool, this will no longer be the internal interface, and cheap to return. We instead change the interface to return a single value at once, which lets us resolve values lazily.

2. As we move internal usage to scoped enums, enums are not implicitly convertible to intergers (broadly a good thing). Hiding the enum as index prevents the need for callers to cast or convert to underlying.

Instead of making a new version of `IdxRef` for this, I converted to a more traditional setter. I will be making similar changes later for other styles, when I hide CompactValue from the public interface.

To review I would recommend filtering to changes in `xplat`, or viewing this in a single one of the OSS PRs exported. Everything apart from the below 20 files is a mirror.

{F1096792573}

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D49362819

fbshipit-source-id: 30d730d78e62f36597d43f477120f65694e51ea3
2023-09-20 16:19:59 -07:00
Pieter De Baets 97b6829b83 Ensure systrace events are always stopped (#39561)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39561

Trying to investigate an issue where Systrace events aren't properly ended. For correctness, we should make sure to always end markers that we started.

Reviewed By: sammy-SC

Differential Revision: D49413689

fbshipit-source-id: e48e3aef20602e0af9deb924244cdfaf614d11f2
2023-09-20 15:07:21 -07:00
Lulu Wu 630cf3b21c Add the new media permission to typescript (#39563)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39563

In https://github.com/facebook/react-native/pull/38880 we added the new media permission "READ_MEDIA_VISUAL_USER_SELECTED", this diff added it for TS as well

Reviewed By: NickGerleman, mdvacca

Differential Revision: D49371798

fbshipit-source-id: ebc77872f5609b411904b04e684b804584eeaaa9
2023-09-20 12:31:17 -07:00
Pieter De Baets ecf1b84795 SafeAreaView shouldn't dirty layout on clone by default (#39554)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39554

There's no need to auto-dirty this component on clone (which will happen every time one of its children is cloned), if we update the padding values in `ComponentDescriptor::adopt` this will [already dirty as necessary](https://github.com/facebook/react-native/blob/7888338295476f4d4f00733309e54b8d22318e1e/packages/react-native/ReactCommon/react/renderer/components/safeareaview/SafeAreaViewComponentDescriptor.h#L28).

Reviewed By: sammy-SC

Differential Revision: D49058812

fbshipit-source-id: ea1ac8a1aa96c7ea24dcc48627a500f8c7fc2aae
2023-09-20 09:55:05 -07:00
Christoph Purrer 078973612f Extract SourceCode TM type for react-native-codegen (#39547)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39547

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49437443

fbshipit-source-id: 200f8b886a3a18aec6c9455e931e25634aca2149
2023-09-20 08:59:42 -07:00
Christoph Purrer f31dada1b7 Extract AppState TM type for react-native-codegen (#39546)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39546

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49436860

fbshipit-source-id: d120e04f67430f66b5f1be453726b43805aeac81
2023-09-20 08:59:42 -07:00
Riccardo Cipolleschi 27979dcd21 Bump template cache to fix iOS CI (#39560)
Summary:
Earlier today we bumped boost and removed a fix for Xcode 15.
Boost is a pod we don't consume from source and for the template we don't have a Podfile.lock to update.
However, the pod we don't control are cached as they don't change often.

This PR fixes bumps the cache to fix the CI issue

bypass-github-export-checks

## Changelog:
[Internal] - Bump iOS CI cache keys for the template

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

Test Plan: CircleCI is green

Reviewed By: christophpurrer

Differential Revision: D49458677

Pulled By: cipolleschi

fbshipit-source-id: 957bb5bcc5fe940b9ea08c3f0b9031a39cee37ff
2023-09-20 08:05:44 -07:00
Takanori Ishikawa deca8c56ee Use Map instead of object in BlobRegistry (#39528)
Summary:
issue: https://github.com/facebook/react-native/issues/39441

For the following reasons, I have replaced an object used for id management inside BlobRegistry with `Map`.

- The polyfill used for `fetch`, [whatwg-fetch](https://github.com/JakeChampion/fetch), returns responses as `Blob` objects.
- When a `Blob` is created, it is registered with blobID in the [BlobRegistry](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Blob/BlobRegistry.js), which is not automatically released.
- This issue was previously reported in https://github.com/facebook/react-native/issues/19248 and was fixed by modifying whatwg-fetch. However, with the implementation of automatic garbage collection in https://github.com/facebook/react-native/issues/24405, the implementation was reverted in commit bccc92dfdd, returning to the original behavior.
- Although https://github.com/facebook/react-native/issues/24405 enables `Blob` objects to be garbage collected, the Blob IDs registered in the BlobRegistry remain, causing the count to increase each time `fetch` is called.
- As a result, the `Property storage exceeds 196607 properties` error occurs

To address this issue, I have modified the implementation of `BlobRegistry` to use a `Map` instead of an object. By using a `Map`, there is no limit to the number of entries.

## Changelog:

[Internal] - [Fixed] - Fixed a bug that caused a "Property storage exceeds 196607 properties" error when sending a certain number of `fetch` requests.

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

Test Plan:
I've added a new tests in `packages/react-native/Libraries/Blob/__tests__/BlobRegistry-test.js` and confirmed the test pass before and after changes.

```
$ yarn run test
...
Test Suites: 1 skipped, 219 passed, 219 of 220 total
Tests:       2 skipped, 4017 passed, 4019 total
Snapshots:   1154 passed, 1154 total
Time:        10.525 s
Ran all test suites.
  Done in 12.52s.
```

Reviewed By: javache

Differential Revision: D49423213

Pulled By: NickGerleman

fbshipit-source-id: d5f73d7f5e34d1d2c3969b7dfbc45d3e6196aa30
2023-09-20 06:49:04 -07:00
Kudo Chien b9f0bdd12d Remove xcode 15 workaround for boost (#39555)
Summary:
Remove Xcode 15 `_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION` workaround for boost. If we update boost, we don't need the workaround anymore.
This PR is based on https://github.com/facebook/react-native/issues/39552. Not sure how Meta internally deal with stacked PRs. This PR just adds a new commit based on https://github.com/facebook/react-native/issues/39552 anyway.

## Changelog:

[IOS][CHANGED] - Remove Xcode 15 `_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION` workaround for boost

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

Test Plan: RNTester + Xcode 15

Reviewed By: cortinico

Differential Revision: D49454494

Pulled By: cipolleschi

fbshipit-source-id: aacabaa130b61598cf8bd206fdbb96d3b50ba74f
2023-09-20 06:03:54 -07:00
almouro 2f86aafdfd Fix scrollview momentum not stopping on scrollTo/scrollToEnd for horizontal scrollviews (#39529)
Summary:
### Motivation
My main motivation for this is using nested horizontal `Flashlists` inside a vertical `Flashlist`.
Like a `RecyclerView`, since my horizontal lists get recycled, if I scroll say the first horizontal list and scroll down, then when this list gets recycled it continues scrolling even if the content is new:

![nested-list-recycling](https://github.com/facebook/react-native/assets/4534323/f75a2a9b-6ab5-4554-811f-8d85ddfb81de)

To handle this, I want to call `scrollTo` everytime a new row appears to reset the scroll offset, however I've realized this doesn't stop the scroll momentum

### The bug

When scrolling and calling `scrollTo`, scroll momentum should be stopped and we should scroll to where `scrollTo` asked for.
All credit goes to tomekzaw for https://github.com/facebook/react-native/pull/36104 who fixed it for vertical scrollviews

I realized we had the same issue for
- horizontal scroll views
- when calling `scrollToEnd`

| Vertical scrollview (working ) | Horizontal scrollview (before fix, not stopping ) | Horizontal scrollview (after fix )|
|--------|--------|--|
| ![vertical-scrolltoffset-working](https://github.com/facebook/react-native/assets/4534323/884d95ce-9b09-47aa-99a7-99ca579a8fc4)|![horizontal-scrolloffset-bug](https://github.com/facebook/react-native/assets/4534323/0065a9d0-f905-4354-9caa-29a0a1f914ba)|![horizontal-scrolloffset-fixed](https://github.com/facebook/react-native/assets/4534323/ab49c356-23e8-464a-83a9-c4632b9d673e)|

Based on  https://github.com/facebook/react-native/pull/38728 I kept all those calls to `abortAnimation` on the View Manager

## Changelog:

[ANDROID] [FIXED] - Fixed horizontal ScrollView momentum not stopping when calling scrollTo programmatically
[ANDROID] [FIXED] - Fixed ScrollView momentum not stopping when calling scrollToEnd programmatically

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

Test Plan:
My test code is [this](https://gist.github.com/Almouro/3ffcfbda8e2239e64bee93985e243000)
Basically:
- a scrollview with a few elements
- some buttons to trigger a `scrollTo`

To reproduce the bug, I scroll then click one of the buttons triggering a `scrollTo`

I added `react-native@nightly` to my project, and copy pasted `packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/scroll` folder from this branch to try out my fixes

Then tested the following scenarios on Android:

| List layout  | Method | Not animated | Animated|
|--------|--------|--|--|
| horizontal | scrollTo | ![horizontal-scrollTo-no](https://github.com/facebook/react-native/assets/4534323/bda87a19-43cf-4fe9-9340-f70a3d5cd6a4)| ![horizontal-scrollto-yes](https://github.com/facebook/react-native/assets/4534323/8628d7ff-ee28-4185-81d1-1783f0fd990f) |
| horizontal | scrollToEnd  |![horizontal-scrolltoend-no](https://github.com/facebook/react-native/assets/4534323/594bb539-cb27-4234-8a8f-74d5b2bbe25f) | ![horizontal-scrolltoend-yes](https://github.com/facebook/react-native/assets/4534323/7366abcd-95fb-42ab-89e1-38fd4b10d966)|
| vertical | scrollTo | ![vertical-scrollto-no](https://github.com/facebook/react-native/assets/4534323/54555250-d4df-4bc2-b20f-46c706e8c726)|![vertical-scrollto-yes](https://github.com/facebook/react-native/assets/4534323/0c109f81-0bbd-475b-90f1-f1467317c799) |
| vertical | scrollToEnd  | ![vertical-scrolltoend-no](https://github.com/facebook/react-native/assets/4534323/f48c8196-8f2f-4d98-b750-91c067d1a063) | ![vertical-scrolltoend-yes](https://github.com/facebook/react-native/assets/4534323/04bb06dc-7e20-40de-a40d-e1da1fec491a)|

Reviewed By: javache

Differential Revision: D49437886

Pulled By: ryancat

fbshipit-source-id: 358c9b0eed7dabcbc9b87a15d1a757b414ef514b
2023-09-20 04:28:08 -07:00
Alex Hunt 196b3f9ef9 Improve start command interactive behaviour (#39544)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39544

Misc improvements to `npx react-native start` interactive behaviour:

- Attaches key handlers on Metro `initialize_done` event — printing key command info earlier (once the server starts listening to bundle requests).
- Shutdown behaviour:
    - Awaits closing of Metro's HTTP server.
    - Pauses key listener while awaiting shutdown (dependency on `cli-tools` `addInteractionListener` dropped).
    - Now observes `ctrl+d` (`ctrl+z` pause behaviour removed).
- Updates reload handler message to 'Reloading connected app(s)...' (since ).
- Adds newline below key commands printout (even spacing).

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D49422206

fbshipit-source-id: 8963b22ddb182df7a1116906fc63cc65bfe982fc
2023-09-20 03:47:13 -07:00
Phillip Pan 7888338295 Back out "fix: return the correct default trait collection"
Summary:
Original commit changeset: f069fea8918f

Original Phabricator Diff: D49186069

bypass-github-export-checks

theory: getKeyWindowTraitCollection could get run in an async block, so there's a race to set the value. currently it gets read as nil on the first attempt

Reviewed By: sammy-SC

Differential Revision: D49449392

fbshipit-source-id: 3c71403fb30fa873a49bdc754c77797ed292a3f0
2023-09-20 01:33:46 -07:00
Arushi Kesarwani 982f6f99d4 Upgrade Metro to 0.79.1 in RN (#39273)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39273

Upgrade Metro dependencies to 0.79.1 in `react-native`

This includes Metro breaking changes for disabling global package resolution by default and adds features like: Haste packages, enable resolution through symlinks and passing custom customTransformOptions and customResolverOptions to bundle_build_started log event so as to refine the bundling message. It also fixes arbitrary transformation of Babel plugins during registration in `metro-babel-register` and fixes "unexpected null" crash when handling a batch of file changes and symlinks with indirections.

**Full Metro Changelog:** https://github.com/facebook/metro/releases/tag/v0.79.1
https://github.com/facebook/metro/releases/tag/v0.79.0

Changelog:
[General][Changed] Upgraded Metro to 0.79.1

Reviewed By: motiz88, mdvacca

Differential Revision: D48922815

fbshipit-source-id: 37aea6194fe587e0d094c96ceec1122c588f0fbb
2023-09-19 21:42:33 -07:00
Nick Gerleman ebcd1ab1ab C++ style enums 15/N: Display (#39541)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39541

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

Moves internal usages of YGDisplay to Display

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D49361952

fbshipit-source-id: a961efaa35a3fed01659d23783bf90e0b47656f0
2023-09-19 16:30:02 -07:00
Nick Gerleman e2e6895ea0 C++ style enums 14/N: Overflow (#39537)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39537

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

Moves internal usages of YGOverflow to Overflow

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49361843

fbshipit-source-id: 42161aa8a26f64f052587b861120cdad0290ae46
2023-09-19 16:30:02 -07:00
Nick Gerleman c1cda3e64d C++ style enums 13/N: Wrap (#39539)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39539

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

Moves internal usages of YGPositionType to PositionType

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49361746

fbshipit-source-id: ccc77b4c77753b5f41e11f1849d4c02153c190b7
2023-09-19 16:30:02 -07:00
Nick Gerleman aa8caf0641 C++ Style enums 12/N: PositionType (#39538)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39538

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

Moves internal usages of YGPositionType to PositionType

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49361677

fbshipit-source-id: 526222d6cf9f3dc26eddfbfb8a04de4ba28e14a9
2023-09-19 16:30:02 -07:00
Nick Gerleman 1000afccaa C++ style enums 11/N: Align (#39497)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39497

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

Moves internal usages of YGAlign to Align

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49337511

fbshipit-source-id: bb9906fcd22780d2cfd8d1360ef69f66b9701bb6
2023-09-19 16:30:02 -07:00
Nick Gerleman e767b21855 C++ style enums 10/N: Justify (#39498)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39498

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

Moves internal usages of YGJustify to Justify.

bypass-github-export-checks

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49336538

fbshipit-source-id: 6deb2438e3cd2989c8212ee294fd0fe4819f40ab
2023-09-19 16:30:02 -07:00
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