Commit Graph
27059 Commits
Author SHA1 Message Date
Riccardo CipolleschiandFacebook GitHub Bot 3ac7a5ef4e Fix: Adapt template to new rules (#36705)
Summary:
Recently, we changed the logic to verify the body of a PR so that it is more compatible internally and externally, in both ways. But we forgot to update the template, so right
now, all the created PR are incompatible with the internal PR checker.
The required change is to have `:` after the Changelog title.
For consistency, I added the `:` after ALL the titles.

## Changelog:

[Internal] - Changed the PR template to align it to the new rules

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

Test Plan: No danger errors nor internal linter errors

Reviewed By: christophpurrer

Differential Revision: D44503519

Pulled By: cipolleschi

fbshipit-source-id: 43963c3cf774d19d6de8e86b18b684e76dd0fe87
2023-03-29 09:17:53 -07:00
Samuel SuslaandFacebook GitHub Bot a9e7da12af Do not strongly own State from Java (#36699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36699

Changelog: [internal]

This fixes a crash introduced in D43692171 where `jsi::Pointer` outlives `jsi::Runtime` in which it was created. This leads to a crash.
The diff changed ownership model, retaining `TextLayoutManager` strongly from `ParagraphState`.

To resolve this, in this diff we change how `StateWrapperImpl` owns state, moving from shared_ptr to weak_ptr. We have tried to do it previously in D26815275 but it had to be reverted because it broke end to end tests. I made sure the tests are fine. However it is the right ownership model. Java objects should not strongly hold onto anything in ShadowTree. If ShadowTree is destroyed, Java calls should noop, not keep objects in memory and have them handle the case when runtime was destroyed.

jest_e2e[run_all_tests]

Reviewed By: cipolleschi

Differential Revision: D44472121

fbshipit-source-id: 83b79329440ac1211902ea9511c0dde9a77ab9e9
2023-03-29 09:11:47 -07:00
Nicola CortiandFacebook GitHub Bot fec5658a32 Fix the setup to allow the build-from-source on host projects (#36702)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36702

With the monorepo changes we broke the build from source for users.
This fixes it so that folks can just follow the guide:
https://reactnative.dev/contributing/how-to-build-from-source

Changelog:
[Android] [Fixed] - Fix the setup to allow the build-from-source on host projects

Reviewed By: cipolleschi

Differential Revision: D44502428

fbshipit-source-id: 3ad8fb114f5e2f7ffdf6fffa617ceaa45334f5f3
2023-03-29 09:05:37 -07:00
Lorenzo SciandraandFacebook GitHub Bot 8eb28e77b9 add 0.71.5 changelog (#36698)
Summary:
Adds changelog for new patch.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

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

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

Test Plan: N/A

Reviewed By: christophpurrer

Differential Revision: D44502179

Pulled By: cipolleschi

fbshipit-source-id: fe0470ccc067966af3a98e6959702ca26c7af6db
2023-03-29 08:07:48 -07:00
Nicola CortiandFacebook GitHub Bot c1c22ebacc Convert the app template to Kotlin (#36696)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36696

As the title says, we're converting the new app template to Kotlin.
This will reduce the template size and make it more aligned to market standards.

Changelog:
[Android] [Changed] - Convert the app template to Kotlin

Reviewed By: mdvacca

Differential Revision: D44142081

fbshipit-source-id: 6111360b6580460eba0341e47c55704cc673e444
2023-03-29 05:09:32 -07:00
Nicola CortiandFacebook GitHub Bot 94debf1b3a Add Fabric Interop event example (#36692)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36692

Similar to the iOS counterpart,
this changes adds an example to RNTester to verify that the Interop Layer can process bubbling events in Fabric as it used to do in Paper.

Changelog:
[Internal] [Changed] - Add Fabric Interop event example

Reviewed By: cipolleschi

Differential Revision: D44467555

fbshipit-source-id: 1f1af27583c402641c549bc2926a64469dcd7b3f
2023-03-29 04:48:21 -07:00
Nicola CortiandFacebook GitHub Bot 7562eb5550 Add Fabric Interop constants example (#36693)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36693

Similar to #36417, this changes adds an example to RNTester to verify that the Interop Layer can process constants in Fabric as it used to do in Paper for Android.

Changelog:
[Android] [Added] - Add Fabric Interop constants example

Reviewed By: cipolleschi

Differential Revision: D44466391

fbshipit-source-id: 74e654319b93e60b415297dcdddc98eb100913df
2023-03-29 04:48:21 -07:00
Samuel SuslaandFacebook GitHub Bot e17385ab06 React Native sync for revisions 3554c88...77ba161
Summary:
This sync includes the following changes:
- **[77ba1618a](https://github.com/facebook/react/commit/77ba1618a )**: Bugfix: Remove extra render pass when reverting to client render ([#26445](https://github.com/facebook/react/pull/26445)) //<Andrew Clark>//
- **[520f7f3ed](https://github.com/facebook/react/commit/520f7f3ed )**: Refactor ReactDOMComponent to use flatter property operations ([#26433](https://github.com/facebook/react/pull/26433)) //<Sebastian Markbåge>//
- **[0131d0cff](https://github.com/facebook/react/commit/0131d0cff )**: Check if suspensey instance resolves in immediate task ([#26427](https://github.com/facebook/react/pull/26427)) //<Andrew Clark>//

Changelog:
[General][Changed] - React Native sync for revisions 3554c88...77ba161

jest_e2e[run_all_tests]

Reviewed By: poteto

Differential Revision: D44476026

fbshipit-source-id: c6935d760a068672b714722dee1fd24839c08c4b
2023-03-29 01:59:19 -07:00
Phillip PanandFacebook GitHub Bot bd7aa2c82d trigger codegenned reflection if module is a turbomodule (#36672)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36672

Changelog: [Internal]

if we look at usages of ReactModuleWithSpec, we see that it's existence was to simply identify generated native modules since the inheritance graph of native modules was different if they were generated.

this was introduced before we created the TurboModule interface, which all codegenned native modules also conform to. since that exists now, there's no need for both of these. this is the only callsite in our code where ReactModuleWithSpec triggers any logic, so i'm updating it.

bypass-github-export-checks

Reviewed By: javache

Differential Revision: D44450687

fbshipit-source-id: f9c26fce8e360b6e319153aad83fc788079bac91
2023-03-28 23:48:23 -07:00
Phillip PanandFacebook GitHub Bot e4a0a02d6a add unit test for method reflection on generated native modules (#36671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36671

Changelog: [Internal]

BaseJavaModuleTest tests the reflection of the native module methods wrapped by the JavaModuleWrapper abstraction, this abstraction is used by JNI in the C++ layer.

however, though we already have logic that supports the reflection of our codegenned modules (turbomodules), we didn't have a test for it yet, so i'm adding it in this change.

Reviewed By: javache, cortinico

Differential Revision: D44450433

fbshipit-source-id: 44abcf188d4b0559c684a95b058bd55e082b5531
2023-03-28 22:06:26 -07:00
Vincent RiemerandFacebook GitHub Bot a7f7f8aca9 Ensure Pressability doesn't forward onClick to onPress when it receives a click via pointer events (#36614)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36614

Changelog: [Internal] - Ensure Pressability doesn't forward onClick to onPress when it receives a click via pointer events.

This is a better version of D43128801 which ensures that click events which are triggered by the new pointer events event emitter don't trigger onPress in Pressability — avoiding the double onPress issue while ensuring all existing usecases of onClick continue to work.

Reviewed By: yungsters

Differential Revision: D44031433

fbshipit-source-id: 5ecdd132f7f91338c5a3632c05510f96495b512e
2023-03-28 16:00:20 -07:00
Phillip PanandFacebook GitHub Bot eaf8f8a161 decouple BaseJavaModuleTest from PowerMock (#36670)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36670

Changelog: [Internal]

so powermock doesn't have compatibility with JDK 18 (not sure what RN is on), but regardless my understanding is that we should be moving away from powermock since it's not maintained anymore.

this test was disabled because of that so this should allow it to run again.

Reviewed By: javache, cortinico

Differential Revision: D44445586

fbshipit-source-id: f9cabe80332a9ef11df690ac2af20bd60bb61641
2023-03-28 15:55:14 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot 1301d3c19b Refer BUCK file for WebPerformance tests to the new location in packages (#36687)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36687

## Changelog:

This apparently fell into the cracks during the recent (awesome! :)) monorepo migration, as the result the tests set for `WebPerformance` became empty.

Reviewed By: hoxyq

Differential Revision: D44466070

fbshipit-source-id: b13a696e73b18823f975946e8bc2e99d800d8891
2023-03-28 14:25:33 -07:00
Riccardo CipolleschiandFacebook GitHub Bot a881269503 Fix RNTester in main (#36686)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36686

After the recent changes of Metro and Metro-Config, we need to update the path used to load the bundle in RNTester

## Changelog:
[General][Fixed] - Use the right path to load RNTester bundle

Reviewed By: cortinico

Differential Revision: D44465418

fbshipit-source-id: 96170194579792f9a5d8a141328d43e45a4db973
2023-03-28 10:49:30 -07:00
Riccardo CipolleschiandFacebook GitHub Bot 6668e7bd03 Add support to build hermes from a specific commit (#36681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36681

This change is needed to add some E2E tests on the Hermes repo so that we can test Hermes against iOS other than android.

## Changelog:
[Internal][Added] - Add possibility to download Hermes from a specific commit

Reviewed By: cortinico

Differential Revision: D44460479

fbshipit-source-id: 89c196aa7c38533e4904444f7f17eb3236fc6356
2023-03-28 10:06:26 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot 4a5f55031c Don't cache UIManager type inside the Event data structure (#36677)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36677

## Changelog:

[Internal] - Don't cache UIManager type inside the Event data structure

A follow up to https://github.com/facebook/react-native/pull/36659

It's redundant, and it's good to have fewer "sources of truth" and keep the notion of UIManagerType separate from Event data structures.

Reviewed By: javache

Differential Revision: D44453812

fbshipit-source-id: 4efc0bb115bb4750e27afb2390afc9736ae67469
2023-03-28 09:39:39 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot 9ccf85e240 Fix hashing function in event name mapping in PerformanceEntryReporter (#36682)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36682

## Changelog:

[Internal][Fix] - Fix hashing function in event name mapping in PerformanceEntryReporter

A textbook mistake, when mapping event names via the constant lookup table, only the first 8 characters were effectively taken into account, thus mixing names of some events.

Reviewed By: rubennorte

Differential Revision: D44462195

fbshipit-source-id: 273891d92251014661af731618d8a549627b2983
2023-03-28 09:16:36 -07:00
Ramanpreet NaraandFacebook GitHub Bot 83056947aa Setup TurboModule interop test in Fb4a (#36669)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36669

The test: Route all TurboModules in Fb4a through the interop layer.

So now, instead of using the C++ codegen for method dispatch, TurboModules will instead be using JavaInteropTurboModule, which uses the ReactMethod annotations for method dispatch.

MobileConfig actualization diff: D44405316.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D44405336

fbshipit-source-id: 3b00028e26cdcd229e64630eef73409a3264636a
2023-03-28 09:11:56 -07:00
Ramanpreet NaraandFacebook GitHub Bot 1f7daf988b Finish the JS-facing side of the TurboModule interop layer (#36630)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36630

## Changes
This diff hooks up global.nativeModuleProxy to the TurboModule interop layer.

Now, when you call NativeModules.Foo, the TurboModule system will create the Foo interop module, and return it to JavaScript.

|**Language**|**Abstraction**|**Description**|
|Java/C++|MethodDescriptor| The information needed by JavaTurboModule::invokeJavaMethod() to execute a module method: [example](https://www.internalfb.com/code/fbsource/[78577e97310db97c489e976168ca6ddf4cb894c3]/xplat/js/react-native-github/ReactCommon/react/nativemodule/samples/platform/android/ReactCommon/SampleTurboModuleSpec.cpp?lines=34-36).|
|Java|TurboModuleInteropUtils| Takes the interop module object, and parses out MethodDescriptors from the methods annotated with ReactMethod|
|C++|JavaInteropTurboModule| Facilitates JavaScript -> Java method dispatch for interop modules. Extends [JavaTurboModule](https://www.internalfb.com/code/fbsource/[6f0698784af39dd0e881d9a69087ae6ac5e9cdc4]/xplat/js/react-native-github/ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.h?lines=28). Needs to be created with a list of MethodDescriptors.|

Shape of MethodDescriptor:
```
class MethodDescriptor {
    String methodName;
    String jniSignature;
    String jsiReturnKind;
    int jsArgCount;
}
```

## Example
global.nativeModuleProxy.Foo:
1. **Java:** Use TurboModuleManager to create the Java interop module for Foo
2. **Java:** Use TurboModuleInteropUtils to generate Foo's MethodDescriptors
3. **C++:** Use Foo's MethodDescriptors to create, cache, and return a JavaInteropTurboModule object to JavaScript.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D43918998

fbshipit-source-id: 562d3d7dc7f2ddb085dea6e94d72e1601012b741
2023-03-28 09:11:56 -07:00
Ramanpreet NaraandFacebook GitHub Bot 185bc248e4 Finish the Java-facing side of the TurboModule interop layer (#36627)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36627

## Changes
Now, when you call TurboModuleManager.getModule(interopModuleName), the TurboModuleManager will create and return that interop module to you.

Changes in this diff:
1. Forward interop NativeModules from app's ReactPackages to the TurboModuleManager
2. Extend TurboModule system's module creation algorithm to create interop NativeModules.

## Details
TurboModuleManagerDelegate's capabilities:
||API| Without Interop | With Interop |
|same|getModule()|Java [NativeModule](https://www.internalfb.com/code/fbsource/[e5db2a0dc412f0656f7eeec1db9d2da4aab61f40]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java?lines=21) that also implements [TurboModule](https://www.internalfb.com/code/fbsource/[c7089c1408eda109f342a1f33252533e743614ed]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModule.java?lines=11) |Java [NativeModule](https://www.internalfb.com/code/fbsource/[e5db2a0dc412f0656f7eeec1db9d2da4aab61f40]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java?lines=21) that also implements [TurboModule](https://www.internalfb.com/code/fbsource/[c7089c1408eda109f342a1f33252533e743614ed]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModule.java?lines=11) |
|new|getLegacyModule()| |Java [NativeModule](https://www.internalfb.com/code/fbsource/[e5db2a0dc412f0656f7eeec1db9d2da4aab61f40]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/bridge/NativeModule.java?lines=21) that **doesn't** implement [TurboModule](https://www.internalfb.com/code/fbsource/[c7089c1408eda109f342a1f33252533e743614ed]/xplat/js/react-native-github/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/interfaces/TurboModule.java?lines=11)|

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D43751055

fbshipit-source-id: 75afb6f836b8ec270bb916525ff2fc9030d34012
2023-03-28 09:11:56 -07:00
Ramanpreet NaraandFacebook GitHub Bot 7a08fbb088 Deprecate TurboModuleManagerDelegate.getLegacyCxxModule (#36667)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36667

## Context
TurboModuleManagerDelegate exposes two methods that create TurboModules:
- TurboModule getModule()
- CxxModuleWrapper getLegacyCxxModule()

## Problem
TurboModuleManagerDelegate.getLegacyCxxModule() is redundant: getModule() could just return all the modules that getLegacyCxxModule() returns: getLegacyCxxModule returns modules that implement TurboModule.

## Changes
So, let's deprecate getLegacyCxxModule(). This will simplify the implementation of TurboModuleManager.

Changelog: [Android][Deprecated] - Deprecate TurboModuleManager.getLegacyCxxModule

Reviewed By: cortinico

Differential Revision: D44407802

fbshipit-source-id: 88a6cf6597db76d8a74fd777d68ccf4f43aa6811
2023-03-28 09:11:56 -07:00
Ramanpreet NaraandFacebook GitHub Bot 3af66bf7fb Java: Make TurboModuleManager's APIs use NativeModule interface (#36629)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36629

The scope of TurboModuleManager is increasing:
- Eventually, it'll be capable of creating interop NativeModules (i.e: NativeModules that don't implement TurboModule).

So, instead of creating duplicate methods for NativeModules on the TurboModuleManager, this diff changes the APIs of TurboModuleManager to work with the NativeModule interface.

Thoughts?

## Questions
**Question:** Is this a breaking change for open source?
- Technically, yes. This diff changes the public interface of TurboModuleManager.

**Question:** How large of a thrash will this cause for open source apps?
- The thrash should be minimal. People in open source shouldn't be creating their own TurboModuleManager. They also shouldn't be directly accessing the TurboModuleManager object either.

**Question:** Is this change safe?
- Yeah. All the code that calls into TurboModuleRegistry converts TurboModules it returns into NativeModules.

**Question:** Is this change move us in the right direction?
- Long term, the TurboModule system will support legacy modules as well as TurboModules.
- I think it makes a lot of sense to have one Java-facing registry: after all, Java will just treat these NativeModules/TurboModules as regular Java objects, and call public methods on them. It doesn't care if the module is TurboModule-compatible or not.
- As for the TurboModuleRegistry abstraction, I think we should eventually rename this to NativeModuleRegistry after we delete the current NativeModuleRegistry.
- Still thinking about this though. I will leave this diff in review to welcome comments.

Changelog: [Android][Deprecated] - Deprecate TurboModuleRegistry.getModule(), getModules(), hasModule(),

Reviewed By: mdvacca

Differential Revision: D43801531

fbshipit-source-id: 4af7cbc2e2dc7c1d664acbd38c83aa93aae23c9f
2023-03-28 09:11:56 -07:00
Ramanpreet NaraandFacebook GitHub Bot cb07358b12 Make TurboModule system support int/float args/returns (#36628)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36628

The legacy NativeModule system supports integer and float in NativeModule method arguments and returns. This diff extends the TurboModule system for the same functionality. T

his is necessary because the TurboModule system will now need to dispatch method calls to legacy NativeModules.

NOTE: We can't actually test these changes until we run interop modules.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D44000389

fbshipit-source-id: 92282d582a0f98fcb88d83e460d4860a64fe1117
2023-03-28 09:11:56 -07:00
Ramanpreet NaraandFacebook GitHub Bot 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 NaraandFacebook GitHub Bot 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 BaetsandFacebook GitHub Bot 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 NorteandFacebook GitHub Bot 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 ShestopalyukandFacebook GitHub Bot 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 RicheyandFacebook GitHub Bot 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 WeiandFacebook GitHub Bot 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 BaetsandFacebook GitHub Bot 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 KondoandFacebook GitHub Bot 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 HuntandFacebook GitHub Bot 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 BaetsandFacebook GitHub Bot 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 LesiutinandFacebook GitHub Bot 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
MaeIgandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 RochandFacebook GitHub Bot 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 ZaharievandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 HuntandFacebook GitHub Bot 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 KondoandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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 GerlemanandFacebook GitHub Bot 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