Commit Graph
32109 Commits
Author SHA1 Message Date
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
Genki Kondo d0fcd43f1a Introduce AnimatedObject JS node (#36688)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36688

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.

I considered flattening the node graph by removing AnimatedStyle and AnimatedTransform. However, this would add significant complexity in AnimatedProps because prop and style values depend on being submitted together on an animation tick (such as transform) using native driver; also, we'll have to special case style anyway.

Changelog:
[Internal][Added] - Introduce AnimatedObject JS node for handling array and object prop values

Reviewed By: rshest

Differential Revision: D44279594

fbshipit-source-id: 9504d841dc9196e51d09a0247601de4d4f991a49
2023-03-31 10:16:36 -07:00
Pieter De Baets 64033637e2 Align Android EventEmitter naming (#36718)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36718

`EventEmitterWrapper` uses "invoke", while the event is still being queued and the event handler will only actually be "invoked" in another async step. Instead, align with the wrapped object and use "dispatch".

Also small optimization to construct the EventEmitterWrapper object fully in C++, without Java having to call back into C++ again by using `newObjectCxxArgs`.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D44536400

fbshipit-source-id: 7b14acf3629944f4a20ab4f509fbae7f58de98e0
2023-03-31 07:14:10 -07:00
Lulu Wu 606946ddad Check nullability for current context (#36721)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36721

We check RN instance immediately when onGlobalLayout is called in ReactRootView
https://www.internalfb.com/code/fbsource/[1f189dbb7238aa69319925bdc6a9e5389e160ad8]/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java?lines=903-907

but the RN instance could be destroyed due to exception, so when emitUpdateDimensionsEvent is called down the line there could be NPE which results in this [Logview](https://www.internalfb.com/logview/details/facebook_android_crashes/0f56580ff7b95827c8d4f932f2358841), we need to double check nullability in emitUpdateDimensionsEvent to avoid this

Changelog:
[Fixed][Android] - Check nullability for current context

Reviewed By: cipolleschi

Differential Revision: D44539899

fbshipit-source-id: c2587e92c1b8ca451420d340ac474860174d7a09
2023-03-31 03:03:33 -07:00
David Vacca b1b118d0f6 Refactor of IntBufferBatchMountItem class (#36728)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36728

This diff refactors the creation and visibility of IntBufferBatchMountItem

This is not a breaking compatibility change because nobody should be using this class

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D44115916

fbshipit-source-id: f0b0464483cafe55ffaf661b18c692be0df41199
2023-03-30 23:58:25 -07:00
David Vacca ed448b5ba4 Refactor preallocation of views (#36606)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36606

This diff refactors the preallocation of views to minimize visibility of PreAllocateViewMountItem

this is not a backward compatible change because nobody should be using this class

Changelog: [Internal] Internal

Reviewed By: javache

Differential Revision: D44115487

fbshipit-source-id: 2d00f9f5edbe0517c3c5fcef94290180fa418fb3
2023-03-30 21:30:51 -07:00
David Vacca 817db84c6b Refactor creation of SendAccessibilityEventMountItem (#36607)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36607

In this I'm refactoring the creation of SendAccessibilityEventMountItem to reduce visibility of classes

Changelog: [Internal] Internal

Reviewed By: javache

Differential Revision: D44115052

fbshipit-source-id: 021f59a65aed152324a13947609e23c0191ca0e8
2023-03-30 20:06:20 -07:00
David Vacca aa3e087be1 Refactor creation of MountItems (#36605)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36605

This diff introduces the class MountItemFactory that will be used to create MountItems in Fabric.
The purpose of this refactor is to reduce visibility for custom implementations of MountItems

This should not be a breaking change, because nobody should be using these classes

changelog: [internal] internal

Reviewed By: javache

Differential Revision: D44115053

fbshipit-source-id: a62d0a42239d29380aa10d5eab428af90c313d00
2023-03-30 18:32:12 -07:00
David Vacca c76ab8d01d Small refactor to log state data during development (#36603)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36603

Small refactor to log state data during development for preallocation of items

Changelog: [Internal] Internal

Reviewed By: javache

Differential Revision: D44112419

fbshipit-source-id: 290fbf0db3ea3f9863e7c86249dd1e6943556baa
2023-03-30 16:22:48 -07:00
Ruslan Lesiutin 8a18b53bcd bump packages for 0.73 (#36556)
Summary:
Changelog: [Internal]

Publishing to check CI if bumping and aligning in the same commit will work, since these new versions are not available on npm yet, but maybe our new monorepo setup will resolve this

**Adding back `react-native/virtualized-lists` as a workspace to `xplat/js` so that it won't be resolved from npm**

#publish-packages-to-npm

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

Reviewed By: cipolleschi

Differential Revision: D44255353

Pulled By: hoxyq

fbshipit-source-id: 21372487d6e9c0b2382b7cd9af835beed46b8ce1
2023-03-30 15:55:58 -07:00
Phillip Pan 5457811a16 don't pass around react context in react package if it's not needed (#36711)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36711

Changelog: [Internal]

minimizing callsites to the react context, which has turned into a bloated toolbox class

Reviewed By: javache

Differential Revision: D44493500

fbshipit-source-id: 7272b18af96103dee3658d151fd8e9f03846bd09
2023-03-30 15:20:59 -07:00
David Vacca c62fca7525 Reduce visibility of FabricComponentName mappings (#36602)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36602

This diff refactors and reduces visibility of the legacy class FabricComponents. This should not be a breaking change because nobody should be using it (there is no purpose to be used externally)

changelog: [internal] internal change on the APIs

Reviewed By: javache

Differential Revision: D44112418

fbshipit-source-id: 5608d682ca4fddb8e50db82ff23668fd82dccfb6
2023-03-30 14:26:43 -07:00
Alex Hunt f67bd676e5 Update template metro.config.js, remove transitive metro dep from main package (#36723)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36723

Changelog: [Internal]

Reviewed By: hoxyq

Differential Revision: D44542544

fbshipit-source-id: 70807edc8a183c28e1f0018a5426f4f2e29580a0
2023-03-30 12:48:46 -07:00
Pieter Vanderwerff 367faa2282 Deploy v0.203.0 to xplat (#36727)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36727

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D44526612

fbshipit-source-id: 492a19a2186417d4562291ed9e7f0f18c0799a2c
2023-03-30 12:38:57 -07:00
Nicola Corti 7449fad587 Add examples of Direct Manipulation in Fabric Intrerop (#36724)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36724

Similarly to iOS, this adds some examples of direct manipulation on Android using
all the various methods.

Changelog:
[Internal] [Changed] - Add examples of Direct Manipulation in Fabric Intrerop

Reviewed By: cipolleschi

Differential Revision: D44541437

fbshipit-source-id: b6e10ac0a815f41ff3c980236b7d8c6937e92065
2023-03-30 11:46:27 -07:00
Nicola Corti 97a9d3c01b Add example for dispatchViewManagerCommand on Fabric Interop (#36725)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36725

This diff adds an example of using `dispatchViewManagerCommand` for the Fabric Intreop on Android.

Changelog:
[Android] [Added] - Add example for dispatchViewManagerCommand on Fabric Interop

Reviewed By: cipolleschi

Differential Revision: D44540951

fbshipit-source-id: 85bc65ad0eb3a951fbb37d61ca26532ec3cc53b7
2023-03-30 11:46:27 -07:00
Richard Howell 677672ab1f add missing function prototypes (#36709)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36709

Add missing function prototypes

Changelog: [Internal]

Reviewed By: adamjernst

Differential Revision: D44520929

fbshipit-source-id: f363b8355b805f7f1a2701ebd9a61efd0d6bc06e
2023-03-30 08:34:35 -07:00
Alex Hunt c5a47abaf8 Bump RN CLI, add @react-native/metro-config to template (#36623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36623

Changelog:
[General][Changed] - The default `metro.config.js` in apps now extends `react-native/metro-config`, and should be updated in existing apps.

~~`react-native/rn-get-polyfills.js` is removed and should be updated to `react-native/js-polyfills` in existing apps (this is part of the new default config).~~

#publish-packages-to-npm

## Context

### React Native Metro config → React Native repo (https://github.com/facebook/react-native/pull/36502)

We (the React Native team) are aiming to relocate the default Metro config for React Native out of `react-native-community/cli-plugin-metro` and **into the React Native repo + app template** as a new `react-native/metro-config` package.

This is the first (and minimum viable) phase we can ship to separate the release process of Metro from RN CLI in order to reduce coupling and iterate faster for our users.

**See full motivation, design, and test plan (which previewed the CLI bump) here: https://github.com/facebook/react-native/pull/36502**

## Changes

NOTE: This PR is pending the inclusion of a bump to `react-native-community/cli`, and will be sequenced after https://github.com/react-native-community/cli/pull/1875 is merged.

- Upgrade `react-native-community/cli` to `11.0.0`, upgrade all `metro` packages to `0.76.0` (version distributed in this CLI release).
- Update the `metro.config.js` file in `packages/react-native/template/`.
    - Now merges defaults from `react-native/metro-config`, and can be used with CLI >= 11.0.0.
- Update the `metro.config.js` files for `packages/react-native/` and `packages/rn-tester/` (these are integration test locations).
    - Now merges defaults from `react-native/metro-config`, and can be used with CLI >= 11.0.0.

Changes to `react-native/metro-config` — `0.72.1` (prepared but not depended on yet):

- Export `mergeConfig` util (removing direct `metro-config` dependency in consuming projects).
- Explicitly depend on `metro-react-native-babel-transformer` and `metro-runtime` (transitively included today).

Reviewed By: cortinico, blakef

Differential Revision: D44099691

fbshipit-source-id: 405635dd69fd50a1e9548279eaeda3c932b5b167
2023-03-30 07:30:54 -07:00
Ján Ondrušek d1277df455 add missing include (#36708)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36708

`#include` what you use!

Changelog: [Internal]

Reviewed By: ispeters

Differential Revision: D44516344

fbshipit-source-id: a96afe7a7098609270f1d25321133a9afb443db2
2023-03-30 06:43:40 -07:00
Sparsha Saha cb376dd0d8 Make setJSEngineResolutionAlgorithm a public method (#36715)
Summary:
`setJSEngineResolutionAlgorithm` is marked as private while it looks like it was intended to be public.
While the current implementation does not cause any issues as such, but in brownfield we will have the option to explicitly set the JS engine to hermes or jsc when initialising the ReactInstanceBuilder.

Right now, we look if the engine is set and if unset we look for the jsc engine. If jsc is not present we select hermes and this process unnecessary throws a warning.

## 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] - Changed the scope of `setJSEngineResolutionAlgorithm` to public from private. Brownfield apps should be able to setup the JSResolutionAlgorithm before hand.

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

Reviewed By: cortinico

Differential Revision: D44535444

Pulled By: javache

fbshipit-source-id: ae91e50de10c993c80ed4bba6f2fece64af178c4
2023-03-30 04:59:35 -07:00
Nicola Corti e5dd9cdc66 Re-enable Fabric in the default app template/RN-Tester (#36717)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36717

After D43711737 landed, it turns out that Fabric is always disabled for both
RN-Tester and new app from template (so for 0.72 also RC0).
The reason is that a new method `createRootView(Bundle)` was introduced inside
`ReactActivityDelegate`. Both RN Tester and the template were using the
old `createRootView()` method which is not called anymore at this stage
(should potentially be deprecated?).

This diff fixes it by overriding both method inside `DefaultReactActivityDelegate`
so that both methods are setting the Fabric renderer.

Changelog:
[Android] [Fixed] - Re-enable Fabric in the default app template/RN-Tester

Reviewed By: cipolleschi

Differential Revision: D44536222

fbshipit-source-id: d22a0c522f011a8fe4d27b5d8f2fcf5dd13c3058
2023-03-30 04:44:21 -07:00
gabrieldonadel 66ae98e4a4 chore: Expand Codegen emitCommonTypes function adding the remaining basic types (#36706)
Summary:
[Codegen 81] This PR expands the  `emitCommonTypes` function adding support for the remaining basic types and adding
a `convertKeywordToTypeannotation` function to the codegen Parser class and implementing it in the Flow and TypeScript parsers as requested on https://github.com/facebook/react-native/issues/34872

## Changelog:

[Internal] [Added] - Expand Codegen emitCommonTypes function adding the remaining basic types

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

Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green

Reviewed By: christophpurrer

Differential Revision: D44504571

Pulled By: cipolleschi

fbshipit-source-id: 220d9bc0cc39614002a67dafd626e5a4878a1447
2023-03-30 03:46:47 -07:00
Riccardo Cipolleschi a44d8a0f8a Add Examples for Direct Manipulation in the Interop Layer (#36610)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36610

This change add to RNTester examples of a legacy Native Component, loaded in the New Architecture through the Interop Layer, that uses the APIs described in the [Direct Manipulation](https://reactnative.dev/docs/direct-manipulation) sectioon of the website.

## Changelog:
[iOS][Added] - Added examples of direct manipulation

Reviewed By: sammy-SC

Differential Revision: D43978674

fbshipit-source-id: 1cbc56f28034f84f309166e3e392ad97a8164e64
2023-03-29 15:30:26 -07:00
Riccardo Cipolleschi c7aaae61ca Make UIManager.dispatchViewManagerCommand work in Fabric through Interop Layer (#36578)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36578

This change brings to the Fabric Interop Layer the possibility to directly call native methods on the View Manager, something that was not possible before and that we can use to simplify the migration to the New Architecture.

## Changelog:
[iOS][Added] - Native Components can now call native methods in Fabric when they are loaded through the Interop Layer

Reviewed By: sammy-SC

Differential Revision: D43945278

fbshipit-source-id: fe67ac85a5d0db3747105f56700d1dbba7ada5f1
2023-03-29 15:30:26 -07:00
Nicola Corti 688df2f7cc Move from from accidental template/ folder on root. (#36704)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36704

Following up to #36696, I accidentally failed a rebase and had files
commited on the wrong folder. I'm updating them here to use `packages/react-native/template`.

Changelog:
[Internal] [Changed] - Move from from accidental template/ folder on root

Reviewed By: cipolleschi

Differential Revision: D44502966

fbshipit-source-id: d408f38884444c4ecc03852b1d145bf2e89df672
2023-03-29 14:01:35 -07:00
Phillip Pan a4fe9b2b6d deprecate ReactModuleWithSpec (#36673)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36673

Changelog: [Android][Deprecated]

in this change, we deprecate ReactModuleWithSpec because it can be replaced with the TurboModule interface which better describes our generated modules.

Reviewed By: cortinico

Differential Revision: D44450959

fbshipit-source-id: adab192593843926f35bdbeb346ef374dd80e615
2023-03-29 12:06:52 -07:00
fortmarek 0328a8d26b Use packaged react-native in test-e2e-local script (#36703)
Summary:
The current `test-e2e-local` script had two bugs:
- On [this](https://github.com/facebook/react-native/blob/c1c22ebacc4097ce56f19385161ebb23ee1624b3/scripts/test-e2e-local.js#L219) line we were initializing a new RN project with the packed `react-native` created [here](https://github.com/facebook/react-native/blob/c1c22ebacc4097ce56f19385161ebb23ee1624b3/scripts/test-e2e-local.js#L211)
- We were updating the local RN version after running `npm pack` [here](https://github.com/facebook/react-native/blob/c1c22ebacc4097ce56f19385161ebb23ee1624b3/scripts/test-e2e-local.js#L214). This meant that the version inside the packaged `react-native-xyz.tgz` was not updated since we ran `pack` before updating it. This was fine since the `init` command was using the local `react-native` repository instead of the packed version.

## Changelog:

[INTERNAL] [FIXED] - Use packaged react-native in test-e2e-local script
<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[INTERNAL] [FIXED] - Use packaged react-native in test-e2e-local script

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

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

Test Plan:
- Run `yarn test-e2e-local -t RNTestProject -p Android`. The command should succeed.

I am not completely sure how to double check that we are using the packed version. Locally, I have a `fsmonitor--daemon.ipc` in my `react-native/.git` that can't be copied. The `.git` folder would be copied only when `cli.js init` was called with the whole repository  – which is how I found out about the issue in the first place.

Reviewed By: hoxyq

Differential Revision: D44504599

Pulled By: cipolleschi

fbshipit-source-id: e57e2858bab46d4f978eed3cbaf3e504138594b8
2023-03-29 10:21:44 -07:00
Kyaw Thura 969a8d0799 Enrich getCommandProperties with the parser object (#36500)
Summary:
> [Codegen 101] The code of getCommandProperties is almost identical in [Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L128) and [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L129). There are small differences between flow/ts, so we need for it to accept a Parser object. Enrich the parser object with the required methods if necessary.

## Changelog:

[Internal] [Changed] - Enrich getCommandProperties with the parser object

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

Test Plan: `yarn test react-native-codegen`

Reviewed By: cortinico

Differential Revision: D44415265

Pulled By: cipolleschi

fbshipit-source-id: ed13b553a6f782beb0f1aec79bd17d865a96fac9
2023-03-29 09:28:00 -07:00