Commit Graph

213 Commits

Author SHA1 Message Date
Ramanpreet Nara 457372c87e Add native view config for {margin,padding}{block,inline} props
Summary:
The margin/padding props were introduced in this diff: D41267765

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D56846578

fbshipit-source-id: 396cab3fdd63d9c630690157a385f1ae53208bb7
2024-05-02 12:46:05 -07:00
Ramanpreet Nara 063ae7d3e8 Add native view config for inset props
Summary:
The insets props were introduced in this diff: D42193661

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D56849870

fbshipit-source-id: 7be2a5825086ac954fdb8bc3bb86b57a2fa6d326
2024-05-02 12:46:05 -07:00
Ramanpreet Nara ef1e84e425 Add native view config for collapsableChildren
Summary:
collapsableChildren was introduced in D56226241

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D56849868

fbshipit-source-id: b2b08bfc2b8a35a863a91a53e1bee0b700c50f69
2024-05-02 12:46:05 -07:00
Ramanpreet Nara 5e46712dc8 Add native view config for experimental_layoutConformance
Summary:
experimental_layoutConformance was added in this diff: D47940100

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D56849869

fbshipit-source-id: 2346a869aa9d87916d074e54306d3c1230b7a91c
2024-05-02 12:46:05 -07:00
Pieter De Baets 90663081de Expose BaseJavaModule constructors through ViewManager
Summary:
ViewManagers are all BaseJavaModule, and thus have access to methods like `getReactApplicationContext`. We don't expose the appropriate constructors though to pass this context down from the base class.

Not a breaking change, as the no-arg constructor is still used implicitly.

Changelog: [Android][Fixed] ViewManagers can pass context to their base class.

Reviewed By: fabriziocucci

Differential Revision: D56804318

fbshipit-source-id: b0e6b15dfd7786073da058beccfaba2ff30daf5a
2024-05-01 11:49:53 -07:00
Nick Gerleman 7f5bff48dd Remove "deduplicated" Spannable path
Summary:
This removes the bulk of code added in https://github.com/facebook/react-native/pull/39630.

We're not shipping it, as it caused performance regressions.

Changelog:
[Internal]

Reviewed By: christophpurrer

Differential Revision: D56796936

fbshipit-source-id: 82f3a51cf145bc1695d70393e1f050685a1e6174
2024-04-30 22:30:05 -07:00
Jakub Piasecki 1f08799560 Fix textAlign with inline views on the new architecture on Android (#44146)
Summary:
On the new architecture on Android on the new arch, `textAlign` style was ignored (`Layout.Alignment.ALIGN_NORMAL` was always used) during the measurement of text. During this phase, the positions of attachments are also calculated, which results in inline views being always positioned as if alignment to the left was set. This PR updates the measurement logic to also take `textAlign` into account during measurement.

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

## Changelog:

[ANDROID] [FIXED] - Fixed `textAlign` not being taken into account when positioning views inlined in text

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

Test Plan:
<details>
<summary>I've been testing on the following code</summary>

```jsx
import { SafeAreaView, Text, View } from "react-native";

function InlineView(props) {
  return (<View style={{margin: 10}} >
    <Text style={{ textAlign: props.textAlign, backgroundColor: 'cyan' }}>
        Parent Text
        <Text style={{ fontWeight: 'bold' }}>Child Text</Text>
        <View style={{width: 50, height: 50, backgroundColor: 'red'}} />
        <Text style={{ fontWeight: 'bold' }}>Child Text</Text>
        {props.long && <Text style={{ fontWeight: 'bold' }}>aaaa a aaaa aaaaaa aaa a a a aaaaa sdsds dsdSAD asd ASDasd ASDas</Text>}
      </Text>
  </View>)
}

export default function Test() {
  return (
    <SafeAreaView style={{ flex: 1 }}>
      <Text style={{textAlign: 'center', fontSize: 20}}>BoringLayout</Text>
      <InlineView textAlign="left" />
      <InlineView textAlign="center" />
      <InlineView textAlign="right" />
      <InlineView textAlign="justify" />

      <Text style={{textAlign: 'center', fontSize: 20}}>StaticLayout</Text>
      <InlineView textAlign="left" long />
      <InlineView textAlign="center" long />
      <InlineView textAlign="right" long />
      <InlineView textAlign="justify" long/>
    </SafeAreaView>
  );
}
```

</details>

| Old architecture | New architecture |
|------------------|------------------|
| <img width="447" alt="Screenshot 2024-04-18 at 17 08 59" src="https://github.com/facebook/react-native/assets/21055725/b21848ff-3939-4dde-9f78-03ce50c9429a">            | <img width="447" alt="Screenshot 2024-04-18 at 17 04 46" src="https://github.com/facebook/react-native/assets/21055725/fb57a3c4-09e8-4db7-abc3-79747314529b">          |

Reviewed By: NickGerleman, cipolleschi

Differential Revision: D56361169

Pulled By: cortinico

fbshipit-source-id: c3002f65541774e376e315c3076a6157aa330f8d
2024-04-26 06:54:17 -07:00
Ramanpreet Nara b9e52f0807 Make DefaultReactHost configurable w/ cxxreactpackages
Summary:
One way we register cxx turbo modules with React Native is via cxxreactpackages.

This diff allows the application to pass in cxxreactpackages into the default react host, which allows the application to, in turn, register cxx modules with react native!

Changelog: [Android][Added] - Allow bridgeless apps to register cxx modules via cxxreactpackages

Reviewed By: cortinico

Differential Revision: D56547493

fbshipit-source-id: 4e8f02f0546c4b647a915fc65ea9687aa1592190
2024-04-25 16:28:59 -07:00
Nick Gerleman 7b44c8d1d0 Automatically disable flattening of scroll content view children when needed
Summary:
There are a couple scenarios where flattening the child of a ScrollView can cause problems.

1. `maintainVisibleContentPosition` on both Android and iOS rely on reading live positions in the view tree
2. `snapToAlignment` on Android uses live view tree, for items to snap to. iOS seems to have very different behavior, and aligns assuming that children are scroll view height, or that a snap interval has been set.

This change adds a prop `collapsableChildren` which can be used to disable children of scroll content view from being collapsed.

Differentiator is... complicated... but we can mostly just adapt the code dealing with existing traits at the surface level.

Changelog:
[General][Fixed] - Automatically disable flattening of scroll content view children when needed
[General][Added] - Add `collapsableChildren` prop

Reviewed By: javache

Differential Revision: D56226241

fbshipit-source-id: ed81f7fff5a15eac424708f763afc9b844aefa9c
2024-04-25 14:52:22 -07:00
Pieter De Baets 767197c9a2 Rollout enableFabricPendingEventQueue feature flag (#44208)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44208

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D56467342

fbshipit-source-id: 0461b16727af708769af363125bf51c0761c9505
2024-04-24 06:30:50 -07:00
Arushi Kesarwani e25860f07c Fixing exposing ReactDelegate through ReactActivity for reload() (#44227)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44227

In https://github.com/facebook/react-native/pull/44223/ kudo identified the incorrect return type.

Reviewed By: christophpurrer, philIip

Differential Revision: D56497700

fbshipit-source-id: 5d7fc7ef21c3d3033a2567eba51b613eb41f0a1a
2024-04-24 00:20:54 -07:00
Riccardo Cipolleschi 05f0861878 Back out "Update ColorPropConverterto support color function values" (#44225)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44225

Back out [#43031](https://github.com/facebook/react-native/pull/43031) as it makes some internal test fails.

## Changelog:
[Android][Fixed] - Revert #43031

Reviewed By: arushikesarwani94

Differential Revision: D56489260

fbshipit-source-id: bd843e6eb60fce0a1d5d8da9f3c5d2a36473ecfb
2024-04-23 13:58:25 -07:00
Riccardo Cipolleschi 0a80270187 Extend Property Processor to support long properties
Summary:
This change is a preliminary change to add support to `Long` and `long` React props that are required for supporting WideGamut color space.

## Changelog
[Android][Added] - Extend Property Processor to support long props

Reviewed By: cortinico

Differential Revision: D56461183

fbshipit-source-id: 0f70388abe2b414a09df640f04e767f1164d63ce
2024-04-23 08:37:44 -07:00
Ryan Linton 0a9891a2f2 Add isWideColorGamutEnabled to ReactActivityDelegate (#43036)
Summary:
This adds support for enabling wide color gamut mode for ReactActivity per the wide gamut color [RFC](https://github.com/react-native-community/discussions-and-proposals/pull/738).

## Changelog:

[ANDROID] [ADDED] - Add isWideColorGamutEnabled to ReactActivityDelegate

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

Test Plan:
Update RNTesterActivity.kt to enable wide color gamut:

```diff
  class RNTesterActivity : ReactActivity() {
    class RNTesterActivityDelegate(val activity: ReactActivity, mainComponentName: String) :
      // ...
      override fun getLaunchOptions() =
          if (this::initialProps.isInitialized) initialProps else Bundle()

+     override fun isWideColorGamutEnabled() = true
    }
```

Reviewed By: cortinico

Differential Revision: D55749124

Pulled By: cipolleschi

fbshipit-source-id: 44dd5631e1a2e429c86c01ed8747bbebbc8bdb3b
2024-04-23 08:37:44 -07:00
Ryan Linton fa7dbd578d Update ColorPropConverterto support color function values (#43031)
Summary:
This adds support for color function values to ColorPropConverter per the wide gamut color [RFC](https://github.com/react-native-community/discussions-and-proposals/pull/738). It updates the color conversion code so that it returns a Color instance before ultimately being converted to an Integer in preparation for returning long values as needed.

bypass-github-export-checks

## Changelog:

[ANDROID] [ADDED] - Update ColorPropConverter to support color function values

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

Test Plan:
Colors should work exactly the same as before.

Follow test steps from https://github.com/facebook/react-native/pull/42831 to test support for color() function syntax.

While colors specified with color() function syntax will not yet render in DisplayP3 color space they will not be misrecognized as resource path colors but will instead fallback to their sRGB color space values.

Reviewed By: cortinico

Differential Revision: D55749058

Pulled By: cipolleschi

fbshipit-source-id: 37659d22c1db4b1a27a9a4f88c9beb703517b01f
2024-04-23 08:37:44 -07:00
Keion Anvaripour 098454d425 Expose JSExceptionHandler to ReactNativeHost (#44172)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44172

Changelog: [Android][Added] Option to set a custom JSExceptionHandler instance

Reviewed By: javache

Differential Revision: D56382090

fbshipit-source-id: 69ad72ee34f1c9f636d95035d0463c5344cb4a37
2024-04-23 04:04:19 -07:00
Arushi Kesarwani 73b4d67a78 Delete deprecated JSIModule methods (#42115)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42115

React Native Android had a concept called JSIModules, which iOS doesn't have. The JSIModule concept was introduced in the early stages of the Fabric project to represent modules that interact with JS through JSI and they are not NativeModules.

In the new architecture this concept is not really necessary and these interfaces were only used to initialize and destroy the Fabric renderer and TurboModule Manager in react native core. Bridgeless mode doesn’t use JSIModule anymore. Also, it has an explicit list of supported JSI module types, so is not open for extension.
In order to simplify RN concepts and reduce confusion with TurboModules, which also "use JSI", deleting everything related to JSIModule. This was already deprecated in 0.74.0.

Please use ReactInstanceEventListener to subscribe for react instance events instead of getJSIModule() and we recommend using TurboModules instead of JSIModules.

Changelog:
[General][Breaking] Delete JSIModule

Reviewed By: javache, cortinico

Differential Revision: D49597702

fbshipit-source-id: bc2bc190aafaf559336b341b50ffabf413474105
2024-04-19 11:54:36 -07:00
Alan Lee c631e93341 Remove UIManager.{show|dismiss}PopupMenu (#44096)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44096

These Android only APIs have been deprecated and are being removed for 0.75 release.

Changelog:
[Android][Removed] - UIManager.showPopupMenu() and UIManager.dismissPopupMenu() have been removed

Reviewed By: RSNara

Differential Revision: D56041827

fbshipit-source-id: e2afebf55860f33d2c8d1887e865adb4dd555e6c
2024-04-18 13:52:21 -07:00
Soe Lynn 41a14962fc Expose Gap Percentage to ReactNative (#44129)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44129

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

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

Expose the Gap Percent from Yoga to RN Layer

Changelog:
[Android][Breaking] Enable flex gap percentage value for RN.

Reviewed By: NickGerleman

Differential Revision: D56160597

fbshipit-source-id: 34c05d39a03cf013f279a2cf9eb9762772ee11de
2024-04-17 17:24:00 -07:00
Jakub Piasecki 747a96b7b3 Add implementation of adjustsFontSizeToFit on the new architecture on Android (#44075)
Summary:
`adjustsFontSizeToFit` prop is exposed on both platforms but is missing implementation on the new arch on Android. This Pr adds it.

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

## Changelog:

[ANDROID] [FIXED] - Fixed `adjustsFontSizeToFit`  not working on Android when using the new architecture

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

Test Plan:
Tested on the RN Tester app using the `AdjustingFontSize` test:

| Old architecture | New architecture |
|------------------|------------------|
| <video src="https://github.com/facebook/react-native/assets/21055725/9243317c-1917-4ddb-9b8a-e9e99638409d">           | <video src="https://github.com/facebook/react-native/assets/21055725/39a7a9f2-21e4-4ba7-9ceb-dfec4ca6f643">         |

Reviewed By: javache

Differential Revision: D56134348

Pulled By: cortinico

fbshipit-source-id: b8339e3bec08e307abb0c6e4bd3f5fe143303014
2024-04-17 08:57:41 -07:00
Andrew Datsenko 46366867f7 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/module/model:modelAndroid (#44134)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44134

Changelog: [Internal]

Reviewed By: strulovich

Differential Revision: D56138858

fbshipit-source-id: 5ea349b6c8565f825de273adbb192c6005a2a357
2024-04-17 08:50:34 -07:00
Moti Zilberman 1d26907ca4 Internal API for Activity-less "Paused in debugger" overlay (#44132)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44132

Changelog: [Breaking][Android] `DevSupportManagerFactory.create()` changed to take an additional parameter of type `PausedInDebuggerOverlayManager` (nullable)

Enables integrators of React Native Android to supply their own implementation of the Fusebox "paused in debugger" overlay. This is primarily intended for legacy Meta-internal integrations that can't use the built-in implementation based on `Dialog`. **The API will likely go away once those integrations have been migrated.**

Reviewed By: javache

Differential Revision: D56215119

fbshipit-source-id: 9cd79a6948c268a952ac28e5563ae57c90756da7
2024-04-17 07:26:54 -07:00
Moti Zilberman 3426591bbe Tweak pause overlay design, remove Step Over button (#44119)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44119

Changelog: [Internal]

TSIA - following design feedback from huntie.

Reviewed By: hoxyq

Differential Revision: D56193523

fbshipit-source-id: 89e9fc77702e40a2f39be719c700fe9ad400a8a2
2024-04-17 05:22:09 -07:00
Moti Zilberman a5c6779ce5 Add Step Over and Resume buttons to pause overlay (#44082)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44082

Changelog: [Internal]

Adds the ability to interactively resume/step from the Fusebox "paused in debugger" overlay on Android. This uses HostCommands (D56098083) and extends the AlertDialog-based overlay (D56068445). In an upcoming diff on this stack, we'll update the design of the overlay to match Chrome's.

Reviewed By: hoxyq

Differential Revision: D56098084

fbshipit-source-id: 587b8bac7b0dd636363fc28ea7d0577b1a52d5c7
2024-04-17 05:22:09 -07:00
Moti Zilberman 6930f3daf7 Minimal implementation of "paused in debugger" overlay (#44079)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44079

Changelog: [Internal]

Implements an unstyled, non-interactive version of the "paused in debugger" in-app overlay in Fusebox on Android, based on the event introduced in D56068444. The implementation in `DevSupportManagerBase` is shared across Bridge and Bridgeless.

In upcoming diffs in this stack, we'll add interactive features (namely "resume" and "step over" buttons, like in Chrome) and improve the visual styling of this overlay.

Reviewed By: hoxyq

Differential Revision: D56068445

fbshipit-source-id: a9ac2765d29d64615751b5cdf03939e0b84d2545
2024-04-17 05:22:09 -07:00
Jane Li 2509eb710e Configure fragment-based nav to work with useEffect() (#44105)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44105

Previously, we skipped calling the ReactDelegate callback functions when the ReavtNavigationFragment was destroyed because it set the current activity to null when we need to actually keep the reference to the activity. However, skipping this entirely also skips core clean up logic, such as running the return() function for useEffect().

Instead of skipping the callback function entirely, we just need to make sure we don't set mCurrentActivity to null. I followed D30504616 to configure an option to not set mCurrentActivity to null if mKeepActivity flag is set on the ReactInstanceManager.

Changelog: [Internal]

Reviewed By: keoskate

Differential Revision: D56167533

fbshipit-source-id: cb3620e21599683e0c6bbc5a6a9c4f384fdbcc51
2024-04-16 17:18:09 -07:00
Jane Li 63e202f3d5 Remove changes to ReactFragment introduced for fragment-based navigation (#44104)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44104

We previously added the option to skip calling the delegate lifecycle events in D55646221 to support fragment-based navigation. However, we don't actually want to skip calling these events as they run some core clean up logic, such as calling the return value of useEffect(). There's a better way to get this working with fragment-based nav (see next diff).

Changelog:
[Internal] [Changed] - Remove option to skip calling delegate on ReactFragment lifecycle events

Reviewed By: keoskate, cortinico

Differential Revision: D56167614

fbshipit-source-id: 3a4b91a303a27c0e19644a4e6611229211a1e530
2024-04-16 17:18:09 -07:00
Ramanpreet Nara 3a3f3e6232 Introduce ReactContext.hasReactInstance() (#44116)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44116

This is just the bridgeless analogue to .hasCatalystInstance()

Changelog: [Android][Added] - Introduced ReactContext.hasReactInstance() to replace .hasCatalystInstance()

Reviewed By: fabriziocucci

Differential Revision: D56164488

fbshipit-source-id: 8be4676e18dc7df4765746f46cf36e62405b4ffa
2024-04-16 10:12:54 -07:00
Andrew Datsenko 8a343c6256 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/camera:cameraAndroid (#44101)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44101

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D56138400

fbshipit-source-id: 5c09e4d28c69bbf87236607d38afbfbddcd28a0c
2024-04-16 08:03:33 -07:00
Moti Zilberman 8afa8beac2 Add boilerplate for handling Overlay.setPausedInDebuggerMessage (#44078)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44078

Changelog: [Internal]

Adds stub support for the [`Overlay.setPausedInDebuggerMessage`](https://cdpstatus.reactnative.dev/devtools-protocol/tot/Overlay#method-setPausedInDebuggerMessage) CDP method to `HostAgent` in the Fusebox backend, and propagates it into the Android and iOS integrations through `HostTargetDelegate`.

We take care to call `HostTargetDelegate::onSetPausedInDebuggerMessage()` a final time with a null `message` parameter, regardless of whether the client has actually sent the corresponding CDP message. Since multiple clients might be connected concurrently, we only send the `null` message when the *last* client which has requested a non-null message has disconnected.

Reviewed By: robhogan

Differential Revision: D56068444

fbshipit-source-id: c26e1cf17dec8d7dbb7edd5ab7fa3133642628ff
2024-04-16 04:52:13 -07:00
Andrew Datsenko d53a2bd4a2 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/toast:toastAndroid (#44100)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44100

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D56138594

fbshipit-source-id: a3010e4d99e5ba9948c7214d546461cbbf959851
2024-04-15 14:09:52 -07:00
Nick Gerleman c710386e72 Encapsulate border radius resolution logic (#43983)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43983

We duplicate some pretty hairy code related to conversion between logical and physical edges, along with the grafting between uniform and non uniform radii. This encapsulates border radius resolution/assignment logic.

Changelog: [Internal]

Reviewed By: alanleedev

Differential Revision: D55635743

fbshipit-source-id: 906c35af2bf18f0586d71d05f9cf61d4248ede1e
2024-04-13 15:34:12 -07:00
Nick Gerleman d7766fa927 Move background drawing code from "react/views/view" to "react/uimanager/drawable" (#43720)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43720

This lets us use BG drawing code in rules which view depends on. I also removed some lib usage.

The original class is still present, subclassing the class in its new location, but is marked deprecated.

Next diffs in stack clean up some of our own now deprecated usage.

Changelog:
[Android][Breaking] - Deprecate `ReactViewBackgroundDrawable` in favor of `CSSBackgroundDrawable`

Reviewed By: javache

Differential Revision: D55565035

fbshipit-source-id: 501b3e2f674c09a88b1825657ba6349823054e8c
2024-04-13 15:34:12 -07:00
Fabrizio Cucci 7131f94895 Revert D55964787: Push ReactContext logic in derived classes
Differential Revision:
D55964787

Original commit changeset: b404efe0c709

Original Phabricator Diff: D55964787

fbshipit-source-id: 0742b9aa870a08fed603cf6f33774d4813f5050c
2024-04-12 06:11:04 -07:00
Samuel Susla 2ef59c988d move to unified feature flag system for new state reconciliation algorithm (#44022)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44022

changelog: [internal]

move the new state reconciliation algorithm to the unified feature flag system.

Reviewed By: rubennorte

Differential Revision: D55965530

fbshipit-source-id: 3edde0858a670e86dc2d1cb561f03f584ff21896
2024-04-12 02:47:01 -07:00
Fabrizio Cucci 05ef779c0b Push ReactContext logic in derived classes (#44026)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44026

Changelog: [Android][Removed] Delete ReactContext.initializeWithInstance(). ReactContext now no longer contains legacy react instance methods. Please use BridgeReactInstance instead.

Yet another attempt to land this (last one was D55505416).

Copy-pasting below the amazing summary from RSNara.

## Context
Prior, ReactContext used to implement bridge logic.

For bridgeless mode, we created BridgelessReactContext < ReactContext

## Problem

This could lead to failures: we could call bridge methods in bridgeless mode.

## Changes
Primary change:
- Make all the react instance methods inside ReactContext abstract.

Secondary changes: Implement react instance methods in concrete subclasses:
- **New:** BridgeReactContext: By delegating to CatalystInstance
- **New:** ThemedReactContext: By delegating to inner ReactContext
- **Unchanged:** BridgelessReactContext: By delegating to ReactHost

## Auxiliary changes
This fixes ThemedReactContext in bridgeless mode.

**Problem:** Prior, ThemedReactContext's react instance methods did not work in bridgeless mode: ThemedReactContext wasn't initialized in bridgeless mode, so all those methods had undefined behaviour.

**Solution:** ThemedReactContext now implements all react instance methods, by just forwarding to the initialized ReactContext it decorates (which has an instance).

NOTE: Intentionally not converting `BridgeReactContext` to Kotlin to minimize the risk of these changes.

Reviewed By: RSNara

Differential Revision: D55964787

fbshipit-source-id: b404efe0c7095894fa815165cc8682f78dccfa17
2024-04-12 01:47:52 -07:00
Andrew Datsenko 88c7391485 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/appstate:appstateAndroid (#43938)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43938

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55726807

fbshipit-source-id: 7338ee8949c05e192c47c6c06e999600dfad07a9
2024-04-11 05:25:47 -07:00
Andrew Datsenko c8d5f0f1aa //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/appearance:appearanceAndroid (#44006)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44006

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725334

fbshipit-source-id: 4d7ad2bb6395674d47fd5e3cd01a8515627f6cd4
2024-04-10 07:45:57 -07:00
Andrew Datsenko 54757ca017 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/imagehelper:imagehelperAndroid (#44001)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44001

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D55725532

fbshipit-source-id: 5fa4e774247e79b0e43d04f58dcb150d682de090
2024-04-10 07:41:29 -07:00
Fabrizio Cucci 51552e6a1e Kotlinify SoftAssertions (#43911)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43911

Changelog: [Internal]

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

Reviewed By: tdn120

Differential Revision: D55797031

fbshipit-source-id: eb53ae671b0a7b5d277b931a11eb0fcd84c51a19
2024-04-09 09:10:50 -07:00
Ruslan Shestopalyuk b23960ad99 Migrate TouchEvent to Kotlin (#43982)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43982

## Changelog:
[Internal] -

As in the title.

Reviewed By: javache

Differential Revision: D55877979

fbshipit-source-id: 63ca9b403509e08632ad1a3c0aa866f6df3f423b
2024-04-09 07:01:54 -07:00
Ruslan Shestopalyuk 2fcdab47f5 Kotlinify ReactSurfaceView (#43964)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43964

## Changelog:
[Internal] -

As in the title.

Reviewed By: alanleedev

Differential Revision: D55869113

fbshipit-source-id: 650304aee8aedc147b4f27b7c490fb4f64160c96
2024-04-09 02:21:18 -07:00
Alan Lee a7e9a222e7 convert DefaultStyleValuesUtil to Kotlin (#43884)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43884

convert Java to Kotlin: `/react/view/text/DefaultStyleValuesUtil.java`

Changelog:
[Internal] internal

Reviewed By: cortinico

Differential Revision: D55777322

fbshipit-source-id: 4cdbc82a636cb133f486ac3e22534f12daddfcee
2024-04-08 19:43:47 -07:00
Andrew Datsenko 379a2729f1 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/unimplementedview:unimplementedviewAndroid (#43970)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43970

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725588

fbshipit-source-id: e7c5a9b0fad05c7de65115a69571725ce6b91640
2024-04-08 17:13:00 -07:00
Andrew Datsenko 2c680195bc //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/clipboard:clipboardAndroid (#43861)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43861

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/22517999373069959/

|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: D55725451

fbshipit-source-id: fea231c0f11f41013bcf7a8a9b5cf65badf82503
2024-04-08 17:11:55 -07:00
Andrew Datsenko 1e6f5a48a6 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager:DisplayMetricsAndroid (#43981)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43981

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/27021599000417439/

|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: D55725602

fbshipit-source-id: b8b77bf97de5a0eda5b077d6c5441b9af36fc26b
2024-04-08 16:37:57 -07:00
Andrew Datsenko 026361ddb4 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/devloading:devloadingAndroid (#43975)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43975

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725612

fbshipit-source-id: b597e906c8e2cdb571c8882e82083626a74a6d70
2024-04-08 16:09:49 -07:00
Andrew Datsenko 5b77df0199 Update package com.facebook.react.perflogger -> com.facebook.react.reactperflogger (#43873)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43873

Changelog: [Internal]
Addressing lint for package name com.facebook.react.perflogger

Reviewed By: alanleedev

Differential Revision: D55747967

fbshipit-source-id: 5d05a14e396d80f8b0bc88515333dcd708e8736a
2024-04-08 14:37:02 -07:00
Andrew Datsenko 8c804de60c //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/share:shareAndroid (#43977)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43977

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725721

fbshipit-source-id: 21f190043da053197bd5ba047122af79635f56ba
2024-04-08 14:30:15 -07:00
Andrew Datsenko f9ca6d73c7 //xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/modules/common:commonAndroid (#43974)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43974

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D55725173

fbshipit-source-id: 79bfea85ef9b376d8892fc79198c27027aaf13fa
2024-04-08 14:24:38 -07:00