Commit Graph

38536 Commits

Author SHA1 Message Date
Ramanpreet Nara 51893c4e9f Make JS Representation cache all TurboModule properties (#36625)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36625

## Context
Previously, jsRepresentation would only cache the **HostFunctions** returned from TurboModule::createHostFunction().

## Changes
This diff replaces TurboModule::createHostFunction() with TurboModule::create().

Now, jsRepresentation will cache **all** the **properties** returned from TurboModule::create().

## Motivation
For interop modules, constants will be exported as properties on the TurboModule HostObject. This diff allows those constants (which are non HostFunctions) to be cached.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D44253229

fbshipit-source-id: d3dd042f4ccb6c076b83503f3712e4d1609388ce
2023-03-28 09:11:56 -07:00
Ramanpreet Nara 70239629e4 Attach Bridgeless nativeModuleProxy in TurboModuleBinding (#36626)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36626

In Bridgeless mode, With the TurboModule interop layer, the TurboModule system will need to customize the nativeModuleProxy global.

This customization would be much easier if the nativeModuleProxy global were installed by the TurboModule system (and not the Bridgeless core).

So, this diff moves nativeModuleProxy installation into the TurboModule system.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D43993197

fbshipit-source-id: 9361340c02e2d82c4e5f373f234f41dc9d72cbe4
2023-03-28 09:11:56 -07:00
Pieter De Baets a83c192550 Remove AllocInYoung/RevertToYGAtTTI from OSS Hermes config (#36679)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36679

We expose a variant of `HermesExecutor.java` which allows you to set a custom max heap size. This variant also sets the `AllocInYoung/RevertToYGAtTTI`, which should never really be used without a matching call to `HermesInternal.ttiReached()`, which is not documented.

Changelog: [Internal]

Reviewed By: jpporto

Differential Revision: D44457318

fbshipit-source-id: e91b377cbc0ac596cfbe7d1178e2657b868c1067
2023-03-28 08:28:32 -07:00
Rubén Norte 4e0dfedd51 Move ReactFabricPublicInstance out of the Renderer directory
Summary:
The `Renderer` directory is supposed to be only for files synced from the React repo. This moves the `public` directory that was added to it recently to the `ReactNative` directory.

Changelog: [internal]

bypass-github-export-checks

Reviewed By: sammy-SC

Differential Revision: D44421951

fbshipit-source-id: d098970b80cd467b5c772c3ae91ce716be373484
2023-03-28 04:31:49 -07:00
Ruslan Shestopalyuk 871f294bcb Fix dispatching into incorrect UIManager type when event's target is a root view (#36659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36659

## Changelog:

[Android][Fixed] - Fix dispatching into incorrect UIManager type when event's target is a root view

There is a function, called [ViewUtil.getUIManagerType](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.java#L22), which infers whether we are using the new or old architecture, given a View tag ID, with the assumption being that all New Architecture tags are even (and therefore, we are in the New Architecture iff the view tag is even). See [here for more context](https://github.com/facebook/react/pull/12587/files).

This function was used to find out which type of event dispatcher to dispatch to, when going down the chain of event dispatching function calls on Android.

The problem is, that there may be cases, when this odd/even assumption breaks, in particular when the target view ID is equal to `1`, meaning that it's a root view ID and there is nothing else mounted there yet.

It's very rare that this happens in practice, but still is possible that user interacts with the screen before anything is mounted there (or if there is nothing mounted there by design).

Reviewed By: javache

Differential Revision: D44421739

fbshipit-source-id: fd5ba3c882f6c7d3c9543ebc2ec30ba000f7ca4f
2023-03-28 03:08:13 -07:00
David Richey f708cc409f Enable unused-promise lint in xplat/js (#36589)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36589

Enable the unused-promise lint in xplat/js.

See https://flow.org/en/docs/linting/rule-reference/#toc-unused-promise for more details.

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D44156206

fbshipit-source-id: e318df09094be56604729f69d865657596f8d3c2
2023-03-27 23:50:24 -07:00
Luna Wei d9f7c4c189 Use @rnx-kit/rn-changelog-generator for changelog validation in danger (#36507)
Summary:
Currently we have a tool (rnx-kit/rn-changelog-generator) that extracts changelog messages from our commit history to generate the changelog for a React Native release.

In hopes of standardizing to one place where changelog validation occurs -- I've moved this logic to the package rnx-kit/rn-changelog-generator such that if the formatting ever changes, the changelog parsing is also updated.

Changelog: [Internal] - Updating danger to use logic in rnx-kit/rn-changelog-generator for changelog validation.

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

Test Plan: Tried `require`-ing the package and on a changelog message. I'm not sure exactly how to test a dangerfile -- IIRC it has to run off `main`

Reviewed By: cortinico, cipolleschi

Differential Revision: D44183479

Pulled By: lunaleaps

fbshipit-source-id: f65440f7b66a048f961d4698d78210c74e276452
2023-03-27 13:27:43 -07:00
Pieter De Baets ae0d714bbd Fix normalization of degrees in AnimatedInterpolation (#36645)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36645

This broke while changing the AnimatedInterpolation back in D40571873 and D40632443, as I assumed the native side would be able to correctly handle values such as '1rad'. However these were being sent over as strings, and were thus using the string interpolation path, which does not work here.

Instead, handle both `deg` and `rad` explicitly when generating the config in JS.

Resolves issue https://github.com/facebook/react-native/issues/36608

Changelog: [General][Fixed] Resolves Animated.Value.interpolate results in NaN when output is in radians

Reviewed By: yungsters

Differential Revision: D44406034

fbshipit-source-id: fe0f3df16f2b8ec6c31f9359e4706cacc72b9951
2023-03-27 12:38:16 -07:00
Genki Kondo 33612906d9 Trigger pointer leave when active controller switched (#36662)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36662

For VR, JSPointerDispatcher skips calculating the delta of hit targets (which happens in onMove) on the frame in which the active controller is switched because the motion event is a DOWN event, not a MOVE event in that specific frame.

This diff fixes the issue by just calling onMove in addition to onDown for DOWN motion events. Unfortunately we do not have separate pointer IDs for each controller.

This won't change the behavior for non-hoverable pointers. For hoverable pointers, it will dispatch an extra pointer_enter if the hit path has changed between the last move event and the down event.

Changelog:
[Internal][Fixed] - Trigger pointer leave when active controller switched

Reviewed By: lunaleaps, javache

Differential Revision: D44377324

fbshipit-source-id: 9f668e64f486b9a12ab36563ec2b7cf93f208a54
2023-03-27 12:31:37 -07:00
Alex Hunt 32e836dd8b Fix paths in objc-test.sh, temporarily exclude /IntegrationTests (#36648)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36648

Changelog: [Internal]

Blocker for https://github.com/facebook/react-native/pull/36623. The `test-ios` job in CI was misconfigured following the monorepo migration — and this becomes load-bearing with the incoming version of React Native CLI.

- Update `objc-test.sh` to run in `packages/rn-tester`, and exclude tests under `/IntegrationTests` which are outside of a Metro project directory.
    - **This is temporary** — a task has been created to move/split up/otherwise restore tests in `IntegrationTests`, which cipolleschi is following up (thanks!).
- Also fix `yarn start` script in `packages/rn-tester`.

Reviewed By: cipolleschi

Differential Revision: D44416533

fbshipit-source-id: 59c5b743d9d8fda206a12e37d94324ed9bfd703e
2023-03-27 11:21:56 -07:00
Pieter De Baets 406f9fc37b Make FabricUIManager's Binding an interface (#36613)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36613

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D44340265

fbshipit-source-id: 1ab4e434fa20840a40590ac2157fd7f817807990
2023-03-27 10:19:45 -07:00
Ruslan Lesiutin 04df252aa7 RN [refactor]: bump and realign package versions by running a single script (#36568)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36568

Changelog: [Internal]

Okay, so before the monorepo migration we had to use two scripts separately:
1. Bumping every package with `npm run bump-all-updated-packages`
2. Aligning other packages versions with `npm run align-package-versions`

The reason for it is that *before the monorepo* in a release branch cutoff process we had a step, which was removing `workspaces` keyword from `react-native` package. Without this keyword all new versions of packages will be resolved from npm (where they will be not available yet, because we have to publish them prior to it)

This is not the case for our current setup, and we can actually bump packages versions and they will be resolved as a workspaces successfully

Reviewed By: cortinico, cipolleschi

Differential Revision: D44261057

fbshipit-source-id: 31c2157be2d3b33bc073651d6045efcef2e8f5c5
2023-03-27 07:31:45 -07:00
MaeIg 5ff01bc1d2 Extract getCommandTypeNameAndOptionsExpression from component folders into parsers-common (#36640)
Summary:
This PR aims to remove the duplicated logic in [flow|typescript]/components/index.js files to move it in parsers-commons. It is a task of https://github.com/facebook/react-native/issues/34872:
> [Codegen 98 - assigned to MaeIg] Extract the namedExports.map(statement => ([Flow](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/flow/components/index.js#L76-L108), [TS](https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/parsers/typescript/components/index.js#L77-L109)) function in parser-commons, so that it accept a Parser parameter to unify the behaviors between flow and typescript. The Parser object needs to be enriched with all the methods to extract the required information from the Node, if they are not there yet.

## 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 getCommandTypeNameAndOptionsExpression from component folders into parsers-common

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

Test Plan:
yarn flow:
<img width="151" alt="image" src="https://user-images.githubusercontent.com/40902940/227719831-1a67f588-3bb2-48d7-8a43-4c5c8972155e.png">

yarn lint:
<img width="499" alt="image" src="https://user-images.githubusercontent.com/40902940/227719839-e5b591c3-9f3a-4da4-b3a5-67275c58584f.png">

yarn test
<img width="389" alt="image" src="https://user-images.githubusercontent.com/40902940/227719849-f3adfc4a-9215-4b1a-8807-c01801c54628.png">

Reviewed By: cipolleschi

Differential Revision: D44416032

Pulled By: rshest

fbshipit-source-id: eb682834d3da7a89661612667d9fc1df99ff3df0
2023-03-27 06:59:04 -07:00
Nick Gerleman 92b8981499 Mimimize EditText Spans 9/9: Remove addSpansForMeasurement() (#36575)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36575

This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.

D23670779 addedd a previous mechanism to add spans for measurement caching, like we needed to do as part of this change. It is called in more specific cases (e.g. when there is a text hint but no text), but it edits the live EditText spannable instead of the cache copy, and does not handle nested text at all.

We are already adding spans back to the input after this, behind everything else, and can replace it with the code we have been adding.

Changelog:
[Android][Fixed] - Mimimize EditText Spans 9/9: Remove `addSpansForMeasurement()`

Reviewed By: javache

Differential Revision: D44298159

fbshipit-source-id: 1af44a39de7550b7e66e45db9ebc3523ae9ff002
2023-03-24 23:43:32 -07:00
Marshall Roch ef4ae329d3 Upgrade to Flow v0.202.1
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D44378590

fbshipit-source-id: 604a7c2cabfa8e8f703d5d827b44a758d408401a
2023-03-24 16:17:05 -07:00
George Zahariev 2222b81ec2 Codemod long deprecated * type to any (#36634)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36634

X-link: https://github.com/facebook/metro/pull/957

The existential type `*` has been deprecated and just an alias for `any` since version 0.163. Codemod usage of it to `any`.
This helps with diff D44276187, which makes it always an error to use `*`.

Changelog: [internal]

Reviewed By: pieterv, SamChou19815

Differential Revision: D44358809

fbshipit-source-id: c6bb55430edd086958e16989c60bc2a0a131a3fe
2023-03-24 13:45:38 -07:00
Nick Gerleman b384bb613b Minimize EditText Spans 8/9: CustomStyleSpan (#36577)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36577

This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.

This change allows us to strip CustomStyleSpan. We already set all but `fontVariant` on the underlying EditText, so we just need to route that through as well.

Note that because this span is non-parcelable, it is seemingly not subject to the buggy behavior on Samsung devices of infinitely cloning the spans, but non-parcelable spans have different issues on the devices (they disappear), so moving `fontVariant` to the top-level makes sense here.

Changelog:
[Android][Fixed] - Minimize EditText Spans 8/N: CustomStyleSpan

Reviewed By: javache

Differential Revision: D44297384

fbshipit-source-id: ed4c000e961dd456a2a8f4397e27c23a87defb6e
2023-03-24 12:31:22 -07:00
Nick Gerleman 104cb7f81e Minimize EditText Spans 7/9: Avoid temp list (#36576)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36576

This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.

This change addresses some minor CR feedback and removes the temporary list of spans in favor of applying them directly.

Changelog:
[Internal]

Reviewed By: javache

Differential Revision: D44295190

fbshipit-source-id: bd784e2c514301d45d0bacd8ee6de5c512fc565c
2023-03-24 12:31:22 -07:00
Nick Gerleman 5791cf1f7b Minimize EditText Spans 6/9: letterSpacing (#36548)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36548

This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.

This change lets us set `letterSpacing` on the EditText instead of using our custom span.

Changelog:
[Android][Fixed] - Minimize EditText Spans 6/N: letterSpacing

Reviewed By: rshest

Differential Revision: D44240777

fbshipit-source-id: 9bd10c3261257037d8cacf37971011aaa94d1a77
2023-03-24 12:31:22 -07:00
Nick Gerleman 0869ea29db Minimize EditText Spans 5/9: Strikethrough and Underline (#36544)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36544

This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.

This change makes us apply strikethrough and underline as paint flags to the underlying EditText, instead of just the spans. We then opt ReactUnderlineSpan and ReactStrikethroughSpan into being strippable.

This does actually create visual behavior changes, where child text will inherit any underline or strikethrough of the root EditText (including if the child specifies `textDecorationLine: "none"`. The new behavior is consistent with both iOS and web though, so it seems like more of a bugfix than a regression.

Changelog:
[Android][Fixed] - Minimize Spans 5/N: Strikethrough and Underline

Reviewed By: rshest

Differential Revision: D44240778

fbshipit-source-id: d564dfc0121057a5e3b09bb71b8f5662e28be17e
2023-03-24 12:31:22 -07:00
Alex Hunt 155591bfad Hotfix: Lock RN CLI to 11.0.0-alpha.0 in template (#36631)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36631

Changelog: [Internal]

Hotfix for `main` branch CI stability after RN CLI `11.0.0` — the template as bootstrapped in CI needs to reference an exact version.

There is no published version (any more) for `11.0.0-alpha.2` (or `11.0.0-alpha.1`).

This is a temporary hotfix (we are trying to land https://github.com/facebook/react-native/pull/36623, but are stuck on infra issues).

- `11.0.0-alpha.0` includes `metro@0.75.0` (compatible).

More info: https://github.com/facebook/react-native/pull/36623#issuecomment-1482745547

Reviewed By: robhogan, NickGerleman

Differential Revision: D44371406

fbshipit-source-id: 870a59da521b55f957c8602125aecefb846e6ced
2023-03-24 11:48:50 -07:00
Genki Kondo ebc97a6c0f Revert D44307457: fix: make cursor center for different line height
Differential Revision:
D44307457

Original commit changeset: afeea5605ed8

Original Phabricator Diff: D44307457

fbshipit-source-id: 71423b895fb541584a322129e05223c8af7c4886
2023-03-24 09:34:44 -07:00
Nick Gerleman 8c9c8ba5ad Minimize EditText Spans 4/9: ReactForegroundColorSpan (#36545)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36545

This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.

This adds ReactForegroundColorSpan to the list of spans eligible to be stripped.

Changelog:
[Android][Fixed] - Minimize Spans 4/N: ReactForegroundColorSpan

Reviewed By: javache

Differential Revision: D44240780

fbshipit-source-id: d86939cc2d7ed9116a4167026c7d48928fc51757
2023-03-24 05:24:09 -07:00
Nick Gerleman cc0ba57ea4 Minimize EditText Spans 3/9: ReactBackgroundColorSpan (#36547)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36547

This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.

This adds `ReactBackgroundColorSpan` to the list of spans eligible to be stripped.

Changelog:
[Android][Fixed] - Minimize Spans 3/N: ReactBackgroundColorSpan

Reviewed By: javache

Differential Revision: D44240782

fbshipit-source-id: 2ded1a1687a41cf6d5f83e89ffadd2d932089969
2023-03-24 05:24:09 -07:00
Nick Gerleman b9e2627d1c Minimize EditText Spans 2/9: Make stripAttributeEquivalentSpans generic (#36546)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36546

This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.

This change generalizes `stripAttributeEquivalentSpans()` to allow plugging in different spans.

Changelog:
[Internal]

Reviewed By: rshest

Differential Revision: D44240781

fbshipit-source-id: 89005266020f216368e9ad9ce382699bd8db85a8
2023-03-24 05:24:09 -07:00
Nick Gerleman 1743dd7ab4 Minimize EditText Spans 1/9: Fix precedence (#36543)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36543

This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.

We cache the backing EditText span on text change to later measure. To measure outside of a TextInput we need to restore any spans we removed. Spans may overlap, so base attributes should be behind everything else.

The logic here for dealing with precedence is incorrect, and we should instead accomplish this by twiddling with the `SPAN_PRIORITY` bits.

Changelog:
[Android][Fixed] - Minimize Spans 1/N: Fix precedence

Reviewed By: javache

Differential Revision: D44240779

fbshipit-source-id: f731b353587888faad946b8cf1e868095cdeced3
2023-03-24 05:24:09 -07:00
Nick Gerleman 05fd10d12f Fix default shadow radius in TextAttributeProps (#36621)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36621

After D44302691 enabled textShadow, there was a subtle 1px shadow on any new text which I did't spot, but screenshot tests did (after commit which is non-ideal, but there is more work to make these land blocking).

This is because unlike `ReactBaseTextShadowNode` in paper which defaults to a radius of zero (no shadow), `TextAttributes` in Fabric defaults to a radius of 1px. Just previously never displayed.

Without shadow:
https://pxl.cl/2z2wX

With shadow:
https://pxl.cl/2z2x0

This changes the default to zero, which will cause us to skip adding the span, and matches previous behavior in Paper.

I double-checked the other props are defaulted the same way between `BaseTextShadowNode` (Paper) and `TextAttributes` (Fabric).

Changelog:
[Android][Fixed] - Fix default shadow radius in TextAttributeProps

Reviewed By: javache

Differential Revision: D44364446

fbshipit-source-id: d207367608291048001403d292f881c0842113f9
2023-03-24 04:31:06 -07:00
Nick Gerleman 776fe7a292 Bail on realizing region around last focused cell if we don't know where it is (#36541)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36541

We only know where the last focused cell lives after it is rendered. Apart from dead refs handled in D43835135, this means items added or removed before the focused cell will lead to a stale last index for the next state update.

We don't have a good way to correlate cells after data change. This effects the implementation for [`maintainVisibleContentPosition`](https://github.com/facebook/react-native/pull/35993) as well, but needs some thought on the right way to handle it. For now, we bail when we don't know where the last focused cell lives.

Changelog:
[General][Fixed] - Bail on realizing region around last focused cell if we don't know where it is

Reviewed By: yungsters

Differential Revision: D44221162

fbshipit-source-id: 8fc7e726fe13c62b98870600563857bb89290280
2023-03-24 02:30:20 -07:00
Nick Gerleman aab47634ad Fix textShadow on Android Fabric (#36585)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36585

1. We don't add `ShadowStyleSpan` unless an offset is set. This is incorrect, and less permissive than `BaseTextShadowNode` in Paper.
2. We don't serialize textShadowOffset to MapBuffer

Changelog:
[Android][Fixed] - Fix textShadow on Android Fabric

Reviewed By: javache

Differential Revision: D44302691

fbshipit-source-id: 2cfd3bff3d0e4f329c98d1ed2defff94ad3b7dc3
2023-03-23 21:39:20 -07:00
Soumyajit Behera 987c6fd298 fix: make cursor center for different line height (#36586)
Summary:
Currently in multiline input the cursor touches the previous line.
So this reduces its height sets its position so that I does not touch previous line.
This PR will also fix the issue https://github.com/facebook/react-native/issues/28012 (Problem with TextInput lineHeight on iOS)
This RP will fix the issue caused in
[PR](https://github.com/facebook/react-native/pull/36484)

Changelog:
[iOS][Added] - Fixed cursor height on multiline text input

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

Test Plan:
Tested for different cursor height

https://user-images.githubusercontent.com/46092576/227004355-3886a0b5-7cdb-4fdc-a16b-3c4abb729737.mov

https://user-images.githubusercontent.com/46092576/227004361-48099f81-9f52-460d-8ae8-d0ddb09dc47d.mov

Reviewed By: javache

Differential Revision: D44307457

Pulled By: genkikondo

fbshipit-source-id: afeea5605ed8557cdeec1e62324c85665ce367d6
2023-03-23 11:37:01 -07:00
Riccardo Cipolleschi a45d346823 Fixed script for Packager.sh in RNTester (#36582)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36582

This change should fix the path to run packager.sh directly from Xcode, this was broken after the Monorepo work.

## Changelog:
[internal] - update path to run packager.sh

Reviewed By: huntie, hoxyq

Differential Revision: D44292167

fbshipit-source-id: 90e0291aa7a15189c72cae99c5d38c84c7243a80
2023-03-23 10:46:25 -07:00
Pieter De Baets 7259cb342e Forward-declare imports in Binding and FabricMountingManager (#36609)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36609

Some random cleanup as I prepare to make these classes a better injection point for future experiments.

* Forward-declare classes where possible to reduce header import
* Return references to shared_ptr instead of copies when there are no lifetime concerns
* Use a shared JClass instance in JFabricUIManager

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D44221018

fbshipit-source-id: 1660cac964abd10ce798473e26841503430efdfe
2023-03-23 10:34:33 -07:00
Pieter De Baets 3759a26214 Avoid property name conflicts in event-emitter codegen (#36591)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36591

If any of the properties used in event-emitter codegen conflict with `event` or `payload`, the generated code will fail to build, even if this generated code isn't used. Since these are quite common keys, prefix them with `$` (still valid C++) to avoid conflicts.

Changelog: [General][Fixed] Resolved property name conflicts in event-emitter codegen

Reviewed By: cipolleschi

Differential Revision: D44274619

fbshipit-source-id: 45e67850c49e082d8f9b1f85bb632d45a9fd4f1d
2023-03-23 09:05:16 -07:00
Lulu Wu 928f4fb9b4 Degrade debugging log to avoid confusion over warning
Summary:
To avoid unnecessary confusion caused by the warning here. Context https://fb.workplace.com/groups/rn.support/permalink/24454205640868054/

Changelog:
[Internal][Changed] - Degrade debugging log to avoid confusion

Reviewed By: genkikondo

Differential Revision: D44293359

fbshipit-source-id: 55480e6c9d04f56308f4320045e18a99ad111fa6
2023-03-23 06:51:45 -07:00
Alex Hunt 308838c0ff Remove 'import' from default Package Exports conditions (#955)
Summary:
X-link: https://github.com/facebook/metro/pull/955

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

Changelog:
[General][Changed] - Default condition set for experimental Package Exports is now `['require', 'react-native']`

The [Exports RFC](https://github.com/react-native-community/discussions-and-proposals/blob/main/proposals/0534-metro-package-exports-support.md) had assumed that supporting the `"import"` condition was a syntax-only difference, given we are not in a Node.js environment — and so was worthwhile to support for maximal ecosystem compatibility.

{F915841105}

This assumption is similar to [`--moduleResolution bundler` in TypeScript 5.0](https://github.com/microsoft/TypeScript/pull/51669):

> bundlers and runtimes that include a range of Node-like resolution features and ESM syntax, but do not enforce the strict resolution rules that accompany ES modules in Node or in the browser
> -- https://github.com/microsoft/TypeScript/pull/51669#issue-1467004047

However, robhogan has rightly pointed out that **we should not do this!**

- ESM (once transpiled) is **not** simply a stricter subset of in-scope features supported by CJS. For example, it supports top-level async, which would be breaking at runtime.
- We recently made the same change for our Jest environment:
    - https://github.com/facebook/react-native/commit/681d7f8113d2b5e9d6966255ee6c72b50a7d488a

As such, we are erring on the side of correctness and supporting only `['require', 'react-native']` in our defaults. At runtime, all code run by React Native is anticipated to be CommonJS. `"exports"` will instead allow React Native to correctly select the CommonJS versions of modules from all npm packages.

Metro changelog: [Experimental] Package Exports `unstable_conditionNames` now defaults to `['require']`

Reviewed By: robhogan

Differential Revision: D44303559

fbshipit-source-id: 0077e547e7775e53d1e4e9c3a9d01347f4fb7d4a
2023-03-23 06:06:42 -07:00
Riccardo Cipolleschi 0443c2aa71 Fix: Remove installation of Python 3 in CI for Windows (#36596)
Summary:
We used to have to install python 3 on windows. Starting from yesterday (22/03/2023) the `build_hermesc_window` job started failing because Python3 is already installed on the default machine.

## Changelog:

[INTERNAL] [FIXED] - Skip installing python 3 on Windows as it's already there.

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

Test Plan: CircleCI must be green

Reviewed By: hoxyq

Differential Revision: D44330936

Pulled By: cipolleschi

fbshipit-source-id: b58190f707be309d919aceb80af717046c9476b4
2023-03-23 04:45:27 -07:00
Pieter De Baets dd6d57eea1 Fix cxx codegen handling of optional return types (#36581)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36581

Found that the current codegen did not properly handle a return type of `?bool` because the branch of `constexpr (is_optional_v<T>)` assumed that T was always a JSI value that needed conversion, and `supportsToJs<bool, bool>` is false.

Changelog: [General][Fixed] Issue with TurboModule C++ codegen with optional return types

Reviewed By: christophpurrer

Differential Revision: D44302352

fbshipit-source-id: 0863de06da4e5e3c18f8a1ced7179d76d8e87b99
2023-03-23 03:10:25 -07:00
David Richey da027dd2fd Pre-suppress unused-promise lint errors in xplat/js (#36590)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36590

Pre-suppress unused-promise lint errors in xplat/js. The next diff enables the lint.

See https://flow.org/en/docs/linting/rule-reference/#toc-unused-promise for more details.

Changelog: [Internal]

drop-conflicts
bypass-lint

Reviewed By: pieterv

Differential Revision: D43967290

fbshipit-source-id: f36242a732dbc18bf7482adfb46ca2b77e1b1493
2023-03-22 18:24:22 -07:00
Pieter De Baets 0a8164d993 Fix off-by-one error in cxx codegen (#36574)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36574

We would previously generate the following codegen for optional args

```
return static_cast<NativeAudioModuleCxxSpecJSI *>(&turboModule)->playAudio(
    rt,
    args[0].asString(rt),
    args[1].isNull() || args[1].isUndefined() ? std::nullopt : std::make_optional(args[1].asString(rt)),
    args[2].isNull() || args[2].isUndefined() ? std::nullopt : std::make_optional(args[2].asString(rt)),
    args[3].asNumber(),
    count < 4 || args[4].isNull() || args[4].isUndefined() ? std::nullopt : std::make_optional(args[4].asObject(rt)),
    count < 5 || args[5].isNull() || args[5].isUndefined() ? std::nullopt : std::make_optional(args[5].asObject(rt)),
    count < 6 || args[6].isNull() || args[6].isUndefined() ? std::nullopt : std::make_optional(args[6].asBool())
);
```

However, the counts checked are off-by-one, causing us to incorrectly process args.

Changelog: [General][Fixed] Issue with TurboModule C++ codegen with optional args

Differential Revision: D44299193

fbshipit-source-id: f00b9f5e09c2f524f9393137346c256d8b6b2979
2023-03-22 16:57:40 -07:00
Kyaw Thura 4a15f90208 Convert the emitCommonTypes implementation from a switch based implementation to a dictionary based one (#36549)
Summary:
Task from https://github.com/facebook/react-native/issues/34872
> [Codegen 80] Convert the emitCommonTypes implementation from a switch based implementation to a dictionary based one

## Changelog:

[Internal] [Changed] - Convert the emitCommonTypes implementation from a switch based implementation to a dictionary based one

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

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

Reviewed By: NickGerleman

Differential Revision: D44244901

Pulled By: rshest

fbshipit-source-id: 50712724c72aad3bd1dae3e7c381242c4913a236
2023-03-22 13:51:39 -07:00
Ruslan Lesiutin cf43f9c24b fix: update paths in React-rncore.podspec (#36571)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36571

Changelog: [Internal]

The problem is related to the way we use `js_srcs_dir` & `output_dir` options, one requires just relative path from current ruby script, other requires relative path from iOS root project (where the Podfile located)

output_dir was introduced in D43304641
resulted into the issue, described in https://discord.com/channels/514829729862516747/1087736932953509958

allow-large-files

Reviewed By: cipolleschi

Differential Revision: D44294112

fbshipit-source-id: 47fcf510e203d0880e1f92ab6ead09f4b79cb4dd
2023-03-22 10:21:14 -07:00
Pieter De Baets 8313f2382e Revert D44130814: reduce cursor size for multiline(TextInput)
Differential Revision:
D44130814

Original commit changeset: 09d53ecee681

Original Phabricator Diff: D44130814

fbshipit-source-id: 33c6fac5cb1f48a6e2461ff81564075eec466fb8
2023-03-22 08:40:27 -07:00
Rubén Norte ee76107d74 Bring ReactFabricHostComponent back to react-native (#36570)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36570

I'm doing some preparations to implement this proposal to bring some DOM APIs to React Native refs: https://github.com/react-native-community/discussions-and-proposals/pull/607

To make it easier to iterate on the proposal, and to improve the separation of concerns between React and React Native, I'm moving the definition of `ReactFabricHostComponent` (the public instance provided by React when using refs on host conmponents) to the `react-native` package.

I already did some steps in the React repository to simplify this:
* Removing unused imperative events that caused increased coupling: https://github.com/facebook/react/pull/26282
* Extracting the definition of the public instance to a separate module: https://github.com/facebook/react/pull/26291

In this case, in order to be able to move the definition from React to React Native, we need to:
1. Create the definition in React Native and export it through `ReactNativePrivateInterface`.
2. Update React to use that definition instead of the one in its own module.

This diff implements the first step.

`ReactNativeAttributePayload` is required by this definition and by the one for Paper that still exists in React. I moved it here so we only define it where we use it when we remove Paper. Paper will access it through `ReactNativePrivateInterface` as well. That will also allow us to remove a few other fields in that interface.

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: yungsters

Differential Revision: D43772356

fbshipit-source-id: 78dac152f415f19316ec90887127bf9861fe3110
2023-03-22 06:50:46 -07:00
Ruslan Lesiutin 64ea075141 RN [fix]: updated path to hermes-inspector-msggen package from react-native/ReactCommon (#36567)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36567

Changelog: [Internal]

Relative path has changed after the monorepo migration, but was overlooked

Reviewed By: cipolleschi

Differential Revision: D44290877

fbshipit-source-id: 4a5e45acf02624b11d513d56c49824a2c9ccc59e
2023-03-22 06:43:52 -07:00
Lorenzo Sciandra b312562f9a chore(e2e local script): fix e2e local script post monorepo refactoring (#36558)
Summary:
A quick fix for the local e2e script, a path needed to be updated.

## 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 e2e local script post monorepo refactoring

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

Test Plan: Run it locally.

Reviewed By: cortinico, cipolleschi

Differential Revision: D44257019

Pulled By: hoxyq

fbshipit-source-id: 29c4d4d103b5a041ef241cd371f31a1fc41d0396
2023-03-22 06:34:20 -07:00
Soumyajit Behera e1885853ac reduce cursor size for multiline(TextInput) (#36484)
Summary:
Currently in multiline input the cursor touches the previous line.
So this reduces its height sets its position so that I does not touch previous line.
This PR will also fix the issue https://github.com/facebook/react-native/issues/28012 (Problem with TextInput lineHeight on iOS)
## Changelog

[IOS] [ADDED] - Fixed cursor height on multiline text input
<!-- 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/36484

Test Plan:
UI Before the change
<img width="379" alt="Screenshot 2023-03-15 at 10 16 07 PM" src="https://user-images.githubusercontent.com/46092576/225380938-23b9b8a4-4b8a-45e1-bbf1-4af8ac8d9183.png">

UI After the change
<img width="509" alt="Screenshot 2023-03-14 at 1 57 27 AM" src="https://user-images.githubusercontent.com/46092576/225380930-77ca853c-fae5-4bfa-82cf-03b2e22bf8da.png">

Reviewed By: dmytrorykun

Differential Revision: D44130814

Pulled By: javache

fbshipit-source-id: 09d53ecee6812e9a875dc5364bd91b76cc2bc1f5
2023-03-22 05:32:09 -07:00
Ruslan Shestopalyuk 74107463ff Update pods for rn-tester
Summary:
## Changelog:
[Internal] -

Update the pods, which appear to be out of date, due to the corresponding OSS jobs being broken,

allow-large-files

Reviewed By: christophpurrer

Differential Revision: D44282378

fbshipit-source-id: 1d182361f26e692ba83ac6ec3d557e01e7281a29
2023-03-22 04:19:49 -07:00
Ruslan Shestopalyuk 70b5cb8530 Find and fix typos in yoga code (#36560)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36560

X-link: https://github.com/facebook/litho/pull/935

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

Changelog:
[Internal] -

A follow-up to D44172494, I've run a pass of [typos](https://github.com/crate-ci/typos) on the Yoga code to detect/fix typos in comments and identifiers (with a manual review afterwards).

Reviewed By: javache

Differential Revision: D44254911

fbshipit-source-id: 6e8bfe83ec2f963108450cdcb8c79dfc8d1a7375
2023-03-21 16:29:09 -07:00
Dmitry Rykun 7b86e3aaef Remove unused js_coverage job from CircleCI (#36513)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36513

We don't use JS test coverage badge on GitHub. Collecting this information is performed by `coveralls` package that is unmaintained for at least 2 years. Also it depends on `request` package that has security vulnerabilities, and became deprecated in 2020.

Changelog: [Internal]

Reviewed By: cortinico, cipolleschi

Differential Revision: D44168060

fbshipit-source-id: f76ae28f42b65e320a71dc227b2d07274a96f24e
2023-03-21 11:06:24 -07:00
Moti Zilberman 6abc097bf3 Remove dev-mode Hermes bytecode experiment
Summary:
Changelog: [General][Removed] Remove experimental support for loading bytecode from Metro

Removes the experimental bundling strategy that offloads Hermes bytecode compilation to the packager server. The React Native parts of this experiment were never part of the public API, and the Metro parts never fully shipped in open source.

Followup from D43597007.

Reviewed By: robhogan

Differential Revision: D43604705

fbshipit-source-id: db3be553750ccbf286d876f75858299c5b750f19
2023-03-21 09:52:50 -07:00