Граф коммитов

26736 Коммитов

Автор SHA1 Сообщение Дата
Dmitry Rykun b086e5dc0a chore: Add changelog for 0.68.6 and 0.69.8 (#36010)
Summary:
Create changelog for 0.69.8

## Changelog
[Internal] [Changed] - add changelog entry for 0.69.8

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

Test Plan: N/A

Reviewed By: rshest

Differential Revision: D42882254

Pulled By: dmytrorykun

fbshipit-source-id: 2cf12ab1898d292bd525d9c357203c69b58b3247
2023-01-31 08:01:08 -08:00
Nicola Corti 9e4b4ef2d5 Remove the `react-native-bot` context from CircleCI
Summary:
While working on T143721371 I've noticed that we still have an exposed context
for `react-native-bot` which gives access to `PAT_TOKEN` and `PAT_USERNAME`.
As those two variables are unused, we can fully clean this us.

Changelog:
[Internal] [Changed] - Remove the `react-native-bot` context from CircleCI

Reviewed By: cipolleschi

Differential Revision: D42886196

fbshipit-source-id: 4eba7a53557fe7af7d87650052630eea2d2d3934
2023-01-31 08:00:08 -08:00
Krystof Woldrich 86852f8cb5 Fix displayed name when codegen dependency is not found (#36013)
Summary:
The fixed error guides users toward the right missing dependency. The original error pointed to the old name.

## Changelog

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

Pick one each for the category and type tags:

[INTERNAL] [FIXED] - Display correct codegen dependency name when not found

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

[INTERNAL] [FIXED] - Display correct codegen dependency name when not found

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

Test Plan: This is an error message wording change.

Reviewed By: jacdebug

Differential Revision: D42881807

Pulled By: cipolleschi

fbshipit-source-id: d96fb867cfe27ae922d398ab981f5797cb51a269
2023-01-31 02:54:19 -08:00
Jordan Eldredge 83743e1edf Update React Native's synced sort-imports lint rule
Summary:
Changelog:
[Internal][Changed] - Update synced sort-import lint rule to newest version

Reviewed By: yungsters

Differential Revision: D42779224

fbshipit-source-id: bd388c258e5882331fd20d7313b4717a6b88f611
2023-01-30 17:05:25 -08:00
Sebastian Silbermann 8568b93733 react-native: Use number literals in TypeScript types for `FileReader` and `XMLHttpRequest` states (#36000)
Summary:
Mostly to improve compat in codebases where `lib.dom.d.ts` is loaded alongside RN. TS 5.0 updates to `lib.dom.d.ts` added number literals for these states as well so the abstract `number` type from RN was no longer compatible.

Forward-port of https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64144

Underlying flow types:
- https://github.com/facebook/react-native/blob/v0.71.1/Libraries/Blob/FileReader.js#L33-L35
- https://github.com/facebook/react-native/blob/v0.71.1/Libraries/Network/XMLHttpRequest.js#L54-L58

## Changelog

[GENERAL] [CHANGED] - Use number literals in TypeScript types for `FileReader` and `XMLHttpRequest` states

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

Test Plan: - [x] https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64144 green

Reviewed By: christophpurrer

Differential Revision: D42849886

Pulled By: jacdebug

fbshipit-source-id: c3cf2ac4f5f53ab889a9190583486da4627d3dcc
2023-01-30 15:13:31 -08:00
Genki Kondo 115dbe9433 In onLayoutChange, only scroll if the view is shown and the content view is ready
Summary:
ScrollViews don't properly maintain position where they are hidden and shown. When a ScrollView's content is laid out, onLayoutChange is triggered. This is also fired when the views are hidden, which is not desirable as the layout may not be accurate when the view is hidden. Check that the scroll view is showing before attempting a scroll.

Changelog:
[Internal][Fixed] - In onLayoutChange, only scroll if the view is shown and the content view is ready

Reviewed By: sshic

Differential Revision: D42808119

fbshipit-source-id: 0197ae55fa7d80e52c2ea483609e62d512a117f3
2023-01-30 14:06:37 -08:00
Genki Kondo 9e65ba2b7b In onLayout, only scroll if the content view is ready
Summary:
ScrollViews don't properly maintain position where they are hidden and shown. There is an edge case where on onLayout for a ScrollView, its content may not have been laid out yet. This happens in some cases when a scroll view is hidden via display: 'none' (resulting in setVisibility(INVISIBLE)). Check that the content view is laid out before attempting a scroll.

Changelog:
[Internal][Fixed] - In onLayout, only scroll if the content view is ready

Reviewed By: sshic

Differential Revision: D42794750

fbshipit-source-id: 654a380bcae306da2704d3e190423c8de125833d
2023-01-30 11:55:13 -08:00
Genki Kondo 47903d0c62 Restore scroll position when scroll view is hidden and shown
Summary:
ScrollViews don't properly maintain position where they are hidden and shown. On iOS, when a UIScrollView (or its ancestor) is hidden, its scroll position is set to 0 (its window also becomes nil). When it is shown again, its scroll position is not restored.

When a scroll is attempted when the scroll view is hidden, we keep track of the last known offset before it was hidden. Then, in updateLayoutMetrics (which is triggered when the view is shown), we apply the pending offset if there is one. This is [consistent with Android's behavior in ReactScrollView.java](https://www.internalfb.com/code/fbsource/[2930f8c146af62ad63673c8d34e9876b77634c05]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactScrollView.java?lines=289).

Changelog:
[Internal][Fixed] - In onLayoutChange, only scroll if the view is shown and the content view is ready

Reviewed By: cipolleschi

Differential Revision: D42815359

fbshipit-source-id: 4b209c1e54edf3f5c0bea902b48450a1a2e9661a
2023-01-30 11:10:51 -08:00
Nicola Corti c0004092f9 RNGP - Properly set the `jsRootDir` default value (#35992)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35992

Fixes https://github.com/software-mansion/react-native-gesture-handler/issues/2382

I've just realized that the default value fo `jsRootDir` is not entirely correct.
That's the root of the folder where the codegen should run.

For apps, it should be defaulted to `root` (i.e. ../../)
For libraries, it should be defaulted to `../` (currently is root).

This causes a problem where libraries without either a `codegenConfig` or a `react{ jsRootDir = ... }`
specified in the build.gradle will be invoking the codegen and generating duplicated symbols.

Changelog:
[Android] [Fixed] - RNGP - Properly set the `jsRootDir` default value

Reviewed By: cipolleschi

Differential Revision: D42806411

fbshipit-source-id: ffe45f9684a22494cc2e4d0a19de9077cb341365
2023-01-30 06:50:24 -08:00
Vitali Zaidman 112c89e810 refactor: Renamed emitPartial to emitObject (#35982)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35982

This reflects better what the former `emitPartial` was doing - emitting an object with set props.

Changelog: [Internal] - Renamed emitPartial to emitObject

Reviewed By: christophpurrer

Differential Revision: D42740958

fbshipit-source-id: 4f974c6911bc129e698323a8039bbd7aa7602461
2023-01-30 06:34:32 -08:00
Vitali Zaidman 84c1547526 refactor: Renamed emitObject to emitGenericObject (#35981)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35981

This reflects better what the former `emitObject` was doing - emitting a generic object.

It would also allow us to rename `emitPartial` to `emitObject` in the next diff whence the function name `emitObject` will be free.

Changelog: [Internal] - Renamed emitObject to emitGenericObject

Reviewed By: christophpurrer

Differential Revision: D42740871

fbshipit-source-id: 1b9112464695b8abeccc95eed908b0b45a0e3bf2
2023-01-30 06:34:32 -08:00
Ruslan Lesiutin 9856c334bd fix(publishing-bumped-packages): look for status code instaead of stderr (#36004)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36004

Changelog: [Internal]

This fixes CircleCI job, which is responsible for publishing bumped packages. We should not check for `stderr`, apparently `npm` uses it to store debug information:
- https://github.com/npm/npm/issues/118#issuecomment-325440

So we've tried to use this on 0.71-stable before and it succesfully published one package, but have exited right after it because `stderr` was not empty

Reviewed By: cortinico, cipolleschi

Differential Revision: D42836212

fbshipit-source-id: 6f2a9a512121683268fe6aae6a187fccb8d9dfbc
2023-01-30 06:22:12 -08:00
Riccardo Cipolleschi 8056cd7f05 Add Tests in CircleCI to check dynamic frameworks with the old arch (#36003)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36003

This diff adds 4 tests in CircleCI to make sure we don't regress in the support of Dynamic Frameworks for the old architecture.

## Changelog
[iOS][Fixed] - Add CircleCI tests for dynamic frameworks with the Old Architecture.

Reviewed By: cortinico

Differential Revision: D42829895

fbshipit-source-id: 5669be45d4f55161a11a6ece161b2a2aa384a644
2023-01-30 04:25:26 -08:00
Riccardo Cipolleschi b3040ec624 Restore Dynamic framework with Hermes in the Old Architecture
Summary:
I discovered that 0.69 could run React Native as Dynamic framework with Hermes and starting from 0.70 that's not possible anymore.
This diff restore that possibility.

Notice that now Hermes provisdes JSI and Dynamic Frameworks requires that all the dependencies are explicitly defined, therefore, whenever we have a pod that depended on `React-jsi`, now it also has to explicitly depends on `hermes-engine`

## Changelog
[iOS][Fixed] - Add Back dynamic framework support for the Old Architecture with Hermes

Reviewed By: cortinico

Differential Revision: D42829728

fbshipit-source-id: a660e3b1e346ec6cf3ceb8771dd8bceb0dbcb13a
2023-01-30 04:25:26 -08:00
Riccardo Cipolleschi da270d038c Restore Dynamic framework with JSC in the Old Architecture
Summary:
I discovered that 0.69 and 0.70 could run React Native as Dynamic framework with JSC and starting from 0.71 that's not possible anymore.
This diff restore that possibility.

## Changelog
[iOS][Fixed] - Add Back dynamic framework support for the old architecture

Reviewed By: cortinico

Differential Revision: D42829137

fbshipit-source-id: 848672f714d8bab133e42f5e3b80202b350d5261
2023-01-30 04:25:26 -08:00
Kræn Hansen dc959c9271 Update `react-native-xcode.sh` to use `PROJECT_DIR` from Xcode (#35970)
Summary:
In a mono-repo the `react-native` package could be hoisted compared to the app directory, in which case it's not a good strategy for the `react-native-xcode.sh` script to guess the app project root relative to the location of itself. Instead I suggest to relying on a build setting provided by Xcode to derive the default app path.

I could have use the `SRCROOT` instead. According to https://stackoverflow.com/questions/36323031/what-the-different-between-srcroot-and-project-dir this is equivalent and also a bit less ambiguous as I see it. I.e. I would expect most Xcode projects to be located in the `ios` directory of the app.

As a workaround, before this merge, users can add the following to their "Bundle React Native code and images" build phase or `ios/.xcode.env` file:

```shell
export PROJECT_ROOT="$PROJECT_DIR/.."
```

This build phase can also be used for users wanting to revert this default behaviour once merged.

## Changelog

[iOS] [Changed] - Changed default `PROJECT_ROOT` (used in when bundling for iOS) to rely on the `PROJECT_DIR` build setting.

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

Test Plan:
I've updated this locally and verified this does indeed pick up the correct app path - even in a mono-repo.

To verify this:
- Instantiate the template with this patch applied.
- Update the "Run scheme"'s "Build Configuration" to "Release".
- Build the app without errors.

Reviewed By: cortinico

Differential Revision: D42842636

Pulled By: cipolleschi

fbshipit-source-id: 040c31ac59a8abec5f5b38f795c8e74649420bac
2023-01-30 04:03:31 -08:00
Samuel Susla e91e468edc React Native sync for revisions d1e35c7...17f6912
Summary:
Three problems popped up during the sync:
- https://github.com/facebook/react/commit/07f46ecf2 breaks breaks tests
- https://github.com/facebook/react/commit/6fb8133ed breaks fbsource tests. I added a workaround and created a test for the team that owns the test.
- https://fb.workplace.com/groups/flowlang/permalink/1198137807458547/ enables local type interference in fbsource but not in github React repo and some code breaks. Addressed in https://github.com/facebook/react/pull/26064

This sync includes the following changes:
- **[17f6912a4](https://github.com/facebook/react/commit/17f6912a4 )**: Add flow types to ReactFiberHooks ([#25752](https://github.com/facebook/react/pull/25752)) //<Samuel Susla>//
- **[f101c2d0d](https://github.com/facebook/react/commit/f101c2d0d )**: Remove Reconciler fork (2/2) ([#25775](https://github.com/facebook/react/pull/25775)) //<Jan Kassens>//
- **[420f0b7fa](https://github.com/facebook/react/commit/420f0b7fa )**: Remove Reconciler fork (1/2) ([#25774](https://github.com/facebook/react/pull/25774)) //<Jan Kassens>//
- **[3ba7add60](https://github.com/facebook/react/commit/3ba7add60 )**: Allow async blocks in `to(Error|Warn)Dev` ([#25338](https://github.com/facebook/react/pull/25338)) //<Sebastian Silbermann>//
- **[fa11bd6ec](https://github.com/facebook/react/commit/fa11bd6ec )**: [ServerRenderer] Add option to send instructions as data attributes ([#25437](https://github.com/facebook/react/pull/25437)) //<mofeiZ>//
- **[e98225485](https://github.com/facebook/react/commit/e98225485 )**: Add ref cleanup function ([#25686](https://github.com/facebook/react/pull/25686)) //<Samuel Susla>//
- **[15557fa67](https://github.com/facebook/react/commit/15557fa67 )**: [Fix] properly track `useId` use in StrictMode in development ([#25713](https://github.com/facebook/react/pull/25713)) //<Josh Story>//
- **[8a23def32](https://github.com/facebook/react/commit/8a23def32 )**: Resubmit Add HydrationSyncLane ([#25711](https://github.com/facebook/react/pull/25711)) //<Tianyu Yao>//
- **[2655c9354](https://github.com/facebook/react/commit/2655c9354 )**: Fizz Browser: fix precomputed chunk being cleared on Node 18 ([#25645](https://github.com/facebook/react/pull/25645)) //<Jimmy Lai>//
- **[c08d8b804](https://github.com/facebook/react/commit/c08d8b804 )**: Revert "Add SyncHydrationLane" ([#25708](https://github.com/facebook/react/pull/25708)) //<Tianyu Yao>//
- **[56ffca8b9](https://github.com/facebook/react/commit/56ffca8b9 )**: Add Bun streaming server renderer ([#25597](https://github.com/facebook/react/pull/25597)) //<Colin McDonnell>//
- **[f31005d6a](https://github.com/facebook/react/commit/f31005d6a )**: Add SyncHydrationLane ([#25698](https://github.com/facebook/react/pull/25698)) //<Tianyu Yao>//
- **[f284d9faf](https://github.com/facebook/react/commit/f284d9faf )**: Track ThenableState alongside other hooks //<Andrew Clark>//
- **[6b4c0314e](https://github.com/facebook/react/commit/6b4c0314e )**: Check thenable instead of thenableState //<Andrew Clark>//
- **[33e3d2878](https://github.com/facebook/react/commit/33e3d2878 )**: Reuse hooks when replaying a suspended component //<Andrew Clark>//
- **[4387d752d](https://github.com/facebook/react/commit/4387d752d )**: Allow more hooks to be added when replaying mount //<Andrew Clark>//
- **[5eb78d0a0](https://github.com/facebook/react/commit/5eb78d0a0 )**: Pass ThenableState to replaySuspendedUnitOfWork //<Andrew Clark>//
- **[4a2d86bdd](https://github.com/facebook/react/commit/4a2d86bdd )**: Don't reset work loop until stack is unwound //<Andrew Clark>//
- **[9dfbd9fa9](https://github.com/facebook/react/commit/9dfbd9fa9 )**: use: Don't suspend if there are pending updates //<Andrew Clark>//
- **[44c4e6f4d](https://github.com/facebook/react/commit/44c4e6f4d )**: Force unwind work loop during selective hydration ([#25695](https://github.com/facebook/react/pull/25695)) //<Andrew Clark>//
- **[7b17f7bbf](https://github.com/facebook/react/commit/7b17f7bbf )**: Enable warning for defaultProps on function components for everyone ([#25699](https://github.com/facebook/react/pull/25699)) //<Sebastian Markbåge>//
- **[6fb8133ed](https://github.com/facebook/react/commit/6fb8133ed )**: Turn on string ref deprecation warning for everybody (not codemoddable) ([#25383](https://github.com/facebook/react/pull/25383)) //<Sebastian Silbermann>//
- **[07f46ecf2](https://github.com/facebook/react/commit/07f46ecf2 )**: Turn on key spread warning in jsx-runtime for everyone ([#25697](https://github.com/facebook/react/pull/25697)) //<Sebastian Markbåge>//
- **[d65b88d03](https://github.com/facebook/react/commit/d65b88d03 )**: Eagerly initialize an mutable object for instance.refs ([#25696](https://github.com/facebook/react/pull/25696)) //<Sebastian Markbåge>//
- **[c343f8025](https://github.com/facebook/react/commit/c343f8025 )**: [react-float] feature detect getRootNode ([#25689](https://github.com/facebook/react/pull/25689)) //<Jan Kassens>//
- **[e1dd0a2f5](https://github.com/facebook/react/commit/e1dd0a2f5 )**: Remove recoverable error when a sync update flows into a dehydrated boundary ([#25692](https://github.com/facebook/react/pull/25692)) //<Sebastian Markbåge>//
- **[c54e3541b](https://github.com/facebook/react/commit/c54e3541b )**: [DevTools] bug fix for Hydrating fibers ([#25663](https://github.com/facebook/react/pull/25663)) //<Mengdi Chen>//

Changelog:
[General][Changed] - React Native sync for revisions d1e35c7...17f6912

jest_e2e[run_all_tests]

Reviewed By: makovkastar

Differential Revision: D42804802

fbshipit-source-id: 6a9f00724cc73378025bbd04edb2d17760a87280
2023-01-30 01:51:33 -08:00
Ruslan Lesiutin 8d5f8804d8 save registry auth token before bootstrapping verdaccio (#35991)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35991

Changelog: [Internal]

While cherry-picking all this logic to `0.71-stable` branch, we've discovered several issues where some packages were failing to be published on Verdaccio proxy

This was failing only on node v16+, after some research, I've noticed that there might be a race-condition and npm unable to grab this token before first `npm publish` executes

Although this still work well on `main` branch, I am backporting it to keep aligned with `0.71-stable`

Reviewed By: christophpurrer, cortinico

Differential Revision: D42806081

fbshipit-source-id: af244d26ea529e6085ed5b2d731623dfaf78a14d
2023-01-27 11:01:45 -08:00
Sebastian Silbermann fac7859863 Add `TextInput`'s `inputMode` TypeScript types (#35987)
Summary:
Forward-porting https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64100/

## Changelog

[GENERAL] [FIXED] - Add `TextInput`'s `inputMode` TypeScript types

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

Test Plan: - [x] https://github.com/DefinitelyTyped/DefinitelyTyped/pull/64100/ green

Reviewed By: christophpurrer

Differential Revision: D42799862

Pulled By: jacdebug

fbshipit-source-id: b387fd8bc53e66d6125fee810862de3e292e6e74
2023-01-27 08:35:51 -08:00
Ruslan Shestopalyuk a00cea46bf Add missing C++ include for prop conversion of complex array type (#35984)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35984

[Changelog][Internal]

Codegen for props parsing was failing to add a required include for the case when the type is an array of objects, which in turn use non-trivial types.

Something like:
```
export type NativeProps = $ReadOnly<{
  ...ViewProps,
  bounds: $ReadOnlyArray<
    $ReadOnly<{
      height?: Float,
      left?: Float,
      top?: Float,
      width?: Float,
    }>,
  >,
}>;
```

would cause compilation errors on C++ side, since the required header for the `Float` conversion wasn't included.

Reviewed By: cipolleschi

Differential Revision: D42781128

fbshipit-source-id: d5b133b931a60e414761db0b3ed09893d3fcc9aa
2023-01-27 05:19:17 -08:00
SheetJS eaf465d0df Blob#slice end <= size (fixes #35959) (#35971)
Summary:
See https://github.com/facebook/react-native/issues/35959 .  Potentially fixes other issues including https://github.com/facebook/react-native/issues/34988

## Changelog

[INTERNAL] [FIXED] - Blob#slice end check avoids overflow

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

Test Plan: Added a test which fails against current release but passes after code changes.

Reviewed By: cipolleschi

Differential Revision: D42772352

Pulled By: jacdebug

fbshipit-source-id: 3c26baedad5cd459061459a9485ae20af1d2417b
2023-01-27 01:36:57 -08:00
Nicola Corti d30bd1bb21 Migrate nightly from scheduled workflow to scheduled pipeline (#35977)
Summary:
I'm moving nightlies from scheduled workflow to scheduled pipeline.
We're not able to manually retrigger nightlies as they're a scheduled workflow and don't expose a parameter. Here I'm cleaning it up.

Plus I'm:
1. Removing the `main_only` reference which is unused
2. Setting up the `run_release_workflow` and `run_nightly_workflow` parameters.

## Changelog

[INTERNAL] - Migrate nightly from scheduled workflow to scheduled pipeline

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

Test Plan: Will wait for CI results.

Reviewed By: cipolleschi

Differential Revision: D42776969

Pulled By: cortinico

fbshipit-source-id: d4ef9654d23cb91f85ce2b38e75e27dc0c575e95
2023-01-27 01:33:21 -08:00
Genki Kondo d3cc48d9a6 Add codegen support for DimensionValue for components (#35953)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35953

DimensionValue is a reserved prop type that can be a number or string (such as '50%'). On Java, it will get converted to a YogaValue (converter added to this diff); on C++ it will get converted to a YGValue (converter already exists as it's used in Fabric).

Changelog:
[Internal][Added] - Add codegen support for DimensionValue for components

Reviewed By: cipolleschi

Differential Revision: D42650799

fbshipit-source-id: 1d2bc30bbd93837dedbbb4c74f814963c8140957
2023-01-26 18:52:10 -08:00
Vitali Zaidman 97e707d897 simple support to the Partial<T> annotation (#35961)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35961

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

This fixes #35864

This feature allows using `$Partial<Obj>` in flow and `Partial<Obj>` in TypeScript based on the spec mentioned here: https://flow.org/en/docs/types/utilities/#toc-partial.

We currently only allow passing an Obj to Partial so
```
export type SomeObj = {
  a: string,
  b?: boolean,
};

export type PartialSomeObj = Partial<SomeObj>;
```
should work.
and also-
```
export type PartialSomeObj = Partial<{
  a: string,
  b?: boolean,
}>;
```
But not
```
export type PartialSomeObj = Partial<Partial<{
  a: string,
  b?: boolean,
}>>;
```
This can be improved in the future by a recursive unwrapping of the value inside the `Partial` annotation.

Changelog:
[General] [Added] -  Allow the use of "Partial<T>" in Turbo Module specs.

Reviewed By: christophpurrer, cipolleschi

Differential Revision: D42640880

fbshipit-source-id: 03a3fccc38ccfc7a5440fe11893beb68e77753f3
2023-01-26 12:30:38 -08:00
Xin Chen 53932d0022 Add extra logs to diagnose null view state issue
Summary:
We still see crashes for T112157805 and this diff is to add missing information to help diagnose the issue better.

We added a line of log to indicate which `mountItem` triggered the exception.

Changelog: [Internal]

Reviewed By: makovkastar

Differential Revision: D42556576

fbshipit-source-id: 4283c34cb18d601ca7b80d3524c9c65cc4ae3f8a
2023-01-26 09:13:24 -08:00
Marshall Roch ce75f89667 Upgrade to Flow 0.198.2
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D42766915

fbshipit-source-id: 12248ce404902871509eea7b40aa6716931dbec3
2023-01-26 08:21:15 -08:00
Nick Gerleman be69c8b5a7 Mitigation for Samsung TextInput Hangs (#35967)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35967

In https://github.com/facebook/react-native/issues/35936 we observed that the presence of AbsoluteSizeSpan may lead to hangs when using the Grammarly keyboard on Samsung.

This mitigation makes it so that we do not emit this span in any case where it is sufficient to rely on already set EditText textSize. In simple cases, tested on two devices, it causes typing into the TextInput to no longer hang.

This does not fully resolve the issue for TextInputs which meaningfully use layout-effecting spans (or at least font size), such as non-uniform text size within the input. We instead just try to reduce to minimum AbsoluteSizeSpan possible.

Testing the first commit was able to resolve hangs in some simpler inputs tested, by me and cortinico.

Changelog:
[Android][Fixed] - Mitigation for Samsung TextInput Hangs

Reviewed By: cortinico

Differential Revision: D42721684

fbshipit-source-id: e0388dfb4617f0217bc1d0b71752c733e10261dd
2023-01-25 21:21:51 -08:00
mym0404 a8166bd75b Fix crash by conditional value of aspectRatio style value (#35858) (#35859)
Summary:
fix https://github.com/facebook/react-native/issues/35858

## Changelog

1. Handle not `number` | `string` value passed to `aspectRatio`
2. Add some tests

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

Pick one each for the category and type tags:

[GENERAL] [FIXED] - Message

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

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

Test Plan:
## Sample
[Sample Repository](https://github.com/mym0404/rn-aspect-ratio-crash-sample)

Video

![1](https://user-images.githubusercontent.com/33388801/212956921-94b21cda-d841-4588-a05a-d604a82e204c.gif)

Reviewed By: necolas

Differential Revision: D42575942

Pulled By: NickGerleman

fbshipit-source-id: 2f7f46e6e3af85146e4042057477cb6d63b3b279
2023-01-25 17:15:19 -08:00
MaeIg 462815001b Extract parseString and parseModuleFixture functions in typescript and flow parsers (#35928)
Summary:
This PR aims to extract parseString and parseModuleFixture functions into the typescript and flow parsers. This task was proposed in https://github.com/facebook/react-native/issues/35158 and helps https://github.com/facebook/react-native/issues/34872.

## 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 parseString and parseModuleFixture functions in typescript and flow parsers

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

Test Plan:
yarn test:
<img width="386" alt="image" src="https://user-images.githubusercontent.com/40902940/213889984-f0cadaff-4472-42d6-b55b-4901023aad1e.png">

yarn flow:
<img width="166" alt="image" src="https://user-images.githubusercontent.com/40902940/213889974-21ac2483-2731-4cb1-a2b5-195d98619649.png">

yarn lint:
<img width="514" alt="image" src="https://user-images.githubusercontent.com/40902940/213889980-090af354-346f-4a9c-90bc-7006899f0819.png">

Reviewed By: jacdebug

Differential Revision: D42673866

Pulled By: cipolleschi

fbshipit-source-id: f1b5f8a7b3944e7e8223b25c0fb9bf4e8b512aa7
2023-01-25 12:38:52 -08:00
Samuel Susla 6f7428e27b Delete feature flag enable_simulate_image_props_memory_access
Summary:
changelog: [internal]

Clean up unused feature flag

Reviewed By: fkgozali

Differential Revision: D42709723

fbshipit-source-id: 289697dfb0c0378ff0369e1474150f7be68c8635
2023-01-25 05:43:38 -08:00
Samuel Susla 8863be41b1 Delete feature flag enable_crash_on_missing_component_descriptor
Summary:
changelog: [internal]

Clean up unused feature flag

Reviewed By: fkgozali

Differential Revision: D42709724

fbshipit-source-id: a124015783983dea28db31a4431183f5c30a30e7
2023-01-25 05:43:38 -08:00
Samuel Susla 51c03a0880 Delete feature flag react_fabric:enabled_skip_invalidated_key_frames_ios
Summary:
changelog: [internal]

clean up unused feature flag

Reviewed By: fkgozali

Differential Revision: D42709640

fbshipit-source-id: f64bb0eac67744dec321160c1cbe945e2dd74068
2023-01-25 05:43:38 -08:00
Samuel Susla 0a30aa3612 Enable layout animations on iOS in OSS
Summary:
changelog: Enable Layout Animations on iOS

[LayoutAnimations](https://reactnative.dev/docs/next/layoutanimation) in New Architecture have been disabled in OSS on iOS because of unresolved crash. This crash only happens rarely. Turning on LayoutAnimations in OSS should be safe and brings New Architecture to parity with old.

Reviewed By: fkgozali

Differential Revision: D42708774

fbshipit-source-id: b0f7febee3aa4f0ddac25556644198ebe79378c1
2023-01-25 05:43:38 -08:00
Nicola Corti ae557a1b03 Fix a couple of warnings in the ReactAndroid:hermes-engine build
Summary:
While buildling locally, those two warnings pop up.
- ANDROID_LD being unused by the CMake toolchain. I'm removing it.
- The Download task encountering a weak eTag. I'm updating it:
https://github.com/michel-kraemer/gradle-download-task

Changelog:
[Internal] [Changed] - Fix a couple of warnings in the ReactAndroid:hermes-engine build

Reviewed By: dmytrorykun

Differential Revision: D42738919

fbshipit-source-id: 7bd8785ad5b7431d557e2f8c8876b7c3f7294a43
2023-01-25 05:13:53 -08:00
Joshua Kaplan 2bfb53c2fb Use modern Podfile syntax to avoid polluting application build settings (#35954)
Summary:
Fixes conflicts in pod build settings like the one below:

Example warning
> Can't merge user_target_xcconfig for pod targets: ["RNReanimated", "hermes-engine"]. Singular build setting CLANG_CXX_LANGUAGE_STANDARD has different values.

Background:

> The former attribute xcconfig is deprecated and will cause a linter error when pushing new versions to trunk. The new attributes are available as pod_target_xcconfig and user_target_xcconfig, which makes their effects more clear. The latter attribute (user_target_xcconfig) should be used with great care, because well designed Pods should be self-contained and make as few assumptions about their environment as possible. Furthermore, this attribute can cause conflicts when different values are specified by two Pods for a build setting which doesn't allow multiple values and so cannot be merged.
- https://blog.cocoapods.org/CocoaPods-0.38/

## Changelog

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

Pick one each for the category and type tags:

[IOS] [FIXED] - Fix cocoapods warning about merging user_target_xcconfig

-->

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

Test Plan:
- Run in example app

## Related PR

- https://github.com/facebook/hermes/pull/903

Reviewed By: christophpurrer

Differential Revision: D42737921

Pulled By: jacdebug

fbshipit-source-id: 75d087a5287e660a703342d6e0ad6632f05f3c4c
2023-01-25 02:17:07 -08:00
Paul Mandel 305ca337c0 Adding AlertOptions to ts Alert.prompt function (#35957)
Summary:
Bringing the typescript function signature in-line with the js code.

## Changelog

[GENERAL] [FIXED] - Added AlertOptions argument to the type definition for Alert.prompt to bring it into parity with the js code.

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

Pick one each for the category and type tags:

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

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

Test Plan: Before the change, VS Code would show a typescript error when I pass AlertOptions to Alert.prompt (even though the js would execute successfully and respect the options I passed. After the change, when I use an Alert.prompt in VS code the function signature was recognized without errors.

Reviewed By: christophpurrer

Differential Revision: D42737818

Pulled By: jacdebug

fbshipit-source-id: 4d4318f38f5c7b7302aae62de5ce224db67e088a
2023-01-25 02:14:45 -08:00
Saad Najmi d5e6d9cecd Add a nil check to prevent a crash (#35941)
Summary:
This is a [change](https://github.com/microsoft/react-native-macos/pull/1120) we made in our fork (React Native macOS) that we are now upstreaming to reduce the number of diffs between React Native Core and React Native macOS. Also.. one less crash �!

Resolves https://github.com/microsoft/react-native-macos/issues/1679

Original PR notes:

> We've seen a crash downstream where -[NSString stringByReplacingCharactersInRange:withString:] receives a nil value as the replacement string. This is not good, since we expect that argument to be non-null.
>
>We believe that a cause of this is that -[RCTUITextField textView:shouldChangeTextInRange:replacementString:] is being called with nil as the replacement string. (This is legal, as per [Apple's documentation](https://developer.apple.com/documentation/appkit/nstextviewdelegate/1449325-textview?language=objc).) Right now, the only check that this delegate method does is enforcing the maxLength parameter if it exists, and changes in attributes shouldn't affect the length of the string.

## Changelog

[IOS] [FIXED] - `-[RCTUITextField textView:shouldChangeTextInRange:replacementString:]` no longer crashes when we pass in a `nil` replacement string

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

Test Plan: Build should pass. This change has been running in our fork in production for a while so we're fairly confident of it.

Reviewed By: cipolleschi

Differential Revision: D42705382

Pulled By: jacdebug

fbshipit-source-id: 066cd8a4ba134a681f0f4c955594b1fcda61a30e
2023-01-24 03:57:45 -08:00
Prakash Gurung b8f1bb50f7 Fix ScrollView automaticallyAdjustKeyboardInsets not resetting when Prefer Cross-Fade Transitions is enabled (#35933)
Summary:
Similar to the issue here https://github.com/facebook/react-native/pull/34503 but this is also happening if we just use `ScrollView` and `TextInput` with `automaticallyAdjustKeyboardInsets` enabled.

When we enable `Prefer Cross-Fade Transitions` in `iOS` we get a keyboard height of `0` which causes the inset/offset miscalculation and the content jumps up when the keyboard gets hidden.

## Changelog

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

Pick one each for the category and type tags:

[IOS] [FIXED] - Fix ScrollView `automaticallyAdjustKeyboardInsets` not resetting when Prefer Cross-Fade Transitions is enabled and keyboard hides

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

[IOS] [FIXED] - Fix ScrollView `automaticallyAdjustKeyboardInsets` not resetting when Prefer Cross-Fade Transitions is enabled and keyboard hides

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

Test Plan:
Tested with brand new react native project with/without the fix

before fix `automaticallyAdjustKeyboardInsets` with enabled/disabled opening/closing keyboard

https://user-images.githubusercontent.com/6507800/214039873-33bfb016-f99f-4644-9174-20bf32cf07d6.mov

after fix `automaticallyAdjustKeyboardInsets` with enabled/disabled opening/closing keyboard

https://user-images.githubusercontent.com/6507800/214039887-4054a749-ab15-4399-b6a9-73dc9283aa6b.mov

Reviewed By: christophpurrer

Differential Revision: D42686390

Pulled By: jacdebug

fbshipit-source-id: 98488e0c9639c19a4acae1a1de1a5fde411e2462
2023-01-24 03:25:25 -08:00
Frieder Bluemle efe5f62f91 Fix whitespace and newline at EOF (#35939)
Summary:
Just a couple of minor fixes in the `template/` folder:

- Remove a trailing space in `rn_edit_text_material.xml` (this was the _only_ trailing space present in a newly generated RN project), which results in the check against the empty tree object failing:
  ```
  $ git diff --check 4b825dc -- template/
  template/android/app/src/main/res/drawable/rn_edit_text_material.xml:23: trailing whitespace.
  +        <!--
  ```
- Add missing newline at end of file in `.watchmanconfig` and `app.json` - Both are text files, and each line (including the last) is expected to end with a newline character (flagged by Git, and also visible as a warning on GitHub):
  <img width="369" alt="image" src="https://user-images.githubusercontent.com/743291/214195867-81c8e622-2130-44d4-bdaf-588e3510c109.png">

## Changelog

[GENERAL] [FIXED] - Fix whitespace and newline at EOF in template

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

Reviewed By: christophpurrer

Differential Revision: D42698256

Pulled By: rshest

fbshipit-source-id: 765fd41d4f501aec578755c754ea0ecb290ae6ca
2023-01-24 03:00:08 -08:00
sottar 3876368f0c Update Podfile in template (#35931)
Summary:
Added comment on Podfile under template directory.
I'm working with monorepo and didn't realize it easily to specify the path for react_native_post_install, so I thought it would be better to add this comment.

## Changelog

[IOS] [ADDED] - add comments for specifying the path to React Native

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

Reviewed By: cipolleschi

Differential Revision: D42673707

Pulled By: jacdebug

fbshipit-source-id: 39e424a051d238f6dad42cb0b7748d4f4c400787
2023-01-24 02:29:00 -08:00
Janic Duplessis c19548728c Add maintainVisibleContentPosition support on Android (#35049)
Summary:
This adds support for `maintainVisibleContentPosition` on Android. The implementation is heavily inspired from iOS, it works by finding the first visible view and its frame before views are update, then adjusting the scroll position once the views are updated.

Most of the logic is abstracted away in MaintainVisibleScrollPositionHelper to be used in both vertical and horizontal scrollview implementations.

Note that this only works for the old architecture, I have a follow up ready to add fabric support.

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

[Android] [Added] - Add maintainVisibleContentPosition support on Android

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

Test Plan:
Test in RN tester example on Android

https://user-images.githubusercontent.com/2677334/197319855-d81ced33-a80b-495f-a688-4106fc699f3c.mov

Reviewed By: ryancat

Differential Revision: D40642469

Pulled By: skinsshark

fbshipit-source-id: d60f3e2d0613d21af5f150ca0d099beeac6feb91
2023-01-23 12:00:05 -08:00
Genki Kondo 04cf92fa9e Fix codegen for Array<EdgeInsetsValue>
Summary:
Changelog:
[Internal][Added] - Add support for props of type Array<EdgeInsetsValue>

Reviewed By: christophpurrer

Differential Revision: D42651078

fbshipit-source-id: 3b8683ab199c3d590136cec0e6a67e9e85aaa2c0
2023-01-23 11:06:09 -08:00
Arthur Kushka 114e03ebe5 react-native | remove unused internal feature flag
Summary: Changelog: [Internal]

Reviewed By: cortinico, fabriziocucci

Differential Revision: D42674577

fbshipit-source-id: c89c5532b9a828d41574a7b044aac10556aec8e5
2023-01-23 10:37:36 -08:00
fabriziobertoglio1987 49d5277afc remove duplicate role grid from RCTViewManager (#35932)
Summary:
Fix warning: duplicate key in dictionary literal. Different PRs tried to fix this issue at the same time and introduced a duplicate. Related 55c0df43b9 f3d9f2ea23

## Changelog

[IOS] [FIXED] - remove duplicate role grid from RCTViewManager

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

Test Plan: <img width="1920" alt="duplicated grid role on iOS" src="https://user-images.githubusercontent.com/24992535/214054716-d79dec11-2b5c-4780-a4af-08d50be4a1a2.png">

Reviewed By: sammy-SC

Differential Revision: D42677641

Pulled By: jacdebug

fbshipit-source-id: f3eaa99ce89d7f9602843fde0dc0f371300e7052
2023-01-23 10:21:52 -08:00
Krzysztof Magiera b44fe4deee Provide timestamp as argument to rAF callbacks when running Jest tests (#35919)
Summary:
This change aligns requestAnimationFrame implementation used in Jest environment with web standard, and with the implementation that runs in the application environment.

As per specification https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame#parameters – requestAnimationFrame callback gets a single parameter, which represents the current frame timestamp. The current polyfill maps requestAnimationFrame directly to setTimeout which makes the callback execute without any parameters.

## Changelog

[General] [Fixed] - Jest mocked requestAnimationFrame callbacks now receive a timestamp parameter

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

Test Plan:
1. execute jest test suite to make sure nothing breaks
2. add the below code to one of the tests:
```
jest.useFakeTimers();
requestAnimationFrame((timestamp) => console.log("rAF", timestamp));
jest.runOnlyPendingTimers();
jest.useRealTimers();
```
this code will print `undefined` before and numer `0` representing the mocked frame time after this change.

Reviewed By: jacdebug

Differential Revision: D42676544

Pulled By: robhogan

fbshipit-source-id: 363dc506ccc4bd034408fbb35ad3151875a8d309
2023-01-23 09:53:01 -08:00
Marshall Roch 9960327c41 Upgrade to Flow 0.198.1
Summary: Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D42666047

fbshipit-source-id: d0cc4d048151f3aa1d1033f6096125080dbf2cbd
2023-01-23 07:38:48 -08:00
Riccardo Cipolleschi 3367b6a895 Align USE_FRAMEWORKS usage between RNTester and the Template (#35790)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35790

This diff apply to RNTester the same logic we have in the template to control the `use_framework!` setting

This is a preliminary change to solve the `use_frameworks!` problems in the New Architecture for both the Template and RNTester.

## Changelog:
[iOS][Changed] - Align RNTester usage of the USE_FRAMEWORKS flag to the template

Reviewed By: cortinico, dmytrorykun

Differential Revision: D42387701

fbshipit-source-id: 28baf5a65b727269d55382de286a17de30e8895b
2023-01-23 07:21:01 -08:00
Mikhail Mikhaylov 1bab3e24b8 Removes duplicate DoubleTypeAnnotation label (#35920)
Summary:
Removes duplicate `DoubleTypeAnnotation` label since it is already presented in the same `switch` statement on https://github.com/facebook/react-native/blob/main/packages/react-native-codegen/src/generators/components/GeneratePropsH.js#L658

## 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
-->
[GENERAL] [FIXED] - Removes duplicate DoubleTypeAnnotation label

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

Test Plan: No tests needed

Reviewed By: cortinico

Differential Revision: D42673897

Pulled By: jacdebug

fbshipit-source-id: d4603364a26bda83990b65f76b93781a7152f1cb
2023-01-23 05:10:41 -08:00
Sheikh Jamir Alam f3155d0f80 Update RCTDevMenu.mm (#35910)
Summary:
Fixed typo with the word "running" in 2 places when failing to open Flipper.

Fixes https://github.com/facebook/react-native/issues/35899 .

Changelog:
[Internal] [Changed] - Fix typo with the word "running" when failing to open Flipper

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

Reviewed By: christophpurrer

Differential Revision: D42641042

Pulled By: sshic

fbshipit-source-id: acebb26ab921e98235c4f8e8535fa89be2ffa8cd
2023-01-23 05:04:03 -08:00
Vicary A a69a924d51 fix(deps): expose yarn peer dependencies (#35915)
Summary:
Fixes https://github.com/facebook/react-native/issues/35913

## CHANGELOG

[General] [Fixed] - Peer dependency warnings for Yarn 3

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

Test Plan:
```bash
yarn set version berry
yarn add react-native-changelog
```

Reviewed By: cortinico

Differential Revision: D42674105

Pulled By: jacdebug

fbshipit-source-id: 4270512b1b4857765a183389981b797cfecefcbd
2023-01-23 04:25:32 -08:00