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

26722 Коммитов

Автор SHA1 Сообщение Дата
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
Neil Dhar cd5a8c48c5 Only intercept JSIExceptions when constructing JSError
Summary:
Constructing a `JSError` currently catches all exceptions that occur,
regardless of their type, and embeds the information from them in the
newly created `JSError`. This means that the type of exceptions can be
silently changed.

This results in a bug if Hermes is built with
`HERMESVM_EXCEPTION_ON_OOM` enabled. The OOM exception will get
converted to a `JSError`, which in turn can get converted into a
regular JS exception. The regular JS exception can then be caught by JS
and ignored. This leads to the VM continuing to execute in a bad
state.

I considered three ways to fix this:
1. Add a new type of exception to JSI that is intentionally meant to be
ignored, and the Hermes OOM exception then subclasses it.
2. Propagate all exceptions that happen when constructing `JSError`.
3. Propagate all exceptions except `JSIException`s when constructing
`JSError`.

The first is technically the most surgical, but it adds complexity to
JSI, and will require some extra machinery to implement since we
wouldn't be able to throw it directly from inside the VM. I'm also not
comfortable with the idea of JSI suppressing exceptions that are
completely unrelated to JSI.

The second is the simplest, and seems to match what JS would do if
`throw new Error()` itself threw, but there is some possibility that it
is a change in behaviour for existing code.

So the third approach, which is implemented in this diff, tries to
compromise between the two. Hermes can only ever throw `JSIException`s
from regular JS operations, so there should be no change for existing
code (except code that uses exceptions on OOM, which is what we're
trying to fix). Any other exception gets passed through to the caller.

Changelog:
[Internal][Fixed] - Fixed handling of Hermes OOM exceptions in JSI.

Reviewed By: jpporto

Differential Revision: D41831616

fbshipit-source-id: 42e0dde1c4acc016ab19533941c58fc1797ba1c2
2023-01-22 00:25:49 -08:00
Luna Wei 8fbcb5cf94 RNTester: Number the WPT tests
Summary: Changelog: [Internal] Number WPT tests

Reviewed By: vincentriemer

Differential Revision: D42591932

fbshipit-source-id: 53d32692dc2fd2ec150e836b0ffb81cba87051ef
2023-01-20 15:16:28 -08:00
Luna Wei 675a7a12cf PointerEvents: Infer hoverability
Summary: Changelog: [Internal] Infer whether a pointer supports hover or not by presence of events

Reviewed By: vincentriemer, NickGerleman

Differential Revision: D42589958

fbshipit-source-id: aa42affc98ef78ebbf9a6e420684ed098869b905
2023-01-20 12:22:40 -08:00
Arushi Kesarwani 208f559505 Getting rid of Toast in Dev Loading View post Native Module is released (#35888)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35888

Changelog:
[Android][Removed] - For supporting Dev Loading View across multiple platforms, changed the Loading View of Android to rely on the native implementation instead of Toast. Getting rid of the JS changes relying on Toast for Dev Loading View now that the native module is released.

Reviewed By: rshest

Differential Revision: D42599220

fbshipit-source-id: ec7098b508c766c07384d48d3bffed075b092b72
2023-01-19 21:15:03 -08:00
Devon Mars 9cf35bfcc4 Add newline to UTFSequence
Summary:
Changelog:
[General][Added] - Added newline to UTFSequence

Reviewed By: bvanderhoof

Differential Revision: D42614321

fbshipit-source-id: 50af9815af9d2f57de1b216b4adf05bea6c4ad46
2023-01-19 14:04:23 -08:00
Thibault Malbranche 1405269270 add 0.71.1 changelog (#35902)
Summary:
Create Changelog for 0.71.1

## Changelog

[Internal] [Changed] - add changelog entry for 0.71.1

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

Test Plan: Not needed

Reviewed By: christophpurrer

Differential Revision: D42609062

Pulled By: cipolleschi

fbshipit-source-id: 60e5f9b49bb50fa451481161e9dc1037bb735582
2023-01-19 10:43:07 -08:00
Ruslan Shestopalyuk 059184e7ce setUpPerformance not to redirect to WebPerformance before the API is public (#35901)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35901

[Changelog][Internal]
Partially reverts the change that was redirecting `performance` instance to the new implementation in WebPerformance, until the actual implementation becomes public and native modules are included by default.

Reviewed By: rubennorte

Differential Revision: D42607379

fbshipit-source-id: c1ce995d20b9dfe7aef8436cea00d89b81e32932
2023-01-19 10:08:32 -08:00
Nick Gerleman 32f54877ff Do not use WindowInsetsCompat for Keyboard Events (#35897)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35897

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

Android 11 added native support for querying whether the IME is present along with its size, as part of the WindowInsets API. D38500859 (1e48274223) changed our logic for Android keyboard events to use it when available, fixing a longstanding issues where we could not reliably tell where the keyboard was open depending on softInputMode.

An androidx library WindowInsetsCompat aimed to backport some of the functionality to older versions of Android, with the same API, documenting IME queries to work down to API level 23 (Android 6). I used this, so that we would be able to remove our own logic for detecting keyboard insets once we supported 23+.

From an issue report, WindowInsetsCompat is not accurately returning whether the IME is open on at least Android 9. So this change makes it so we only use WindowInsets methods when they are provided by the OS (a tested golden path), and otherwise use the previously working heuristics on anything older.

Changelog:
[Android][Fixed] - Do not use WindowInsetsCompat for Keyboard Events

Reviewed By: christophpurrer

Differential Revision: D42604176

fbshipit-source-id: da6a0bbc34c36f8e6d4e4ac07bc96da048fd6aa8
2023-01-19 06:43:27 -08:00
Nick Gerleman 26580a3022 Remove legacy layout diffing
Summary:
This removes some unused flags which will cause Yoga to layout every tree twice, then diffing the tree, reporting whether the whole tree is different. This is too expensive to run outside of local experimentation, but we have more nuanced ways to implement the `YGNodeLayoutAffectedByQuirk` I am wanting to add.

Changelog: [Internal]

Reviewed By: lunaleaps

Differential Revision: D42406917

fbshipit-source-id: b415ed02768f6b59de3a6fa90c60c750d56fd4b0
2023-01-19 06:38:45 -08:00
Dimitar Nestorov e162b07982 Add `accessibilityLabelledBy` TypeScript type (#35883)
Summary:
`accessibilityLabelledBy` is missing from `AccessibilityPropsAndroid` TypeScript interface

## Changelog

[GENERAL] [FIXED] - Added missing `accessibilityLabelledBy` TypeScript type

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

Test Plan: Ran `yarn test-typescript` and `yarn test-typescript-offline` and there were no errors.

Reviewed By: christophpurrer

Differential Revision: D42604287

Pulled By: NickGerleman

fbshipit-source-id: 476d24d1c0257be787b7e84c2c11bcadc3527979
2023-01-19 05:57:51 -08:00
Janic Duplessis c289442848 Fix TurboModuleRegistry TS type (#35885)
Summary:
TurboModuleRegistry export functions and not a TurboModuleRegistry object. See https://github.com/facebook/react-native/blob/main/Libraries/TurboModule/TurboModuleRegistry.js#L37

## Changelog

[GENERAL] [FIXED] - Fix TurboModuleRegistry TS type

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

Test Plan:
Tested that the import doesn't generate a type error when used correctly.

```ts
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';

export default TurboModuleRegistry.get<Spec>('RNCSafeAreaContext');
```

Reviewed By: christophpurrer

Differential Revision: D42604208

Pulled By: NickGerleman

fbshipit-source-id: e6259df24aaf6e37b32cc4b51947294fd655837e
2023-01-19 05:56:51 -08:00
Dimitar Nestorov 71c4f57baf Add `accessibilityLanguage` type (#35882)
Summary:
`accessibilityLanguage` is missing from `AccessibilityPropsIOS` TypeScript interface

## Changelog

[GENERAL] [FIXED] - Added missing `accessibilityLanguage` TypeScript type

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

Test Plan: Ran `yarn test-typescript` and `yarn test-typescript-offline` and there were no errors.

Reviewed By: christophpurrer

Differential Revision: D42604363

Pulled By: NickGerleman

fbshipit-source-id: fb8dd4b5bba78a080473a9dc7b49a07587530229
2023-01-19 05:52:57 -08:00
Nick Gerleman 1fef376812 Fix invariant violation when nesting VirtualizedList inside ListEmptyComponent (#35875)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/35875

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

Nested VirtualizedLists register to their parents for updates, associated to a specfific cellKey set by VirtualizedListCellContextProvider. This cellKey is usually set when rendering a cell for a data item, but we can also render a nested VirtualizedList by putting one in a ListHeaderComponent/ListFooterComponent/ListEmptyComponent.

D6603342 (a010a0cebd) added cellKeys when we render from a header/footer, but not ListEmptyComponent, so that association would silently fail earlier.

D39466677 (010da67bef) added extra invariants to child list handling, that are now triggered by this case, complaining because we are trying to unregister a child list we never successfully registered, due to a missing cellKey.

This fixes the issue by providing a cellKey for ListEmptyComponent as well.

Changelog:
[General][Fixed] - Fix invariant violation when nesting VirtualizedList inside ListEmptyComponent

Reviewed By: christophpurrer

Differential Revision: D42574462

fbshipit-source-id: f76fa795bf471cb8a929c2efdbd814ea51927663
2023-01-19 05:13:50 -08:00
Elias Nahum 4cdc2c48e8 fix: ReactRootView checkForKeyboardEvents to check if rootInsets are set (#35869)
Summary:
react-native-navigation allows to register React components to be included in the navigation top bar as buttons, the way this work is by using the AppRegistry. When the ViewTreeObserver executes the `CustomGlobalLayout` we are checking for the RootWindowInsets in the `checkKeyboardEvents` which in the case for the top bar component it returns null and the **WindowInsetsCompat.toWindowInsetsCompat** function throws if the insets are null causing the app to crash.

Interestingly in the function `checkForKeyboardEventsLegacy` the null value is being checked, so I guess it was overlooked in the newer function.

## Changelog

[ANDROID] [FIXED] - Fix ReactRootView crash when root view window insets are null

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

Test Plan:
The following videos show how the app crashes as soon as we attempt to pop a screen that contains a react component as a button in the navigation top bar and how it correctly pops to the previous screen after applying the fix

| Crash | Fix |
| -- | -- |
| https://user-images.githubusercontent.com/6757047/213116971-fe693989-f978-438c-b8f9-fc56f2a477c8.mp4 | https://user-images.githubusercontent.com/6757047/213118352-fe258f28-07aa-4d17-98d2-97136464ffd5.mp4 |

Reviewed By: cipolleschi

Differential Revision: D42580156

Pulled By: cortinico

fbshipit-source-id: 4dbd656d7c8148df67668a2a50913206bc35c07f
2023-01-19 03:47:58 -08:00