Commit Graph

38536 Commits

Author SHA1 Message Date
Lorenzo Sciandra caa3fd83a6 fix(e2e script): fix the script post monorepo & metro-config work (#36836)
Summary:
Just backporting to main a couple of fixes we've done in the 0.72 branch plus removing the old bash script to avoid confusion (since now it's more broken than ever)

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

[INTERNAL] [FIXED] - fix the local e2e script post monorepo & metro-config work

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

Test Plan:
Run `yarn test-e2e-local` successfully, both for RNTester & RNTestProject scenarios.

Here's a screenshot if RNTestProject working successfully:
<img width="1501" alt="Screenshot 2023-04-06 at 14 20 54" src="https://user-images.githubusercontent.com/16104054/230394301-49ea5752-27ad-4800-b56e-004fd88e9c44.png">

Reviewed By: rshest

Differential Revision: D44748037

Pulled By: cipolleschi

fbshipit-source-id: d00438bd766e8f228120f7bbceef2013cf9c966f
2023-04-06 08:01:54 -07:00
Nicola Corti f874a7e7d3 Update react-native-xcode.sh to do not point users towards our issue … (#36837)
Summary:
Pointing users towards our issue tracker is not really effective as the underlying issue is a misconfiguration of their environment. I'm tweaking this error message.

## Changelog:

[INTERNAL] - Update react-native-xcode.sh to do not point users towards our issue …

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

Test Plan: n/a just a string change

Reviewed By: cipolleschi

Differential Revision: D44748094

Pulled By: cortinico

fbshipit-source-id: 6d960268eb7324b86ff5e4d3d5ddf4bbe67c2349
2023-04-06 07:37:13 -07:00
Nicola Corti 01100a2fc8 Rename cleanAll to clean and refine it (#36832)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36832

We used to use `cleanAll` instead of `clean` to do cleaning of everything due to a bug on AGP on how clean was performed.
The bug is resolved, so we can now use `clean` properly.
Moreover, we have sporadic failures when the codegen/lib/ folder is not cleaned up. This fixes it.

Changelog:
[Internal] [Changed] - Rename cleanAll to clean and refine it

Reviewed By: cipolleschi

Differential Revision: D44745849

fbshipit-source-id: 4da5d34bcb0ee5c9f6b0e0f4e5b919bcc3171270
2023-04-06 05:54:15 -07:00
Vincent Viego 49f1237526 Rename FabricMountItem.* to MountItem.* (#36722)
Summary:
Changelog: [Android] [Breaking] - Renamed FabricMountItem.* files to MountItem.* to better match the name of the struct.

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

Reviewed By: cortinico, cipolleschi

Differential Revision: D44540079

fbshipit-source-id: 79d8aa7c6f6b908be52009c51c4ea2f601f788fd
2023-04-06 05:03:22 -07:00
Genki Kondo 08588538fe Introduce RCTObjectAnimatedNode (#36804)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36804

AnimatedObject is a more generic version of AnimatedTransform, able to handle animated values within arrays and objects. This is useful for props of native components that may need to be animated per field.

This diff adds the native (iOS) counterpart to AnimatedObject node in JS. The node handles array and map value types.

Changelog:
[Internal][Added] - Introduce ObjectAnimatedNode iOS-side node for handling array and object prop values

Reviewed By: philIip

Differential Revision: D44678162

fbshipit-source-id: 7cdc075229a55fcb450f23ba5667b3ddd48c24df
2023-04-05 16:22:44 -07:00
Vincent Riemer 54a6922bdc Add plumbing/boilerplate for an iOS implementation of the click event (#36615)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36615

Changelog: [Internal] - Add plumbing/boilerplate for an iOS implementation of the `click` event

This diff simply adds the boilerplate necessary to hook up a click event to the fabric iOS touch handler. This diff does not contain any actual implementation of the click's behavior as that will occur in future diffs.

Reviewed By: necolas

Differential Revision: D43129366

fbshipit-source-id: 71488b893c789d21c833533471745275062c0730
2023-04-05 15:00:05 -07:00
Zihan Chen (MSFT) 9bb71650c9 Add @react-native/codegen-typescript-test to verify .d.ts files in @react-native/codegen (1) (#36562)
Summary:
- Add a typescript project to test `CodegenSchema.d.ts`. More tests for other .d.ts files will be added in future pull requests.
- The build script scans all snapshots from `react-native/codegen`'s typescript frontend and generates .ts files for each snapshot, but they are .gitignore-ed.
- `npm run build` will build these .ts files against `CodegenSchema.d.ts` after generating them.
- A failed jest case is included to ensure CI catch it, it will be removed before merged.

bypass-github-export-checks

## Changelog:

[General] [Added] - Add react-native/codegen-typescript-test to verify .d.ts files in react-native/codegen (1)

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

Test Plan:
`npm run build` in `packages/react-native-codegen-typescript-test` and see all test files appear in `__generated__`.

## Screenshot

![Untitled](https://user-images.githubusercontent.com/53799235/226757755-cab4cb29-7d22-46a1-9ecb-d6732122ed38.png)

Reviewed By: rshest

Differential Revision: D44292277

Pulled By: cipolleschi

fbshipit-source-id: 8d79fe913f9563d64c92aae7c4f4e97a24ae9a21
2023-04-05 07:38:25 -07:00
Genki Kondo a248456d18 Introduce ObjectAnimatedNode (#36742)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36742

AnimatedObject is a more generic version of AnimatedTransform, able to handle animated values within arrays and objects. This is useful for props of native components that may need to be animated per field.

This diff adds the native (Android) counterpart to AnimatedObject node in JS. The node handles array and map value types.

Changelog:
[Internal][Added] - Introduce ObjectAnimatedNode Java-side node for handling array and object prop values

Reviewed By: mdvacca

Differential Revision: D44466563

fbshipit-source-id: bd026cbd921ec51ae17eab08417708f3272c0418
2023-04-05 07:27:38 -07:00
Janic Duplessis 1f384f75da Add fabric support for maintainVisibleContentPosition on Android (#35994)
Summary:
Implement a few missing bits for `maintainVisibleContentPosition` to work with fabric. The main thing needed is to add 2 fabric renderer listener methods to allow to hook into specific parts of the rendering process. We need some code to execute before view updates are executed and after view updates are executed. The current methods that are exposed do not work for this case. `willDispatchViewUpdates` is called from JS thread, and there doesn't seem to be a way to add UI blocks that will be executed at the right time like we do in paper. `didDispatchMountItems` is called for every frame which we don't want and will cause lots of overhead.

After that we simply need to call the right methods in the new renderer listener methods.

## Changelog

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

Pick one each for the category and type tags:

[ANDROID] [ADDED] - Add fabric support for maintainVisibleContentPosition on Android

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

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

Test Plan: Tested in RN tester maintainVisibleContentPosition example on Android with fabric enabled.

Reviewed By: cipolleschi

Differential Revision: D44131763

Pulled By: cortinico

fbshipit-source-id: 32c0b5867d460537b18a70d472fd58052da6cf80
2023-04-05 07:09:33 -07:00
Antoine Doubovetzky 8fbcfcea8d Extract throwIfConfigNotfound and throwIfMoreThanOneConfig from findComponentConfig function (#36719)
Summary:
This PR contains tasks 96 and 97 from https://github.com/facebook/react-native/issues/34872:

>[Codegen 96 - assigned to AntoineDoubovetzky] Create a throwIfConfigNotfound in the error-utils.js file and extract the error code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L61-L63) and [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L62-L64)
 [Codegen 97 - assigned to AntoineDoubovetzky] Create a throwIfMoreThanOneConfig in the error-utils.js file and extract the error code from [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L64-L66) and [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L65-L67)

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

[Internal] [Changed] - Extract throwIfConfigNotfound and throwIfMoreThanOneConfig from findComponentConfig function

bypass-github-export-checks

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

Test Plan: I tested using Jest and Flow commands.

Reviewed By: rshest

Differential Revision: D44539681

Pulled By: cipolleschi

fbshipit-source-id: c778ad1620d1c3f60b10c25c51efcb11173b3037
2023-04-05 06:55:47 -07:00
Gijs Weterings edc5ea11bb Add Meta header to xplat/js/react-native-github/tools/build_defs/oss/preload.bzl (#36814)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36814

Working through the backlog of failing open source requirements (T139285789). Most files that are violating Copyright rules are due to the exemptions being outdated, but this file actually needs a header.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D44705585

fbshipit-source-id: 0319be3be0726a76cd98448205f5af76343ad356
2023-04-05 06:55:34 -07:00
Finn Pauls f0893cf72f Support font-variant-ligatures values (#36740)
Summary:
The text style prop `fontVariant` in React Native is supposed to map to the CSS `font-variant` property. The CSS property is a short-hand for the following CSS properties:

- [font-variant-alternates](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-alternates)
- [font-variant-caps](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-caps)
- [font-variant-east-asian](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-east-asian)
- [font-variant-emoji](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-emoji)
- [font-variant-ligatures](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-ligatures) 👈
- [font-variant-numeric](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-numeric)
- [font-variant-position](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-position)

Currently React Native only supports a subset of the values from `font-variant-numeric` and `font-variant-caps`.

This change increases the `font-variant` support by adding all values from `font-variant-ligatures`.

## Changelog:

[iOS] [Added] - Add all fontVariant values for font-variant-ligatures
[Android] [Added] - Add all fontVariant values for font-variant-ligatures

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

Test Plan:
See https://github.com/facebook/react-native/pull/36740#issuecomment-1492546631
## Resources
- [Apple True Type Reference](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html)
- [Webkit Source Code](https://opensource.apple.com/source/WebCore/WebCore-7602.1.50.1.1/platform/graphics/cocoa/FontCacheCoreText.cpp)
- [MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/CSS/font-variant-ligatures)
- [Android TextView Documentation](https://developer.android.com/reference/android/widget/TextView#setFontFeatureSettings(java.lang.String))

Reviewed By: cipolleschi

Differential Revision: D44705513

Pulled By: cortinico

fbshipit-source-id: 1cde5fcc23ba99fd2f98fa73d934c8e51b0d292e
2023-04-05 06:16:15 -07:00
Nicola Corti de2f01d9d7 Do not store scripts inside .github/workflows (#36811)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36811

Editing frequently the `.github/workflow` folder makes harder to use the
`/rebase` command as it fails if there are edits to such folder in the middle
of a rebase.
I'm moving the .js files outside of that folder.

Changelog:
[Internal] [Changed] - Do not store scripts inside .github/workflows

Reviewed By: sshic

Differential Revision: D44705878

fbshipit-source-id: a8007d6c126dbda2a1ee9d8cb0397df5df43fd63
2023-04-05 05:25:35 -07:00
Rubén Norte 1476d99048 Extract ReactFabricHostComponent into a separate module
Summary:
Small refactor in preparation for adding `ReactNativeElement` as an alternative implementation for `ReactFabricHostComponent`.

Changelog: [internal]

bypass-github-export-checks

Reviewed By: yungsters

Differential Revision: D44299619

fbshipit-source-id: b1bc43f6a6ae5b75dca43d7e08cd15acdc49bb79
2023-04-05 04:59:46 -07:00
Rubén Norte 4bff977869 Add behavior from React repo to FabricUIManager mock
Summary:
We recently added an implementation of the native binding for UIManager (`global.nativeFabricUIManager`) in JavaScript. This brings the logic we had in that mock in the React repository so we can properly use it for testing (as integration tests instead of unit tests).

Changelog: [internal]

bypass-github-export-checks

Reviewed By: yungsters

Differential Revision: D44298377

fbshipit-source-id: 6085df93993302c2ddce7220c73e614ad6301667
2023-04-05 04:59:46 -07:00
Nicola Corti d1174535f7 Remove the update-ruby script as it's now unnecessary (#36802)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36802

As we now support a broader range of ruby version, we don't need `update-ruby.sh` anymore
and we also don't need to call it during the set-rn-version script.

Changelog:
[Internal] [Changed] - Remove the update-ruby script as it's now unnecessary

Reviewed By: cipolleschi

Differential Revision: D44670361

fbshipit-source-id: b23abab28ccbd27408e4d76670101faeb463bc6b
2023-04-05 03:50:40 -07:00
Pieter De Baets 58ee6b2f7a Remove unused fields from AndroidTextInputState (#36797)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36797

defaultParentShadowView and defaultTextAttributes are never used

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D44665067

fbshipit-source-id: 5e607ab323020bef5c9708a6e683582ac47acb2a
2023-04-05 02:33:21 -07:00
Samuel Susla deaef09d7f Avoid double assignment of runtime scheduler (#36801)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36801

changelog: [internal]

This looks like a typo.

Reviewed By: cipolleschi

Differential Revision: D44670852

fbshipit-source-id: 59891a6256be366601e4791a733df9b68e8c2a68
2023-04-05 01:45:32 -07:00
Genki Kondo 7aa9936835 Modify AnimatedProps and AnimatedStyle to use AnimatedObject (#36798)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36798

AnimatedObject is a more generic version of AnimatedTransform, able to handle animated values within arrays and objects. This is useful for props of native components that may need to be animated per field.

This diff hooks up AnimatedObject to AnimatedProps and AnimatedStyle for values that are arrays or objects.

Changelog:
[Internal][Added] - Modify AnimatedProps and AnimatedStyle to use AnimatedObject

Reviewed By: rshest

Differential Revision: D44637985

fbshipit-source-id: c70b9d40e40d0782c2c1a332f1f22358fe0abe64
2023-04-04 18:37:20 -07:00
Brian Long 816598975c ObjectPreview support (#36785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36785

D43553742 adds support for ObjectPreviews in CDP messages; this diff implements support in the Inspector for honoring generatePreview requests and returning ObjectPreviews in the relevant request messages.

Changelog: [Internal]

Reviewed By: mattbfb

Differential Revision: D44522932

fbshipit-source-id: 216debe36b4e61c822fa3ae513e5eba399fad019
2023-04-04 18:29:08 -07:00
Olga Zinoveva d038e4e3bf Add github workflow for automatic API, topic, and component labeling of issues (#36712)
Summary:
Adding a new github workflow script, which will run as part of the existing triage job that is triggered when an issue is  labeled with the "Needs: Triage" label (this typically happens automatically when the issue is created).
This script will add an extensive list of possible labels corresponding to APIs, components, and topics (see the code for the full list).
The motivation for this change is to replace the last bit of meaningful functionality performed by react-native-bot, which will allow us to decommission that bot in favor of using github workflows for all issue and PR automation.

## Changelog:

[INTERNAL] [CHANGED] - Updated API, topic, component labeling on issues to run from a GH workflow rather than an external bot action

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

Test Plan:
For examples of issues being labeled by this new script, see the open issues here: https://github.com/SlyCaptainFlint/react-native/issues
I did not test every possible label, but I tested at least one from each category (API, component, topic), and a combination of one or two of each.

Reviewed By: cortinico, cipolleschi

Differential Revision: D44593658

Pulled By: SlyCaptainFlint

fbshipit-source-id: 93758d05a70d02bed76ab0b6149271e757e0a12f
2023-04-04 15:49:01 -07:00
Dmitry Rykun fdbc89d10b Re-land "[react-native][PR] [Upstream][Security] Use execFileSync over exec for cases with uncontrolled absolute paths" (#36791)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36791

This is a re-land of D44635949. It was reverted as it was a suspected cause of CircleCI fails. It turned out the diff was unrelated, and the cause was something else.

## Changelog
[Internal][Security] - Use execFileSync over exec for cases with uncontrolled absolute paths

Reviewed By: cortinico

Differential Revision: D44663132

fbshipit-source-id: dfb3d09dbfbe3312ef54bcbbc43c8b4062d787a8
2023-04-04 15:17:44 -07:00
Brian Long de35e2881e msggen support for cdp previews (#36781)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36781

----

Add support to msggen for types like:

* Runtime.CustomPreview
* Runtime.EntryPreview
* Runtime.ObjectPreview
* Runtime.PropertyPreview

And their related use as properties.

There was quite a gap here. The work involves:

* Upgrade devtools-protocol to 0.0.1107588 even pick up the schema definitions in the first place.
* Next problem: all the preview stuff is experimental. Had to add support to --include-experimental flag for targeting types AND properties.
* Next problem: the protocol schema for previews is cyclical. ObjectPreview refers to PropertyPreview and EntryPreview, which both refer back to ObjectPreview. msggen only allowed for DAGs. Added support for allowing cycles.
* Next problem: Forward declarations are not enough to compensate for the cyclical references, because of the incomplete type definitions. This breaks optional, vector, and simple containment. To address this:
  * In the graph traversal code, where before we would error if the graph had a cycle, we allow for the cycle, but record the cyclical reference from a property on Type B's to Type A.
  * Whenever we emit the definition of Type B, its references to Type A are not naked, they are now wrapped in a unique_ptr.
  * However, because the unique_ptr only has a forward declaration, and not a complete type, we need to specify a custom deleter.
* Next problem: There are lots of cases where these types that now contain unique_ptrs were being copied, which no longer works. So, make all these codegen'd types move-only, and change a few places where were copying root objects, to move them instead.
* Many tests required changes to avoid copy construction/assignment that were occuring. MessageTypes are not copyable construcrtible/assignable now.

Changelog: [Internal]

Reviewed By: jpporto

Differential Revision: D43553742

fbshipit-source-id: 1e4c495aa600feb6f1901e6bc013d517ba8d8a2d
2023-04-04 14:17:43 -07:00
Phillip Pan aa15fd44a6 decouple DialogModuleTest from PowerMock (#36778)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36778

Changelog: [Internal]

we can just use mockito for this suite

Reviewed By: mdvacca

Differential Revision: D44603023

fbshipit-source-id: b8f6f37fccba38990fe498d8f5e479f174ff93af
2023-04-04 13:49:37 -07:00
Dmitry Rykun 62c4da1421 Bump activesupport to 6.1.7.3 to address CVE-2023-28120 (#36803)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36803

Changelog:
[Internal][Changed] - Bump activesupport to 6.1.7.3 to address CVE-2023-28120

Reviewed By: christophpurrer

Differential Revision: D44673150

fbshipit-source-id: 3df10132c7da2d22956edb7193db963cdf0b5f54
2023-04-04 12:49:17 -07:00
David Vacca c0b4883058 Deprecate and mark for removal com.facebook.react.common.StandardCharsets (#36779)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36779

Deprecate and mark for removal com.facebook.react.common.StandardCharsets, this class was originally created because java.nio.charset.StandardCharsets only exists in Android API level 19+

As part of this diff I also migrate all internal usages of  com.facebook.react.common.StandardCharsets

Changelog:
[Android][Deprecated] - Deprecate and mark for removal com.facebook.react.common.StandardCharsets, please use java.nio.charset.StandardCharsets instead

Reviewed By: rshest

Differential Revision: D44592721

fbshipit-source-id: c3f4286766209a733b466d19dc36891f12d69be1
2023-04-04 10:43:56 -07:00
Nicola Corti 990971186f Fix a crash new app template when createRootView is invoked with null bundle (#36796)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36796

As the title says, this fixes a instacrash on template when `createRootView` is invoked with
a bundle being null. The crash was happening as the parameter, despite being not used, is
specified as `Bundle` and is not nullable. When the Java caller passes `null`, the app crashes.

Changelog:
[Android] [Fixed] - Fix a crash new app template when `createRootView` is invoked with null bundle

Reviewed By: cipolleschi

Differential Revision: D44668305

fbshipit-source-id: 1150ddac26f19765e7340878c8850d8462c6f3fd
2023-04-04 09:40:57 -07:00
Lorenzo Sciandra efef8ebc5e add 0.71.6, 0.70.8 and 0.69.9 changelog (#36792)
Summary:
Adds changelog for new patches.

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

[Internal] [Changed] - add changelog entry for 0.71.6, 0.70.8 and 0.69.9

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

Test Plan: N/A

Reviewed By: cortinico

Differential Revision: D44663440

Pulled By: cipolleschi

fbshipit-source-id: d84e997784c1ecfb02968fecf147b2ef558d4381
2023-04-04 07:47:46 -07:00
Rubén Norte 28dac6108f Implement ReactNativePrivateInterface.createPublicTextInstance
Summary:
This exposes a new method in the private interface used by React so we can merge https://github.com/facebook/react/pull/26516

We're adding support for text instances in React Native (as defined in https://github.com/react-native-community/discussions-and-proposals/pull/607). See D44632362 for the full implementation.

Changelog: [internal]

bypass-github-export-checks

Reviewed By: sammy-SC

Differential Revision: D44663223

fbshipit-source-id: 70ca3ca9d2edefaa73a396f43c2d560c6d1422f1
2023-04-04 06:34:55 -07:00
Riccardo Cipolleschi 904d56cfa3 bump CLI to 12.0.0-alpha.0 (#36793)
Summary:
Yesterday, CLI published version 11.1.1 which has a strong dependency on `react-native/metro-config` 0.72.
On `main`, all the packages we publish to test the template have version 0.73.
So, when running tests on the template, the cli was looking for a `metro-config` version 0.72, but it could not find it as verdaccio
only has version 0.73.

Together with Callstack, we released a version 12.0.0-alpha.0 of the CLI which have the right dependency on metro-config v0.73, so that
our CI can be green again.

bypass-github-export-checks

## Changelog:

[General][Fixed] - Bumped CLI dependency on main to 12.0.0-alpha.0

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

Test Plan: CircleCI must be green

Reviewed By: huntie

Differential Revision: D44663381

Pulled By: cipolleschi

fbshipit-source-id: 30d341d55243318ce278a6e67a9e77ccfb90cafd
2023-04-04 06:14:35 -07:00
Phillip Pan bece6500f7 Back out "Use execFileSync over exec for cases with uncontrolled absolute paths" (#36780)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36780

Original commit changeset: 8e0ebb070768

Original Phabricator Diff: D44131032

Changelog: [Internal]

all the circleCI template tests started failing after this commit, revert!

Reviewed By: jacdebug, cortinico

Differential Revision: D44635949

fbshipit-source-id: 429167acdbee3ebf6d81491ac65896c534c18fd0
2023-04-03 14:14:09 -07:00
Krystof Woldrich 12a102b926 Add error reporting examples to rn-tester turbo modules (#36729)
Summary:
This PR is adding examples of Turbo Modules functions throwing runtime exceptions and asserts. This should make it easier to collaborate and develop the error reporting for a new architecture that is being discussed in the React Native New Architecture Working Group -> https://github.com/reactwg/react-native-new-architecture/discussions/122.

I'm not sure what return type should be used for the JS function returning `Promise<void>` in Cxx, I used [`AsyncPromise<jsi::Value>`](https://github.com/facebook/react-native/pull/36729/files#diff-9cebc75f48fd35fd6fef71138f98dfd0ba28a754b2aab0d6fe44fd685f74ce16R135), what would you use, I've not found `void` type to use?

### Added functions

The table shows the current behavior.

<table>
<tr>
	<td> Function
	<td> Description
	<td> Turbo Module
	<td> Cxx Module
<tr>
	<td> voidFuncThrows
	<td> function with return type void throws a runtime exception
	<td> platform error no JS stack trace
	<td> JS error no native stack trace
<tr>
	<td> getObjectThrows
	<td> function with return type object throws a runtime exception
	<td> JS error no platform stack trace
	<td> JS error no native stack trace
<tr>
	<td> promiseThrows
	<td> function with return type promise throws a runtime exception before settling the promise
	<td> platform error no JS stack trace
	<td> JS error no native stack trace
<tr>
	<td> voidFuncAssert
	<td> function with return type void asserts
	<td> platform error no JS stack trace
	<td> native error no JS stack trace
<tr>
	<td> getObjectAssert
	<td> function with return type object asserts
	<td> JS error no platform stack trace
	<td> native error no JS stack trace
<tr>
	<td> promiseAssert
	<td> function with return type promise asserts before settling the promise
	<td> platform error no JS stack trace
	<td> native error no JS stack trace
</table>

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

[INTERNAL] [ADDED] - Error reporting examples in rn-tester turbo modules

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

Test Plan:
This PR doesn't change any RN behavior. Only shows the current state by adding an example to rn-tester.

I'm happy to add these examples to the unit/integration test, just point me to where would be a good place.

Reviewed By: rshest

Differential Revision: D44623027

Pulled By: javache

fbshipit-source-id: d9cc04852b05d810ed11d7a94f1b2d455ef554a5
2023-04-03 08:34:59 -07:00
Saad Najmi dc289737a8 Use execFileSync over exec for cases with uncontrolled absolute paths (#36491)
Summary:
In our fork React Native macOS, we run [Github's CodeQL ](https://codeql.github.com) to analyze for vulnerabilities. One common one that comes up is the use of `exec` with an uncontrolled absolute path (Example: https://github.com/microsoft/react-native-macos/security/code-scanning/14). The very simple fix to this is to replace calls to `exec` with `execFileSync`, which more or less does the same thing (but more securely!).

## Changelog

[INTERNAL] [SECURITY] - Use `execFileSync` over `exec` for cases with uncontrolled absolute paths

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

Test Plan: CI should pass

Reviewed By: cipolleschi

Differential Revision: D44131032

Pulled By: dmytrorykun

fbshipit-source-id: 8e0ebb07076838216f878f802ec937d2df44f33a
2023-04-03 08:32:30 -07:00
Ruslan Shestopalyuk 950472018d Separate buffering per entry type in WebPerformance (#36737)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36737

## Changelog:
[Internal] - Use `BoundedConsumableBuffer` in WebPerformance

This makes use of the `BoundedConsumableBuffer` container type, introduced in D44544057, for buffering/observing arbitrary performance entry types in `WebPerformance/PerformanceEntryReporter`, thus generalizing what was earlier done in an ad-hoc way for marks and measures, and also allowing to have both observable/retrievable/buffered property for arbitrary performance entry type (with the ultimate goal of adding custom entry types, related to e.g. startup timing, something that we currently have an ad hoc API for).

Reviewed By: sammy-SC

Differential Revision: D44574241

fbshipit-source-id: a858712ff1cf468914a80c99f6b82d060cb0b702
2023-04-03 06:13:16 -07:00
Ruslan Shestopalyuk 1387179b89 Implement specialized container type for performance entry buffering (#36726)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36726

## Changelog:
[Internal] -

This implements (together with unit tests) a generic container type, `BoundedConsumableBuffer` with the following properties:

 * It can only grow up to a specified max size
 * It's a circular buffer (the oldest elements are dropped if reached max size and adding a new element)
 * The entries can be "consumed" (once), which from the point of view of the consumer effectively clears the buffer
 * Even after the entries are consumed, all of the non-overwritten entries can still be independently retrieved an arbitrary amount of times

The buffer effectively wraps around when adding new elements. Once an element added, it becomes "consumable" (or "observable") and remains such, until all of the current outstanding elements are explicitly "consumed". It doesn't get immediately removed from the buffer, however (if max buffer size allows), and can be later retrieved via the `getEntries` API, until eventually overwritten.

{F928241747}

The goal is to use it for buffering performance entries in the native WebPerformance implementation, where the model is that the performance entries should be both buffered/observable, but also for certain performance entry types (such as marks, measures and potentially certain event types) should be possible to retrieve all of them at any time (regardless of whether they have already been observed or not).

In fact, this container is factoring that behavior, which is already there in `PerformanceEntryObserver` (but in an ad-hoc manner and only applicable to marks/measures), with the goal of being able to do it for any performance entry type.

Reviewed By: sammy-SC

Differential Revision: D44544057

fbshipit-source-id: 5b7d055a6fc813ebb0fb30f9b346723161774260
2023-04-03 06:13:16 -07:00
Samuel Susla 8b72c33742 Correct offset when drawing text to TextStorage coordinate system. (#36771)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36771

Changelog: [internal]

Previously, when `NSTextStorage` was cached, we were not accounting for case where text which was aligned to centre or left, was used to size its container.
The result was that it was painted outside of its container, therefore invisible. To fix this, we adjust the offset to make sure text is painted correctly.

This bug only happens if:
- Text is not aligned to left in right to left writing system.
- The canvas where text is drawn is not stretched to full width of its parent.
- The offset needs to be large enough for this to matter, otherwise the text is just slightly off.
- Because of the caching mechanism, it had to be a piece of text that was rendered before. Otherwise it would work.

This complexity is worth the trouble to avoid invalidation of layout inside NSTextContainer, which is expensive.

Reviewed By: cipolleschi

Differential Revision: D44624085

fbshipit-source-id: 1bb8ef88933a49b478a2606dba6bf16b4e728b2b
2023-04-03 05:19:28 -07:00
Samuel Susla a675dd7faf Only create NSAttributedString if NSTextStorage is nil (#36773)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36773

Changelog: [internal]

Do not construct `NSAttributedString` if `NSTextStorage` exists. Creating `NSAttributedString` is expensive and it isn't needed to measure text if `NSTextStorage` `exists`

Reviewed By: cipolleschi

Differential Revision: D44620292

fbshipit-source-id: 0827c514e40fcbd9626d2b7d7b6d28a3332d9aa1
2023-04-03 05:19:28 -07:00
Samuel Susla 9952dc2cc3 Extract NSTextStorage measure into a helper method (#36772)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36772

changelog: [internal]

Move NSTextStorage into a private method.

Reviewed By: cipolleschi

Differential Revision: D44620262

fbshipit-source-id: 4855879f3c3a09b2f352ab84c906c7bd106aebda
2023-04-03 05:19:28 -07:00
Riccardo Cipolleschi cb88e75cf1 Fix Cocoapods for Xcode 14.3.0 (#36759)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36759

On Thursday the 30th, Apple Released Xcode 14.3.0.
This Version of Xcode enforce some version checks for which React-Codegen, which supported iOS 11 as minimum supported version, could not be build anymore.

This change ensue that React-Codegen is always aligned to the min version supported by React Native.
Plus, it moves CircleCI's Xcode to 14.3.0, to keep this problem in Check.

While working on this, I figured that, with the monorepo, Ruby tests stopped working because they were in the wrong folder: I moved them in the right one.

## Changelog:
[iOS][Fixed] - Make React Native build with Xcode 14.3.0 and fix tests

Reviewed By: blakef

Differential Revision: D44605617

fbshipit-source-id: 3ec1f5b36858ef07d9f713d74eb411a1edcccd45
2023-04-02 03:32:15 -07:00
generatedunixname89002005232357 a2d2696e43 Revert D44153451: Multisect successfully blamed D44153451 for test or build failures (#36756)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36756

This diff is reverting D44153451
Depends on D44602279
D44153451: [Fabric][Android] Reduce visibility of FabricSoLoader by mdvacca has been identified to be causing the following test or build failures:

Tests affected:
- [xplat/endtoend/jest-e2e/apps/fb4a/__tests__/consumerwifi/venice/fb4aVeniceAddressSearch-e2e.js](https://www.internalfb.com/intern/test/281475007251570/)

Here's the Multisect link:
https://www.internalfb.com/multisect/1799601
Here are the tasks that are relevant to this breakage:

We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.

Reviewed By: mdvacca

Differential Revision: D44602284

fbshipit-source-id: 50b3b0f131c6c8c1eec3c23156b33559ffc3931e
2023-03-31 22:18:07 -07:00
Phillip Pan 86859e3e38 decouple ShareModuleTest from PowerMock (#36752)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36752

Changelog: [Internal]

as title! i'm not actually familiar enough with junit as to why the test infra cannot find `Arguments.java` since it is part of our framework, not something externally linked or an under the hood library, so if someone wants to explain that to me that'd be great

Reviewed By: cortinico, mdvacca

Differential Revision: D44527486

fbshipit-source-id: d94f4eebdb6b7cdf7e40e44bfec8703615b96963
2023-03-31 16:48:14 -07:00
Genki Kondo bee4ac85ae Revert D44315336: Modify AnimatedProps and AnimatedStyle to use AnimatedObject
Differential Revision:
D44315336

Original commit changeset: 4d543550f24a

Original Phabricator Diff: D44315336

fbshipit-source-id: 7a383ef3b42cbcf3d3db87fef5ebf3120ef47c38
2023-03-31 16:11:03 -07:00
David Vacca d2d2a8a598 Introduce NO_SURFACE constant to specify the lack of surfaces used by legacy system (#36747)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36747

Introduce NO_SURFACE constant to specify the lack of surfaces used by legacy system

changelog: [internal] internal

Reviewed By: sshic

Differential Revision: D44563649

fbshipit-source-id: 99c7028c5ee508c2982cefc9b3199a332c2346c7
2023-03-31 15:34:45 -07:00
David Vacca d2e591cb2b Fix lint warns (#36748)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36748

EZ refactor fixing some lint warnings

changelog: [internal] internal

Reviewed By: sshic

Differential Revision: D44465379

fbshipit-source-id: c02f1c8c2bb48c630a71362781c4c5c1093961ed
2023-03-31 15:34:45 -07:00
David Vacca fb920217a9 Reduce visibility of FabricSoLoader (#36749)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36749

Reduce visibility of FabricSoLoader

This is a breaking change, but nobody should be using this class

Changelog: [internal] internal

Reviewed By: javache, cortinico

Differential Revision: D44153451

fbshipit-source-id: 942c80da3987d3639b055804c24fc34543a99907
2023-03-31 15:34:45 -07:00
Enrico Bern Hardy Tanuwidjaja 2ab750f7bb Changing tab bar controller orientation to portrait
Summary:
Applying orientation from navigationOptions to the TabBarController

## Changelog
[iOS][Added] - Added conversion helper for UIInterfaceOrientationMask to RCTConvert

Reviewed By: philIip

Differential Revision: D44553533

fbshipit-source-id: e57c68c56f1184346bf02f5a915d7722660902ff
2023-03-31 14:06:28 -07:00
Phillip Pan 4890d50edd introduce shadows helper library for robolectric (#36733)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36733

Changelog:
[Android][Added] - Added testing shadow helpers for robolectric

in this change, i'm creating a centralized place for test writers to add their shadows in robolectric. as we start deprecating powermock, we can expect that common infra classes will be needed to be stubbed out, so we can leverage this library in order to do so.

Reviewed By: javache

Differential Revision: D44565806

fbshipit-source-id: 2e322861e8e2f49ede21e4a000495d5f06b911d3
2023-03-31 12:47:40 -07:00
Genki Kondo 47149d2e44 Calculate entered/exited views during handling of all MotionEvents (#36666)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36666

Modify JSPointerDispatcher to dispatch out/over/leave/enter events on handing of any MotionEvent. This functionality is in parity with [how touch events are handled in iOS](https://www.internalfb.com/code/fbsource/[cdfd2520a4d43b3a46104ecbf437bb792460e3f7]/xplat/js/react-native-github/packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm?lines=780).

handleMotionEvent updates the last hit path upon any MotionEvent, so we want to make sure that we handle any out/over/leave/enter dispatches in this method. This diff just extracts the dispatching of out/over/leave/enter from onMove() to handleMotionEvent().

Changelog:
[Internal] - Calculate entered/exited views on all touch/move events

Reviewed By: javache, mdvacca

Differential Revision: D44426524

fbshipit-source-id: 5225c54c2c995440ac766c6fbc99c08f05c70a92
2023-03-31 12:01:24 -07:00
Genki Kondo d194ec8c11 Modify AnimatedProps and AnimatedStyle to use AnimatedObject (#36741)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36741

AnimatedObject is a more generic version of AnimatedTransform, able to handle animated values within arrays and objects. This is useful for props of native components that may need to be animated per field.

This diff hooks up AnimatedObject to AnimatedProps and AnimatedStyle for values that are arrays or objects.

Changelog:
[Internal][Added] - Modify AnimatedProps and AnimatedStyle to use AnimatedObject

Reviewed By: rshest

Differential Revision: D44315336

fbshipit-source-id: 4d543550f24adbfc2ce4b15640df03f260da6106
2023-03-31 11:58:04 -07:00
Genki Kondo 80fb995fac Modify Arguments.makeNativeObject to handle JavaOnlyMap and JavaOnlyArray (#36743)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36743

Changelog:
[Internal] - Modify Arguments.makeNativeObject to handle JavaOnlyMap and JavaOnlyArray

Reviewed By: mdvacca

Differential Revision: D44516305

fbshipit-source-id: 22a4de4ae1b231078e7cd59cda3993b9f6343f7d
2023-03-31 11:13:19 -07:00