Commit Graph

12270 Commits

Author SHA1 Message Date
Eric Rozell 2b688f6031 Abstract underlying Color implementation (#38668)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38668

On other platforms (e.g., react-native-windows), it's possible that platform colors may not be efficiently represented as int32_t values. In the case of react-native-windows, Color can either be an ARGB value or a list of fallback strings for platform colors.

This change should decouple how platforms represent color values, allowing them to manage how they are used at the point they are used.

## Changelog:
[General] [Added] - Support customization of underlying Color representation in out-of-tree platforms

Reviewed By: NickGerleman

Differential Revision: D47873465

fbshipit-source-id: 1dbb36be409c04ce87b356d75503ec0cf88f1c5b
2023-07-31 11:38:36 -07:00
Eric Rozell 6e3e6b574f Create option for out-of-tree platforms to customize ViewEventEmitter (#38582)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38582

Some out of tree platforms may have extra events (e.g., events for different input modalities) that don't exist on other platforms.

For example, react-native-windows and react-native-macos have `onKeyUp` and `onKeyDown` that can be emitted from any native component.

This change provides a hook for out of platforms to customize which events can be emitted from all native components.

## Changelog:
[General] [Added] - Support additional View events in out of tree platform Fabric implementations

Reviewed By: christophpurrer

Differential Revision: D47721603

fbshipit-source-id: 5ae2ff0f6c1b1dfd72b0a310c1309a85e6b170b1
2023-07-31 11:38:36 -07:00
Eric Rozell 646c75995e Create option for out-of-tree platforms to customize View traits (#38580)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38580

We already have a differential between Android and iOS View props that force view flattening (or unflattening) behaviors. Other out-of-tree platforms may have a need to customize view flattening behaviors.

This change adds a ViewTraitsInitializer header that out of tree platforms can inject to include platform-specific ViewProps fields when considering view flattening behaviors.

## Changelog:
[General] [Added] - Support customization of View traits for flattening in out of tree platform Fabric implementations

Reviewed By: christophpurrer

Differential Revision: D47721377

fbshipit-source-id: b7d6dda2f20e153a0277861d04709090756c96ce
2023-07-31 11:38:36 -07:00
Eric Rozell a0bb79d84f Create BaseViewProps for platforms to derive (#38549)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38549

Out of tree platforms may need different implementations of ViewProps. In fact, Android does already with props like `needsOffscreenAlphaCompositing` and `focusable`. This diff is not opinionated on whether these props should actually be shared on all platforms. Props like `focusable` may be a good candidate for generalizing to all platforms. However, there will always be a need for one platform to experiment with a new prop while it's not available yet on another, especially when considering out of tree platforms.

This diff moves the existing ViewProps class to BaseViewProps, aliases ViewProps as BaseViewProps for iOS for now, and moves Android-specific view props to it's own header and implementation.

## Changelog:
[General] [Added] - Support additional View props in out of tree platform Fabric implementations

Reviewed By: christophpurrer

Differential Revision: D47492635

fbshipit-source-id: 5739174a2b1d28ba84f4398ccc1cc0b846ebea79
2023-07-31 11:38:36 -07:00
Siddarth Kumar 8bcfc493ea add getPaperTopLevelNameDeprecated to parsers (#38683)
Summary:
[Codegen 135] This PR introduces `getPaperTopLevelNameDeprecated` to parser base class and abstracts the logic out of typescript and parser events as requested on https://github.com/facebook/react-native/issues/34872

## Changelog:

[Internal] [Changed] - Add `getPaperTopLevelNameDeprecated` to parser base class and update usages.

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

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

## Screenshot of test passing locally:
<img width="1060" alt="Screenshot 2023-07-30 at 10 04 24 AM" src="https://github.com/facebook/react-native/assets/64726664/3f61377b-9f44-45e8-bece-d4fd6bcc4567">

Reviewed By: cipolleschi

Differential Revision: D47902816

Pulled By: rshest

fbshipit-source-id: 6fab53e02cfc3f0aaa3ffd795c3fe1d2f723e060
2023-07-31 07:52:19 -07:00
Dmitry Rykun 1ba7bc0eb1 Do not enable bridgeless mode when RCT_NEW_ARCH_ENABLED=1 (#38690)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38690

Bridgeless mode needs static view configs support. Let's not not enable it until this support is shipped to OSS.
Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D47913713

fbshipit-source-id: 207be574295455cc215f907803b596bf48dca88b
2023-07-31 06:18:08 -07:00
Phillip Pan 682887587b cleanup turbomodule eager init (#38540)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38540

Changelog: [Internal]

this is never set to yes, clean it up

we need to decide if this is actually part of our feature set

Reviewed By: cipolleschi

Differential Revision: D47620233

fbshipit-source-id: 6f530015da0645d721bef7ff7c5d512113273b1a
2023-07-31 06:06:06 -07:00
Phillip Pan de7c0655f0 cleanup RCTDisableTurboModuleManagerDelegateLocking (#38522)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38522

Changelog: [Internal]

as title

Reviewed By: mdvacca

Differential Revision: D47619958

fbshipit-source-id: f37efe205b4bf607dc5d159f87104edbf794c6eb
2023-07-31 06:06:06 -07:00
Denis 6d5be2630c refactor(codegen): add getLiteralValue in parser (#38651)
Summary:
[Codegen 130] This PR add a `getLiteralValue` function to the Parser interface, which returns the literal value of an union represented, given an option. as requested on https://github.com/facebook/react-native/issues/34872

## Changelog:

[INTERNAL] [ADDED] - Add `getLiteralValue` function to codegen Parser

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

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

Reviewed By: cipolleschi

Differential Revision: D47912960

Pulled By: rshest

fbshipit-source-id: d9426fef4c0f92c5244d5c4c72202ec29099b76e
2023-07-31 04:56:25 -07:00
William Bell 8a63b91525 Update new_architecture.rb for React-ImageManager (#38247)
Summary:
This added React-ImageManager to the use_frameworks! - a lot of rpm modules podspec need this.

bypass-github-export-checks

## Changelog:

[iOS] [FIXED] - Add React-ImageManager path to work with use_frameworks!

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

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

Test Plan: Should not be breaking - it will add to the header_search_paths React-ImageManager

Reviewed By: dmytrorykun

Differential Revision: D47593749

Pulled By: cipolleschi

fbshipit-source-id: a66e90707e5fa73573deab1f04e8d8693869a90c
2023-07-31 04:04:20 -07:00
David Vacca cbf9408dd0 Introduce FrameworkAPI annotation to document APIs that are provided ONLY for frameworks (#38686)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38686

In this diff I'm introducing the FrameworkAPI annotation to document APIs that are provided ONLY for frameworks

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D47839411

fbshipit-source-id: 254a1f6cd42279478fba0ddb3f3736bb2b675bae
2023-07-30 11:54:13 -07:00
David Vacca 17ebe6cd69 Ez fix lint warn (#38595)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38595

 Ez fix lint warn

changelog: [internal] internal

Reviewed By: cortinico

Differential Revision: D47565845

fbshipit-source-id: 6337831031fd4060bcc9168e8ae0be2655718241
2023-07-30 11:54:13 -07:00
David Vacca 2ef711cf45 Add proper Override annotation into ReactPackageTurboModuleManagerDelegate methods (#38589)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38589

Add proper Override annotation into ReactPackageTurboModuleManagerDelegate methods

changelog: [internal] internal

Reviewed By: christophpurrer, cortinico

Differential Revision: D47483652

fbshipit-source-id: 3b3bccdccdc3efa6ee7221830ee39735cd1b1758
2023-07-30 11:54:13 -07:00
David Vacca ea5bf30a1b Update comment in ReactInstance to properly descrube package visibility (#38590)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38590

Update comment in ReactInstance to properly descrube package visibility

changelog: [internal] internal

Reviewed By: christophpurrer, cortinico

Differential Revision: D47483651

fbshipit-source-id: 1743bc76f515eb1cf2021e422b08f62f316b8ef9
2023-07-30 11:54:13 -07:00
David Vacca 0cac88fa65 Android deprecate JSCJavaScriptExecutorFactory and JSCJavaScriptExecutor (#38594)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38594

These classes are deprecated in favor of com.facebook.react.jscexecutor instead

changelog: [Android][Changed] Deprecate JSCJavaScriptExecutorFactory and JSCJavaScriptExecutor, use com.facebook.react.jscexecutor instead

Reviewed By: christophpurrer, cortinico

Differential Revision: D47483650

fbshipit-source-id: 5c29cf2bfff201468f171f1529e76ecf65244731
2023-07-30 11:54:13 -07:00
Intl Scheduler 265f72f6da translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907931550347
Sandcastle Job Instance ID: 31525198397291914
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D47898016

fbshipit-source-id: cdfa4975162969626581cf139c7411195ea9bc37
2023-07-29 12:02:45 -07:00
David Vacca 4e8a321d3b Reduce visibility of log() method (#38597)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38597

Reduce visibility of log() method

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D47455664

fbshipit-source-id: a41bc430fe05edb0d048050a4a0c04727f61a934
2023-07-29 11:20:24 -07:00
David Vacca 3e1456311a Delete ContextBasedJavaModule (#38592)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38592

ContextBasedJavaModule is not used, neither internally or externdally. We are just deleting it

changelog: [internal] intenral

Reviewed By: christophpurrer, cortinico

Differential Revision: D47450518

fbshipit-source-id: b431adbe30c72491723b8821b3c59e0e8e7030f1
2023-07-29 11:20:24 -07:00
David Vacca b77f265afe Reduce visibility of JavaMethodWrapper and JavaModuleWrapper to package only (#38591)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38591

Reduce visibility of JavaMethodWrapper and JavaModuleWrapper to package only

changelog: [internal] internal

Reviewed By: christophpurrer, cortinico

Differential Revision: D47449525

fbshipit-source-id: a1a573c31fbe3402f32d05005848fc113419a00a
2023-07-29 11:20:24 -07:00
David Vacca faae720e41 Fix lint warns (#38596)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38596

Fix lint warns

changelog: [internal] internal

Reviewed By: arushikesarwani94

Differential Revision: D47445900

fbshipit-source-id: af1d30e3889050c15d015cd6f1c35c73210167d9
2023-07-29 11:20:24 -07:00
David Vacca e9246852df Extract loading of turbomodulejsijni into its own function (#38320)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38320

In this diff I'm extracting the loading of turbomodulejsijni into its own function. This could have perf implications as we are trying to load multimple times the same soLoader

changelog: [intenral] internal

Reviewed By: luluwu2032

Differential Revision: D47409162

fbshipit-source-id: 007e89e99ec0e7fa494d811f9c830b1363acec19
2023-07-29 11:20:24 -07:00
Davyd Narbutovich 1383a59ed2 Replace JSX.Element with React.JSX.Element (#38615)
Summary:
the global `JSX` namespace was depreacted in react 18:

```tsx
declare global {
    /**
     * deprecated Use `React.JSX` instead of the global `JSX` namespace.
     */
    namespace JSX {
```

## Changelog:

[GENERAL] [CHANGED] - Replace `JSX.Element` with `React.JSX.Element` in `App.tsx` template

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

Test Plan:
Before

<img width="686" alt="Screenshot 2023-07-25 at 14 11 59" src="https://github.com/facebook/react-native/assets/4661784/531a4f88-8090-43aa-86d6-4af595d4cb5d">

After

<img width="445" alt="Screenshot 2023-07-25 at 14 12 12" src="https://github.com/facebook/react-native/assets/4661784/3b427938-2768-4131-b77a-62045e5b8d08">

Reviewed By: rshest

Differential Revision: D47873435

Pulled By: NickGerleman

fbshipit-source-id: c8a9e0e8e96a54c6ee66fcae2392e0d20d20d026
2023-07-28 21:42:41 -07:00
Ed Voas 823b79584d Export StartupLogger
Summary: Export StartupLogger

Differential Revision: D47883845

fbshipit-source-id: 8429f4f7f157b1b26623920557347dd80c154850
2023-07-28 16:58:43 -07:00
Eric Rozell a830223f95 Fix OSS gradle build for ReactCommon/react/renderer/graphics (#38644)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38644

It's likely that some components consuming react/renderer/graphics headers are consuming the wrong PlatformColorParser header, since the implementation under platform/android is quite different from the implementation under platform/cxx.

This change should hoist the correct headers to react/renderer/graphics when building Fabric in OSS.

## Changelog:
[General] [Fixed] - Fix headers for react/renderer/graphics for Fabric Android

Reviewed By: cortinico, NickGerleman

Differential Revision: D47821848

fbshipit-source-id: a2f2b057aa73c1c6b4a00e2c3e508cebb6e6facf
2023-07-28 15:45:53 -07:00
Nick Gerleman c168a4f88b Fix invariant violation when maintainVisibleContentPosition adjustment moves window before list start (#38655)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38655

https://github.com/facebook/react-native/pull/35993 added logic in VirtualizedList to support `maintainVisibleContentPosition`. This logic makes sure that a previously visible cell being used as an anchor remains rendered after new content is added.

The strategy here is to calculate the difference in previous and new positions of the anchor, and move the render window to its new location during item change. `minIndexForVisible` is used as this anchor.

When an item change moves the anchor to a position below `minIndexForVisible`, shifting the render window may result in a window which starts before zero. This fixes up `_constrainToItemCount()` to handle this.

Changelog:
[General][Fixed] - Fix invariant violation when `maintainVisibleContentPosition` adjustment moves window before list start

Reviewed By: yungsters

Differential Revision: D47846165

fbshipit-source-id: 8a36f66fdad321acb255745dad85618d28c54dba
2023-07-28 12:55:17 -07:00
Hanno J. Gödecke 3dd816c6b7 Add workaround fix for #35350 (#38073)
Summary:
This PR is a result of this PR, which got merged but then reverted:

- https://github.com/facebook/react-native/pull/37913

We are trying to implement a workaround for https://github.com/facebook/react-native/issues/35350, so react-native users on android API 33+ can use `<FlatList inverted={true} />` without running into ANRs.

As explained in the issue, starting from android API 33 there are severe performance issues when using scaleY: -1 on a view, and its child view, which is what we are doing when inverting the ScrollView component (e.g. in FlatList).

This PR adds a workaround. The workaround is to also scale on the X-Axis which causes a different transform matrix to be created, that doesn't cause the ANR (see the issue for details).
However, when doing that the vertical scroll bar will be on the wrong side, thus we switch the position in the native code once we detect that the list is inverted, using the newly added `isInvertedVirtualizedList` prop.

This is a follow up PR to:

- https://github.com/facebook/react-native/pull/38071

⚠️ **Note:** [38071](https://github.com/facebook/react-native/pull/38071) needs to be merged and shipped first! Only then we can merge this PR.

## 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] - ANR when having an inverted FlatList on android API 33+

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

Test Plan:
- Check the RN tester app and see that scrollview is still working as expected
- Add the `internalAndroidApplyInvertedFix` prop as test to a scrollview and see how the scrollbar will change position.

Reviewed By: cortinico

Differential Revision: D47848063

Pulled By: NickGerleman

fbshipit-source-id: 4a6948a8b89f0b39f01b7a2d44dba740c53fabb3
2023-07-28 10:55:52 -07:00
Fabrizio Bertoglio b1ceea456d Remove option to paste rich text from Android EditText context menu (#38189)
Summary:
Text is copy pasted as rich text on Android TextInput instead of Plain Text.

### What is the root cause of that problem?

Android EditText and iOS UITextField/UITextView have different copy/paste behavior.
- Android TextInput copies/pastes rich text
- iOS UITextField copies/pastes plain text.

| iOS (react-native)   | Android (react-native) |
| ----------- | ----------- |
| <video src="https://user-images.githubusercontent.com/24992535/249170968-8fde35f0-a53c-4c5c-bd89-ee822c08eadf.mp4" width="350" />      | <video src="https://user-images.githubusercontent.com/24992535/249171968-bf0915a0-4060-4586-b267-7c2b463d76f6.mov" width="350" />       |

### What changes do you think we should make in order to solve the problem?

The issue is a bug in react-native https://github.com/facebook/react-native/issues/31442:

1) The JavaScript TextInput and ReactEditText Android state are not in sync
2) The TextInput Android Native state over-rides the JavaScript state.
3) onChangeText passes a plain text string to JavaScript, not rich text (text with spans and styles).

More info at https://github.com/Expensify/App/issues/21411#issuecomment-1611591137

The solution consists of:

1) **Over-riding onTextContextMenuItem in ReactEditText to copy/paste plain text instead of rich-text** (https://stackoverflow.com/a/45319485/7295772).
2) **Removing the `Paste as plaintext` option from the insert and selection context menu**

fixes https://github.com/facebook/react-native/issues/31442

## Changelog:

[ANDROID] [FIXED] - Remove option to paste rich text from Android EditText context menu

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

Test Plan:
#### Reproducing the issue on Android

https://user-images.githubusercontent.com/24992535/249185416-76f8a687-1aca-4dc9-9abe-3d73d6e2893c.mp4

#### Fixing the issue on Android
Sourcecode https://github.com/fabriziobertoglio1987/text-input-cursor-flickering-android/blob/fix-copy-paste/app/src/main/java/com/example/myapplication/CustomEditText.java

https://user-images.githubusercontent.com/24992535/249486339-95449bb9-71b6-430c-8207-f5672f034fa9.mp4

#### Testing the solution on React Native

https://github.com/Expensify/App/assets/24992535/b302237b-99e5-44a2-996d-8bc50bbbc95c

Reviewed By: mdvacca

Differential Revision: D47824730

Pulled By: NickGerleman

fbshipit-source-id: 35525e7d52e664b0f78649d23941262ee45a00cd
2023-07-28 10:35:45 -07:00
Josh Leibsly ed640183e5 Revert D43863974: Add init react runtime start time in performance API
Differential Revision:
D43863974

Original commit changeset: 277d35e14dbb

Original Phabricator Diff: D43863974

fbshipit-source-id: 87fc2bb88fa25601028643e7c15a7984a30b9d43
2023-07-28 08:28:02 -07:00
David Vacca 86bf8d1e89 Migrate TurboModuleRegistry to kotlin (#38593)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38593

In this diff I'm migrating TurboModuleRegistry to kotlin

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D47382872

fbshipit-source-id: 9249a269d9253555b9fda8c665da57f62c825821
2023-07-28 06:08:53 -07:00
David Vacca 2736918ece Migrate TurboModule to kotlin (#38503)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38503

In this diff I'm migrating TurboModule to kotlin

changelog: [internal] internal

Reviewed By: christophpurrer, cortinico

Differential Revision: D47382875

fbshipit-source-id: 9df36be8ad20f8bce35b0f991867f22c0101fc97
2023-07-28 06:08:53 -07:00
David Vacca 6938f81172 Migrate NativeMethodCallInvokerHolder to kotlin (#38502)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38502

In this diff I'm migrating NativeMethodCallInvokerHolder to kotlin

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D47382874

fbshipit-source-id: c9b5d12c8a50ab38af6c6389ad72171a8e338ec7
2023-07-28 06:08:53 -07:00
David Vacca 710f2e3bdb Migrate CallInvokerHolder to kotlin (#38504)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38504

In this diff I'm migrating CallInvokerHolder to kotlin

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D47382873

fbshipit-source-id: 7641c0685e3716f9d3b2db6c5ba837b4a47e7d08
2023-07-28 06:08:53 -07:00
David Vacca b1385ef663 Use labmda and remove lint warnings (#38296)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38296

Use labmda and remove lint warnings

changelog: [internal] internal

Reviewed By: RSNara

Differential Revision: D47374731

fbshipit-source-id: cb66330d81de9548a33010af977f7807ac360530
2023-07-28 06:08:53 -07:00
David Vacca 561f843998 Migrate jscexecutor to kotlin (#38254)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38254

In this diff I'm migrating jscexecutor to kotlin

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D47309460

fbshipit-source-id: f3d04277813ff7314eb7e5b011475bd2d4c72c7f
2023-07-28 06:08:53 -07:00
Jesse Watts-Russell 6dc517a7fc Log route parameters in the scene-tracker (#38654)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38654

Changelog:
[Internal][Added] - Created mechanism to add other properties in OCSceneTracker then subsequently refine them when consuming the current scene.

Reviewed By: rubennorte

Differential Revision: D47810741

fbshipit-source-id: d24e4f4d1d25fac2f3bed2e98e7a7b4642f26319
2023-07-27 20:56:11 -07:00
Intl Scheduler 83c512dd2c translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907930222511
Sandcastle Job Instance ID: 31525198395783013
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D47856272

fbshipit-source-id: feb60f89a2223b8ba79115490717fe88e5819396
2023-07-27 16:54:38 -07:00
Nick Gerleman 8b39bfadbb Fix virtualization logic with horizontal RTL lists (#38529)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38529

VirtualizedList internally represents metrics along the scrolling axis using `offset` (x, y), and `length` (width, height). This one dimensional representation allows the list to be generic to being horizontal or vertical.

Right now offset conversion directly takes the `x` or `y` axis value, but  this is not correct when we are using a horizontal FlatList in RTL.

This change converts most VirtualizedList code handling  `offset,length` coordinates consistently flow from start to end, including in horizontal RTL and in inverted FlatList.

This is paired with a fix to Android native code in D47627115. With these together, basic Horizontal FlatList scenarios should work correctly when laid out in RTL.

Changelog:
[General][Fixed] - Fix virtualization logic with horizontal RTL lists

Reviewed By: vincentriemer

Differential Revision: D46586420

fbshipit-source-id: 79594e197d21871bb493399999e91fc0d6c7b050
2023-07-27 16:26:18 -07:00
Nick Gerleman 30c7e9dfa4 Generalize RTL Scroll Correction Logic (#38526)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38526

This changes the logic we use to correct scroll position on RTL ScrollView content change, to a new more generalized strategy of keeping a constant right-edge offset on layout change. This includes first layout, so that the initial scroll position is correct.

Changelog:
[Android][Fixed] - Generalize RTL Scroll Correction Logic

Reviewed By: yungsters

Differential Revision: D47627115

fbshipit-source-id: 33b2aae0cb603b7f7f2e2e6c127622fd531230e8
2023-07-27 16:26:18 -07:00
Xin Chen 10e8b3538f Add init react runtime start time in performance API (#38328)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38328

This diff adds the two extra markers `initializeRuntimeStart` and `initializeRuntimeEnd` to the startup performance API. The runtime start time matches the existing android marker `GET_REACT_INSTANCE_MANAGER_START`, which is the first marker we have on the RN android app.

Changelog:
[Android][Added] - Add `performance.reactNativeStartupTiming.initializeRuntimeStart` and` `performance.reactNativeStartupTiming.initializeRuntimeEnd` API

Reviewed By: mdvacca

Differential Revision: D43863974

fbshipit-source-id: 277d35e14dbb5e3def8d440b717b3cf0215b4f47
2023-07-27 16:14:58 -07:00
Dmitry Rykun d380bb8473 Move react-native-babel-transformer and react-native-babel-preset from Metro to React Native repo (#38228)
Summary:
X-link: https://github.com/facebook/metro/pull/1024

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

Changelog: [General][Changed] - Move react-native-babel-transformer and react-native-babel-preset from Metro to React Native repo.

Metro Changelog:  **[Breaking]** - Remove `metro-react-native-babel-transformer` and `metro-react-native-babel-preset`, to be published as `react-native/metro-babel-transformer` and `react-native/babel-preset` instead.

This diff does the following:
- Move `metro/packages/metro-react-native-babel-preset` to `react-native/packages/react-native-babel-preset`.
- Rename `metro-react-native-babel-preset` package to `react-native/babel-preset`.
- Move `metro/packages/metro-react-native-babel-transformer` to `react-native/packages/react-native-babel-transformer`.
- Rename `metro-react-native-babel-transformer` package to `react-native/metro-babel-transformer`.
- Upadate dependencies.

Reviewed By: robhogan

Differential Revision: D46977466

fbshipit-source-id: 32478f63a0442b61a1804f12ef814c8b29d7f8bb
2023-07-27 11:48:16 -07:00
Dmitry Rykun 75b8b10765 Fix ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode check (#38639)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38639

`ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode` is a function, we should call it.
Changelog: [Internal] - Fix ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode check

Reviewed By: luluwu2032

Differential Revision: D47798910

fbshipit-source-id: 68c75069f400f0a0327b1c3a5dd2b1cbfc2e70c7
2023-07-27 07:28:56 -07:00
evanbacon e37e53086a fix: use import for event-target-shim to support mjs (#38628)
Summary:
The React Native community almost exclusively adds `mjs` support with something like: `config.resolver.sourceExts.push("mjs");` which causes `js` to be resolved before `mjs`. Mainstream bundlers will do the opposite, resolving `mjs` then `js`, unless bundling for Node.js environments.

`event-target-shim` has a `.js` and `.mjs` entry, when we [attempt to implement _community-standard_ resolution in Metro](https://github.com/expo/expo/pull/23528) the app fails to open on iOS––providing no indication of what failed. The issue here is that the `mjs` exports for `event-target-shim` don't support `module.exports = function() {}`, so we need to update some of the imports in `react-native` (note that one of the imports to `event-target-shim` already uses `import/export`).

### Discovery

For future readers––to discover this bug, I wrote a custom Metro resolver which printed a list of any `mjs` file that was resolved. In a basic app we observe the following:

```
/node_modules/react-native/Libraries/Core/setUpXHR.js > /node_modules/abort-controller/dist/abort-controller.mjs
/node_modules/react-native/Libraries/Network/XMLHttpRequest.js > /node_modules/event-target-shim/dist/event-target-shim.mjs
/node_modules/react-native/Libraries/WebSocket/WebSocket.js > /node_modules/event-target-shim/dist/event-target-shim.mjs
/node_modules/react-native/Libraries/Blob/FileReader.js > /node_modules/event-target-shim/dist/event-target-shim.mjs
/node_modules/abort-controller/dist/abort-controller.mjs > /node_modules/event-target-shim/dist/event-target-shim.mjs
```

In all cases the mjs files are resolved via `react-native` importing third-party packages, specifically `abort-controller` and `event-target-shim`. I modified the custom Metro resolver to ignore mjs resolution in different files until I found the problematic imports. This revealed that the exports were changing in `event-target-shim` between mjs and js.

Further, this was difficult to discover because the code that attempts to invoke an object as a function (error) is happening during the React Native networking setup. Ideally this JS code would be isolated from the user's bundler configuration and therefore impossible to break.

## Changelog:

[GENERAL] [FIXED] - Update `event-target-shim` import to support Metro resolving `mjs` modules before `js`.

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

Test Plan:
- If you add `mjs` support to the `metro.config.js` file **before** js (`config.resolver.sourceExts.unshift("mjs");`), the project should be capable of starting.
- Usage with the default `metro.config.js` setup works as well.
- https://github.com/expo/expo/pull/23528 works.

Reviewed By: NickGerleman

Differential Revision: D47816854

Pulled By: TheSavior

fbshipit-source-id: ebaf2e7a3ec02ae61effa004058589053601b766
2023-07-26 22:32:54 -07:00
Eric Rozell bae63d492f Break circular dependency between renderer/core and renderer/components/view (#38637)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38637

ComponentDescriptor and ConcreteComponentDescriptor expose a virtual method to interpolate props for LayoutAnimation. The implementation of this virtual method in ConcreteComponentDescriptor calls ViewPropsInterpolation, creating a circular dependency between react/renderer/core and react/renderer/components/view.

To break this circular dependency, this change lifts the props interpolation functionality out of ComponentDescriptor into LayoutAnimationKeyFrameManager.

Please note, while this is technically a "breaking" change, as component descriptors for 3p components may have overridden this method, it's not supported because LayoutAnimation only works on View props.

## Changelog:
[General] [Breaking] - Remove interpolateProps functionality from ComponentDescriptor to fix circular dependency between react/renderer/core and react/renderer/components/view

Reviewed By: christophpurrer

Differential Revision: D47797967

fbshipit-source-id: 5285da7cc9de29f21ce14c96b850a3c58c579e94
2023-07-26 13:14:59 -07:00
Eric Rozell 3d2fd4bf22 Only apply isHighlighted native prop on iOS (#38642)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38642

isHighlighted is only used for iOS. Even macOS disables it (see https://github.com/microsoft/react-native-macos/pull/1346).

This change ensures that the isHighlighted prop is only updated for iOS.

## Changelog:

[General] [Fixed] - Avoids re-renders during text selection on desktop platforms by limiting native-only `isHighlighted` prop to iOS

Reviewed By: lenaic, sammy-SC

Differential Revision: D47800845

fbshipit-source-id: af109be17027b2fbc9408e2ec9e1b841c709fe35
2023-07-26 12:45:41 -07:00
Nicola Corti 6cd1da94b8 Bump AGP to 8.1.0 (#38638)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38638

A new stable version of Android Gradle Plugin has just been released which I'm bumping over here, and applying all the required changes.

Changelog:
[Internal] [Changed] - Bump AGP to 8.1.0

Reviewed By: cipolleschi

Differential Revision: D47798273

fbshipit-source-id: 57672b10444ffb6079aa5881ff09d033d2a5e895
2023-07-26 11:02:05 -07:00
Ruslan Lesiutin b96d3beb3d refactor[AppContainer]: remove unused hasError (#38623)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38623

Changelog: [Internal]

Looks like this field is unused.

Reviewed By: robhogan

Differential Revision: D47758294

fbshipit-source-id: 5bf9f8c11eba07a2074290b2b35f4432c80eaa5d
2023-07-26 10:24:09 -07:00
Lorenzo Sciandra 3c6dbec23b add RNTester-E2E: tests for iOS and Android via Appium, WDIO and Jest (#36267)
Summary:
The motivation is to create an E2E testing solution for the RNTester app that can be used to flag when things break and the release crew can use to validate more of the codebase ahead of a release.

This first PR wants to just showcase the main flow (how tests are made, where the E2E folder lives, how it's used by CircleCI) and then we can build on top of it with subsequent PRs, with the help of an umbrella issue to get the community involved in making more tests!

This work is being done cooperation with Callstack developers (mateuszm22 , adzironman, and others) - reason why the branch [lives in a fork](https://github.com/mateuszm22/react-native/tree/k%2Bm/new-rn-tester-E2E).

### [Read the RFC for more details ](https://github.com/react-native-community/discussions-and-proposals/pull/684)

### Extra notes

We are still on WebDriverIO 7 because during the exploratory phase, WDIO was a bit problematic and the workarounds needed to make it work don't seem very nice - see this PR: https://github.com/kelset/react-native-e2e-jest-appium-webdriverio/pull/4 --- this will be revisited in the future, once there's a better path for upgrading.

### Things that will be handled as follow up work

* upgrade to WDIO 8
* [an automated yarn run-e2e-test script](https://github.com/facebook/react-native/pull/36267#discussion_r1269378065)
* [a small refactoring into a js script](https://github.com/facebook/react-native/pull/36267#discussion_r1272050735)

## Changelog:

[INTERNAL] [ADDED] - Added first working configuration for e2e testing

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

Test Plan:
You can play with this locally by [follow the readme](https://github.com/mateuszm22/react-native/blob/k+m/new-rn-tester-E2E/packages/rn-tester-e2e/README.md).

CircleCI jobs will be added.

Reviewed By: cipolleschi

Differential Revision: D47763012

Pulled By: cortinico

fbshipit-source-id: 6eb9674182b8ee97aea4784158c69bf017f379e5
2023-07-26 07:23:31 -07:00
Louie Colgan 823b1f467b fix: add signal to Request type (#38536)
Summary:
The `Request` interface provided by `types/react-native` doesn't have a `signal` property when it should as this is something that is accessible on the `Request` object.

![image](https://github.com/facebook/react-native/assets/10697889/f2d75973-61ff-4874-ad8e-2c0898b82d27)

For example, running the following:

#### Without providing a `signal`

```ts
console.log(new Request('https://www.facebook.com'));
```

will result in the following:

```ts
{"_bodyInit": undefined, "_bodyText": "", "bodyUsed": false, "credentials": "same-origin", "headers": {"map": {}}, "method": "GET", "mode": null, "referrer": null, "signal": {}, "url": "https://www.facebook.com"}
```

## Changelog:

[GENERAL] [FIXED] - Fixed missing property `signal` for the `Request` interface

## Reproduce

1. Add `new Request('https://www.facebook.com').signal` to a typescript file
2. TS will error `Property 'signal' does not exist on type 'Request'`

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

Test Plan:
Adding to `global.d.ts` in a file will resolve the problem, demonstrating that this works.

```ts
interface Request {
    readonly signal: AbortSignal | undefined
}
```

Reviewed By: NickGerleman

Differential Revision: D47660506

Pulled By: jacdebug

fbshipit-source-id: ef1459fbaca5d8f31bf8539bd61ac5e447111fec
2023-07-26 03:21:52 -07:00
Riccardo Cipolleschi 0f48e86fed Return NONE accessibility role if null is passed. (#38613)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38613

The `value` string of the ReactAccessibilityDelegate's `fromValue` method is marked as `Nullable`, however the `null` case is not handled.

This change handle the `null` case setting the accesssibility role to NONE.

## Changelog:
[Android][Fixed] - Set the accessibility role to `NONE` when a `null` string is passed to `fromValue`

Reviewed By: cortinico

Differential Revision: D47752098

fbshipit-source-id: e8a44bdd8874e996d8127cb2ee29e5135210b196
2023-07-26 00:49:08 -07:00
Luna Wei c1eec4cc51 Back out "Fix issue#11068 of duplicating characters when replacing letters to lowercase or uppercase in TextInput"
Summary:
Changelog: [Internal] - Back out https://github.com/facebook/react-native/pull/35929 due to https://github.com/facebook/react-native/pull/35929#discussion_r1272857008

Original Phabricator Diff: D47243817

Reviewed By: sunzhaoyuan

Differential Revision: D47785787

fbshipit-source-id: 81598be3f0b4e0e753dfbee4cee781673f900827
2023-07-25 23:44:14 -07:00