Commit Graph

38536 Commits

Author SHA1 Message Date
Nicola Corti 15ff82f811 Fix ClassCastException in ReactModalHostView (#43966)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43966

The `context` field was confusing. I've renamed it to `currentActivityContext` +
I've made sure the `onKey` method is using the right context with a this@ accessor.

Changelog:
[Android] [Fixed] - Fix ClassCastException in `ReactModalHostView`

Reviewed By: GijsWeterings

Differential Revision: D55870250

fbshipit-source-id: a25a31452fb0d21cf8e2807eca62cf09fe4fd74b
2024-04-08 08:14:39 -07:00
Andrew Datsenko e19423a4b0 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common:commonAndroid (#43927)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43927

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725544

fbshipit-source-id: 7e2066671e8a51f2559e2ab7e88a15117aeb3f1a
2024-04-08 07:11:36 -07:00
Ruslan Shestopalyuk a977b2e69b Migrate DevSettings related code to Kotlin (#43731)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43731

# Changelog:
[Internal] -

Converts code related to DevSettings Module/Activity to Kotlin.

Reviewed By: cortinico

Differential Revision: D55574529

fbshipit-source-id: 41057307d0a12685a937a232e02a1a7a15736abe
2024-04-08 06:56:34 -07:00
Samuel Susla 88b6e11508 delete ShadowNodeFragment::Value (#43962)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43962

changelog: [internal]

Not used, let's delete it.

Reviewed By: fabriziocucci

Differential Revision: D55689099

fbshipit-source-id: 37751aad8119a7421fc5f2f78230540da4a244ea
2024-04-08 06:43:48 -07:00
Ruslan Shestopalyuk b069fca5c5 Convert views/image interface files (#43742)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43742

## Changelog:
[Internal] -

As in the title - taking a subset of the views/image Java files, those that are related to interfaces, and convert them to Kotlin.

Reviewed By: tdn120

Differential Revision: D55589946

fbshipit-source-id: 60f03eaaca467821634d5b0195e42bfb931f65fb
2024-04-08 06:40:56 -07:00
Fabrizio Cucci 3a15af7467 Kotlinify NativeMethodCallInvokerHolderImpl (#43809)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43809

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: rshest

Differential Revision: D55687786

fbshipit-source-id: 45eb656e066348ee4b26d7c4b92db642361c7598
2024-04-08 05:24:39 -07:00
zhongwuzw 90296be1d4 Support launchOptions in bridgeless mode (#43757)
Summary:
Support launchOptions in bridgeless mode
bypass-github-export-checks
## Changelog:

[IOS] [FIXED] - Support launchOptions in bridgeless mode

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

Test Plan:
```
useEffect(() => {
    const processInitialURL = async () => {
      const url = await Linking.getInitialURL();
      if (url !== null) {
        console.log(`Initial url is: ${url}`);
      }
    };

    processInitialURL();
  }, []);
```

Reviewed By: javache

Differential Revision: D55790758

Pulled By: cipolleschi

fbshipit-source-id: 0f6aa6bdcebfc5bc42d632bea9193f122c1eb84f
2024-04-08 05:21:27 -07:00
Ruslan Shestopalyuk 5ea511736b MultiSourceHelper.java -> MultiSourceHelper.kt (#43776)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43776

## Changelog:
[Internal] -

As in the title.

Reviewed By: alanleedev

Differential Revision: D55640126

fbshipit-source-id: 1e35c77ebb56b8cf419a28dccfbbf695747b92e4
2024-04-08 03:27:26 -07:00
Ruslan Shestopalyuk c35cc43a6c ReactScrollViewHelper -> Kotlin (#43735)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43735

## Changelog:
[Internal] -

As in the title.

Reviewed By: tdn120

Differential Revision: D55576494

fbshipit-source-id: ee056b6ba629614a65440f68ad4dee5f53674879
2024-04-08 03:14:36 -07:00
Fabrizio Cucci 8ad308e847 Kotlinify NativeModule (#43898)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43898

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55792976

fbshipit-source-id: 6e096552750e3e0828cfdb9b62e45636731b3917
2024-04-08 02:55:46 -07:00
Riccardo Cipolleschi c0ed2f4c34 Remove boost version (#43920)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43920

React native is shipped as a whole, so it makes no sense for individual pods to specify which version of boost they support.

With this change we let the `react_native_pods` and the `boost.podspec` file to decide which version of boost is supported and all the other podspecs will follow.

## Changelog:
[Internal] - Remove explicit boost version from other podspecs

Reviewed By: NickGerleman

Differential Revision: D55801708

fbshipit-source-id: 3dcbbfb25010d2ee615afc4acfd5232fdc0c2a14
2024-04-08 02:51:59 -07:00
Ramanpreet Nara b52c7aa13c Remove mapbuffer from early js error handling (#43951)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43951

## Context
The **early js** error reporting pipeline catches javascript exceptions.

After errors are caught, the pipeline parses the exception, and puts the data into into a map buffer. 🤨

## Problems
We don't need to use a mapbuffer here: The structure of this exception data is known and never changes. (A map buffer is a type-unsafe bag of key/value pairs).

Instead, we could just use lower-level type-safe language primitives: regular C++ struct, and java class w/ fbjni.

## Changes
Migrate the **early js** error handling infra to C++ structs/fbjni.

## Impact
Now, there is no mapbuffer usage on iOS. We could re-introduce it when there is a need.

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D55265170

fbshipit-source-id: cda97633d4c6ccaad541e5d416067390fe6f61b2
2024-04-07 19:40:22 -07:00
Fabrizio Cucci 5927165822 Kotlinify Dynamic (#43905)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43905

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55793644

fbshipit-source-id: 8808bebfdc04d50ec8562839b7a20c6ecdc188ff
2024-04-07 08:27:47 -07:00
Fabrizio Cucci bbb7d2cb9d Kotlinify ReadableMap (#43904)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43904

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55793535

fbshipit-source-id: 13ddcd97da4a6a2ccc61b13291f64e7f6c9ed459
2024-04-07 06:43:35 -07:00
Fabrizio Cucci 9b54e226bd Kotlinify ReadableMapKeySetIterator (#43903)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43903

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55793441

fbshipit-source-id: 8963b07b7982680cda89e4b21a99653ec60609e4
2024-04-07 03:19:03 -07:00
Fabrizio Cucci a05466c5b7 Kotlinify WritableArray (#43902)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43902

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55793358

fbshipit-source-id: 7921597d2c445e1129404bcb83084b1e2887efe9
2024-04-06 13:33:25 -07:00
Fabrizio Cucci aae9fa24fa Kotlinify WritableMap (#43894)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43894

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: javache, cortinico

Differential Revision: D55793215

fbshipit-source-id: bec6ca309683831f4c976cc49c91698fb6dd6552
2024-04-06 06:29:15 -07:00
Samuel Susla 35d5754b36 add feature flag to enable explicit yoga node cleaning in TextInput (#43913)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43913

changelog: [internal]

We have this turned on in ParagraphShadowNode, let's roll it out for TextInput as well.

I came across this while profiling scroll performance when TextInput is part of the view hierarchy.

Reviewed By: javache

Differential Revision: D55751341

fbshipit-source-id: 2af20ddb5a4fb9b0ccd33217e60e8b9e8a95b920
2024-04-06 05:09:54 -07:00
Fabrizio Cucci 0e4aed1061 Kotlinify JSInstance (#43893)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43893

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55791330

fbshipit-source-id: 5b5b687a126cfe9dc867032a45033f0cb70dc31d
2024-04-06 05:08:51 -07:00
Fabrizio Cucci d50f6ffd8e Kotlinify ReadableArray (#43899)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43899

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55791026

fbshipit-source-id: 748da23474230ac6f7e48779ccd39058217202d5
2024-04-06 03:22:14 -07:00
Ramanpreet Nara 7facb32f30 Remove core modules from the default tmmdelegate (#43939)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43939

## Problem
If we link the default tmmdelegate with our vr apps, we get this issue:

```
ld.lld: error: duplicate symbol: facebook::react::NativeDevLoadingViewSpecJSI::NativeDevLoadingViewSpecJSI(facebook::react::JavaTurboModule::InitParams const&)
>>> defined at firsttimenux_v2AppModulesCodegen-generated.cpp:1367 (buck-out/v2/gen/fbsource/bcbe7a50bd5ff29a/arvr/libraries/react-panellib/FirstTimeNux/__firsttimenux_v2AppModulesCodegen-codegen-modules-jni_cpp__/out/firsttimenux_v2AppModulesCodegen-generated.cpp:1367)
>>>            firsttimenux_v2AppModulesCodegen-generated.cpp.pic.o:(facebook::react::NativeDevLoadingViewSpecJSI::NativeDevLoadingViewSpecJSI(facebook::react::JavaTurboModule::InitParams const&)) in archive buck-out/v2/gen/fbsource/bcbe7a50bd5ff29a/arvr/libraries/react-panellib/FirstTimeNux/__firsttimenux_v2AppModulesCodegen-jni__/libfirsttimenux_v2AppModulesCodegen-jni.pic.a
>>> defined at rncore-generated.cpp:606 (buck-out/v2/gen/fbsource/bcbe7a50bd5ff29a/xplat/js/react-native-github/__rncore-codegen-modules-jni_cpp__/out/rncore-generated.cpp:606)
>>>            rncore-generated.cpp.pic.o:(.text._ZN8facebook5react27NativeDevLoadingViewSpecJSIC2ERKNS0_15JavaTurboModule10InitParamsE+0x0) in archive buck-out/v2/gen/fbsource/bcbe7a50bd5ff29a/xplat/js/react-native-github/__rncore-jniAndroid__/librncore-jniAndroid.pic.a
```

## Cause
My best understanding of the problem:
- Default tmmdelegate links against rncore, which contains codegen for react native's standard library of modules.
- But, the default delegate also pulls in this appmodules.so library. That library also contains codegen for react native's standard library of modules + the app's modules.

So, two so libraries define the same symbols. Hence the build fails.

## Solution
Remove the codegen for react native's standard library of modules from the default tmmdelegate.

Prereq: In open source, also make appmodules.so include the codegen for react native's standard library of modules.

Changelog: [Android][Breaking] - Make the app responsible for returning core turbomodule jsi hostobjects

Reviewed By: cortinico

Differential Revision: D55613024

fbshipit-source-id: 6406a9f388ff9de01288de0e263a78a079e7a0da
2024-04-05 20:12:17 -07:00
Fabrizio Cucci a0d809cdd3 Kotlinify ViewGroupClickEvent (#43866)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43866

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: tdn120

Differential Revision: D55749364

fbshipit-source-id: 184c43da537e550842cb9a675c525fa18cdee9f6
2024-04-05 17:00:47 -07:00
Fabrizio Cucci 93a2dd9545 Kotlinify Systrace (#43917)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43917

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55796784

fbshipit-source-id: f793e94cee18af717b9de7a09ae8c478f2a3d5fe
2024-04-05 16:32:55 -07:00
Fabrizio Cucci 0ee40aac39 Kotlinify ReadableType (#43901)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43901

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55790585

fbshipit-source-id: e3b539626d93d195809101826f3be74f1054f946
2024-04-05 16:28:23 -07:00
Fabrizio Cucci f4bafdd616 Kotlinify ModulusAnimatedNode (#43889)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43889

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55767001

fbshipit-source-id: cec29691185f7f0b9fa99c8b0194e94af9fc5933
2024-04-05 16:22:49 -07:00
D N 0a0cd6517f chore: [TS] Remove tvParallaxProperties prop & add missing focusable, rejectResponderTermination props (#43912)
Summary:
I do TV developing using a RN, and found one missing prop in TS:

```tsx
<TouchableOpacity focusable={false} />
//                          ^^^ Error: Property focusable does not exist on type Readonly<TouchableOpacityProps>
```

Then I decides to compare Flow & TS types definitions and found more:

1.  `tvParallaxProperties` - [was removed](https://github.com/search?q=repo%3Afacebook%2Freact-native%20tvParallaxProperties&type=code) and never used in the runtime (but [`rn-tvos`](https://github.com/react-native-tvos/react-native-tvos/blob/92f73d1d7966dd41e3d8d9101a4e298e9462887b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.js#L299) has own ver. of `TouchableOpacity`  & handle its types)
2. `focusable` is missing
3. `rejectResponderTermination` is missing

## Changelog:

[GENERAL] [REMOVED] - [TS] Remove `tvParallaxProperties` prop from `TouchableOpacity` & add missing `focusable`, `rejectResponderTermination` props

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

Test Plan: TypeScript tests were updated

Reviewed By: NickGerleman

Differential Revision: D55805520

Pulled By: javache

fbshipit-source-id: 5eb8c65857beb86361e74b9369a1739b1ae18190
2024-04-05 15:28:26 -07:00
Fabrizio Cucci 81b27c9204 Kotlinify WindowFocusChangeListener (#43906)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43906

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: javache

Differential Revision: D55794517

fbshipit-source-id: 09301521494660b768633f23e60a55e5bea75dea
2024-04-05 14:16:41 -07:00
Fabrizio Cucci efb00077ae Kotlinify LinearCountingRetryPolicy (#43871)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43871

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: alanleedev

Differential Revision: D55753695

fbshipit-source-id: 4a46b02b2dd18981968371a94d2fa07af90fc74e
2024-04-05 14:14:06 -07:00
Fabrizio Cucci 7cffdf2d73 Kotlinify LayoutUpdateAnimation (#43890)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43890

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55766128

fbshipit-source-id: a7f5fc653bd44ec7fc9f4995e82193d8b0d28660
2024-04-05 14:09:29 -07:00
Andrew Datsenko 092ed2fc21 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/sound:soundAndroid (#43860)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43860

Changelog: [Internal]
_____

## Why?
We recommend to use Kotlin for any new code and are actively migrating Java code to Kotlin. This codemod service attempts to migrate existing Java code to Kotlin.

## How was this diff generated?
This codemod service scans through qualified paths and looks for Java modules. Then it runs `kotlinator.sh` on each module, which generated this diff.

## What if I see problems in this diff?
We recommend commandeering and fixing the diff. If you reject or abandon the diff, the codemod service will regenerate it in a few days
- Script for easily commandeer & open diff: In fbandroid, `scripts/commandeer_and_checkout.sh <DIFF>`. It not only commandeer the diff, but also rebase & open diff in Android Studio.
- Report repeating issues in [Kotlinator Papercut](https://fburl.com/papercuts/1g4f4qas)

See more useful tips & scripts in [Kotlin Auto-Conversion Codemod Wiki](https://fburl.com/wiki/c68ka0pu)

_____

## Questions / Comments / Feedback?

**Your feedback is important to us! Give feedback about this diff by clicking the "Provide Feedback" button below.**

* Returning back to author or abandoning this diff will only cause the diff to be regenerated in the future.
* Do **NOT** post in the CodemodService Feedback group about this specific diff.

_____

## Codemod Metadata

NOTE: You won't need to read this section to review this diff.

https://www.internalfb.com/intern/sandcastle/job/1239557953/

|Oncall|[kotlin_in_fb4a](https://our.intern.facebook.com/intern/oncall3/?shortname=kotlin_in_fb4a)|
|CodemodConfig|[fbsource/kotlinator.json](https://www.internalfb.com/codemod_service/fbsource%2Fkotlinator.json)|
|ConfigType|configerator|

Rules run:
- CodemodTransformerFBSourceScript

This diff was created with [CodemodService](https://fburl.com/CodemodService).

Reviewed By: cortinico

Differential Revision: D55725322

fbshipit-source-id: 8f78d221a8f04136019055a6ea64d8ec05bfd8a2
2024-04-05 14:08:53 -07:00
Fabrizio Cucci 5cf4f25d96 Kotlinify UnexpectedNativeTypeException (#43919)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43919

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55796709

fbshipit-source-id: 68609954bd6dd8f9a9d81c243df86f6e1b8a0f0d
2024-04-05 14:07:09 -07:00
Fabrizio Cucci f6a8e4337f Kotlinify PointerEvents (#43876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43876

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: tdn120

Differential Revision: D55764512

fbshipit-source-id: 49f3eabf8064d39ced9d28f240e91cfdc8ab98c9
2024-04-05 14:04:56 -07:00
Nicola Corti 98a38cc1a7 Convert the whole com.facebook.react.views.text.internal.span package to Kotlin (#43923)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43923

Another round of Kotlin migration.
This time I'm doing `com.facebook.react.views.text.internal.span` which has been recently been annotated as `Nullsafe`

Changelog:
[Internal] [Changed] - Convert the whole `com.facebook.react.views.text.internal.span` package to Kotlin

Reviewed By: tdn120

Differential Revision: D55802155

fbshipit-source-id: 4bed023557f45a43d921df73dfc685e547788fd4
2024-04-05 13:59:21 -07:00
Nicola Corti 47a00f97d8 Migrate AndroidUnicodeUtils to Kotlin (#43929)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43929

Migrate AndroidUnicodeUtils to Kotlin

Changelog:
[Internal] [Changed] - Migrate AndroidUnicodeUtils to Kotlin

Reviewed By: tdn120

Differential Revision: D55804037

fbshipit-source-id: 932fd08e3d826ddf131c74f8b4722732cd9ac46a
2024-04-05 13:55:48 -07:00
Fabrizio Cucci 2aef4418ea Kotlinify NativeGestureUtil (#43867)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43867

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: alanleedev

Differential Revision: D55750840

fbshipit-source-id: 356828e6fc9c1b4c77e130cce281e5503ffb0d16
2024-04-05 13:54:51 -07:00
Fabrizio Cucci d5dcaf3c1e Kotlinify DispatchStringCommandMountItem (#43870)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43870

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: alanleedev

Differential Revision: D55752447

fbshipit-source-id: 1965cc39601f514d0664d4d73bff4546f7c0f170
2024-04-05 13:47:44 -07:00
Fabrizio Cucci 3f05ad6e8e Kotlinify DispatchIntCommandMountItem (#43868)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43868

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: tdn120

Differential Revision: D55751796

fbshipit-source-id: 60349c63c11c27bb4049f41ae43bb84bd3090c21
2024-04-05 13:44:59 -07:00
Fabrizio Cucci 0c2d4d3fb8 Kotlinify LifecycleEventListener (#43897)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43897

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55790235

fbshipit-source-id: 9e1132304238137154467deeb96666abf537024f
2024-04-05 13:44:24 -07:00
Nicola Corti 2f46e1ac72 Move libreact_cxxreactpackage.so to INTERFACE library (#43930)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43930

We don't need `libreact_cxxreactpackage.so` as there is nothing to load. I'm moving this to be an INTERFACE library as there is only a Header file now to load.
Move libreact_cxxreactpackage.so to INTERFACE library

Changelog:
[Internal] [Changed] - Move libreact_cxxreactpackage.so to INTERFACE library

Reviewed By: javache

Differential Revision: D55805573

fbshipit-source-id: 9ef99c430c19250439b8ace5d26b0984a8fb759e
2024-04-05 12:19:22 -07:00
Nicola Corti d45b843398 Fix crash of RNTester on back navigation (#43931)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43931

RN Tester is crashing on back navigation with this stacktrace:

```
04-05 17:14:22.906 25051 25051 E AndroidRuntime: FATAL EXCEPTION: main
04-05 17:14:22.906 25051 25051 E AndroidRuntime: Process: com.facebook.react.uiapp, PID: 25051
04-05 17:14:22.906 25051 25051 E AndroidRuntime: java.lang.NullPointerException: Parameter specified as non-null is null: method com.facebook.react.devsupport.DoubleTapReloadRecognizer.didDoubleTapR, parameter view
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at com.facebook.react.devsupport.DoubleTapReloadRecognizer.didDoubleTapR(Unknown Source:2)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at com.facebook.react.ReactDelegate.shouldShowDevMenuOrReload(ReactDelegate.java:302)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at com.facebook.react.ReactActivityDelegate.onKeyUp(ReactActivityDelegate.java:158)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at com.facebook.react.ReactActivity.onKeyUp(ReactActivity.java:89)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.KeyEvent.dispatch(KeyEvent.java:2878)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.app.Activity.dispatchKeyEvent(Activity.java:4164)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at androidx.core.app.ComponentActivity.superDispatchKeyEvent(ComponentActivity.java:126)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at androidx.core.view.KeyEventDispatcher.dispatchKeyEvent(KeyEventDispatcher.java:86)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at androidx.core.app.ComponentActivity.dispatchKeyEvent(ComponentActivity.java:144)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at androidx.appcompat.app.AppCompatActivity.dispatchKeyEvent(AppCompatActivity.java:604)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at androidx.appcompat.view.WindowCallbackWrapper.dispatchKeyEvent(WindowCallbackWrapper.java:60)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at androidx.appcompat.app.AppCompatDelegateImpl$AppCompatWindowCallback.dispatchKeyEvent(AppCompatDelegateImpl.java:3413)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at com.android.internal.policy.DecorView.dispatchKeyEvent(DecorView.java:404)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$ViewPostImeInputStage.processKeyEvent(ViewRootImpl.java:6377)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:6243)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5725)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5782)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5748)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5913)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5756)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:5970)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5729)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5782)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5748)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:5756)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:5729)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:5782)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:5748)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:5946)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.ViewRootImpl$ImeInputStage.onFinishedInputEvent(ViewRootImpl.java:6104)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.inputmethod.InputMethodManager$PendingEvent.run(InputMethodManager.java:3159)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.inputmethod.InputMethodManager.invokeFinishedInputEventCallback(InputMethodManager.java:2723)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.inputmethod.InputMethodManager.finishedInputEvent(InputMethodManager.java:2714)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.inputmethod.InputMethodManager$ImeInputEventSender.onInputEventFinished(InputMethodManager.java:3136)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.view.InputEventSender.dispatchInputEventFinished(InputEventSender.java:154)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.os.MessageQueue.nativePollOnce(Native Method)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.os.MessageQueue.next(MessageQueue.java:335)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.os.Looper.loopOnce(Looper.java:161)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:288)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7842)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
04-05 17:14:22.906 25051 25051 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
```

This is happening because the `view: View` parameter is actually null at that point. I'm fixing it.

Changelog:
[Internal] [Changed] - Fix crash of RNTester on back navigation

Reviewed By: tdn120

Differential Revision: D55805574

fbshipit-source-id: 368109ef70725dad2cf72789b259726f859f05b8
2024-04-05 12:19:22 -07:00
Nicola Corti f14746f48b Fix broken HermesExecutor compilation (#43932)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43932

Converting to Kotlin the `RuntimeConfig` class caused the project to stop compiling.

Changelog:
[Internal] [Changed] - Fix broken HermesExecutor compilation

Reviewed By: tdn120

Differential Revision: D55805572

fbshipit-source-id: bc53c91280d65ecaf2605009b17045200669f240
2024-04-05 12:19:22 -07:00
Andrew Datsenko 0a7984435f //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/devtoolssettings:devtoolssettingsAndroid (#43922)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43922

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725626

fbshipit-source-id: 1cb1ced5adab5c3c20f12ae0783d1f01d73b4829
2024-04-05 12:16:55 -07:00
Andrew Datsenko 13432b5d8c //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/reactperflogger:reactperfloggerAndroid (#43872)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43872

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725695

fbshipit-source-id: bdb9112203c744b59e74bb099f8a994e3a8b8dbe
2024-04-05 11:53:25 -07:00
Andrew Datsenko dc8b7f8322 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/vibration:vibrationAndroid (#43918)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43918

Changelog: [Internal]
_____

## Why?
We recommend to use Kotlin for any new code and are actively migrating Java code to Kotlin. This codemod service attempts to migrate existing Java code to Kotlin.

## How was this diff generated?
This codemod service scans through qualified paths and looks for Java modules. Then it runs `kotlinator.sh` on each module, which generated this diff.

## What if I see problems in this diff?
We recommend commandeering and fixing the diff. If you reject or abandon the diff, the codemod service will regenerate it in a few days
- Script for easily commandeer & open diff: In fbandroid, `scripts/commandeer_and_checkout.sh <DIFF>`. It not only commandeer the diff, but also rebase & open diff in Android Studio.
- Report repeating issues in [Kotlinator Papercut](https://fburl.com/papercuts/1g4f4qas)

See more useful tips & scripts in [Kotlin Auto-Conversion Codemod Wiki](https://fburl.com/wiki/c68ka0pu)

_____

## Questions / Comments / Feedback?

**Your feedback is important to us! Give feedback about this diff by clicking the "Provide Feedback" button below.**

* Returning back to author or abandoning this diff will only cause the diff to be regenerated in the future.
* Do **NOT** post in the CodemodService Feedback group about this specific diff.

_____

## Codemod Metadata

NOTE: You won't need to read this section to review this diff.

https://www.internalfb.com/intern/sandcastle/job/1239558926/

|Oncall|[kotlin_in_fb4a](https://our.intern.facebook.com/intern/oncall3/?shortname=kotlin_in_fb4a)|
|CodemodConfig|[fbsource/kotlinator.json](https://www.internalfb.com/codemod_service/fbsource%2Fkotlinator.json)|
|ConfigType|configerator|

Rules run:
- CodemodTransformerFBSourceScript

This diff was created with [CodemodService](https://fburl.com/CodemodService).

Reviewed By: javache

Differential Revision: D55725326

fbshipit-source-id: f0960e42cf248ea78613299c16c6a47aa6169c7a
2024-04-05 11:46:39 -07:00
Fabrizio Cucci 49ea2a43c2 Kotlinify NativeArrayInterface (#43892)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43892

Changelog: [Internal]

As part of the Sustainability Week (see [post](https://fb.workplace.com/groups/251759413609061/permalink/742797531171911/)).

Reviewed By: cortinico

Differential Revision: D55789985

fbshipit-source-id: 5523012a66179b2a35cc046c948bfd4f7cccf200
2024-04-05 11:21:33 -07:00
Nicola Corti ed4106736a Convert ReactModalHostManager to Kotlin (#43844)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43844

This converts the last class inside `com.facebook.react.views.modal` to Kotlin

Changelog:
[Internal] [Changed] - Convert ReactModalHostManager to Kotlin

Reviewed By: javache

Differential Revision: D55739386

fbshipit-source-id: 6bf85449c2bfd6d81a2d899bd044835b9b72c185
2024-04-05 11:12:02 -07:00
Nicola Corti ab44550f6e Convert ReactModalHostView to Kotlin (#43845)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43845

This class is quite legacy and requires a couple of eyes before merging it.
I've tested that modals are working fine on RN-Tester both Old & New Arch.

Changelog:
[Internal] [Changed] - ReactModalHostView to Kotlin

Reviewed By: javache

Differential Revision: D55739128

fbshipit-source-id: 740d24df39ceb7b6a8120ae5315cf0684d1e6e27
2024-04-05 11:12:02 -07:00
Nicola Corti 20c1cc5e65 Bump AGP from 8.2.1 to 8.3.1 (#43925)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43925

Another diff to keep our dependencies updated.

Changelog:
[Internal] [Changed] - Bump AGP from 8.2.1 to 8.3.1

Reviewed By: cipolleschi

Differential Revision: D55803537

fbshipit-source-id: f94512799f5d32c667520cd11b8db38c93485ab7
2024-04-05 10:14:42 -07:00
Nicola Corti acd6d154e5 Bump Kotlin to 1.9.23 (#43928)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43928

This is a patch version for Kotlin, no practical changes expected.

Changelog:
[Internal] [Changed] - Bump Kotlin to 1.9.23

Reviewed By: cipolleschi

Differential Revision: D55803534

fbshipit-source-id: 99fcf444885cbc7b95baec2983303cfee88874a6
2024-04-05 10:14:42 -07:00
Nicola Corti ca7cc32288 Bump Gradle to 8.7 (#43926)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43926

Just keeping our dependencies up-to-date.

Changelog:
[Internal] [Changed] - Bump Gradle to 8.7

Reviewed By: cipolleschi

Differential Revision: D55803535

fbshipit-source-id: 90bc2902d8692f1fa621a088189f6bae74c3c61f
2024-04-05 10:14:42 -07:00