Commit Graph
285 Commits
Author SHA1 Message Date
Mathieu ActhernoeneandFacebook GitHub Bot b5be57cb76 Fix RNTester system bars background when edge-to-edge is enforced (#51929)
Summary:
This PR fixes RNTester system bars background color to match the app one (not solid black).

## Changelog:

- [Internal] [Changed] - Fix RNTester app system bars color when edge-to-edge is enforced

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

Test Plan:
https://github.com/user-attachments/assets/8be0b721-6514-408f-81cd-2106ae7a17c4

Rollback Plan:

Reviewed By: javache

Differential Revision: D76352950

Pulled By: alanleedev

fbshipit-source-id: 474a81564570764a597aa995a0677617263338be
2025-06-13 11:05:35 -07:00
Nicola CortiandFacebook GitHub Bot 0954c1db45 Remove and cleanup JSEngineResolutionAlgorithm (#51931)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51931

This cleans up the whole `JSEngineResolutionAlgorithm` and all the API related to it.
As now we offer support only for Hermes and JSC is provided via a community package.

This is breaking as it affects Expo, but I'll reach out to Kudo to make sure this is integrated properly.
No other breakages other than this.

Changelog:
[Android] [Removed] - Remove and cleanup JSEngineResolutionAlgorithm

Reviewed By: mdvacca

Differential Revision: D76337620

fbshipit-source-id: e43d5d1164f368f5fa395971bca9c05821492dfe
2025-06-11 03:09:32 -07:00
Pieter De BaetsandFacebook GitHub Bot 85498ad46f Remove unnecessary receiveCommand overrides (#51844)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51844

These just redefine the existing `receiveCommand` from the ViewManagerDelegate which already has this codegen'ed

Changelog: [Internal]

Reviewed By: cortinico, rshest

Differential Revision: D75869325

fbshipit-source-id: c8ba482075c2586caf33f46a871b5b5e16fda213
2025-06-09 05:49:45 -07:00
Pieter De BaetsandFacebook GitHub Bot 198c6fc81c Make receiveCommand args non-nullable (#51806)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51806

Correct the type of args, which is always non-null. This is backwards-compatible as subclasses can override this method with a more permissive nullable type and still be substitutable.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D75869317

fbshipit-source-id: 8f6c9119140794447eca55be24483a35450d7bb6
2025-06-06 22:07:09 -07:00
Nicola CortiandFacebook GitHub Bot be113b4406 Stop building JSC inside RN-Tester (#51865)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51865

As in 0.81 we're stopping 1st party support for JSC, we can now cleanup the RNTester
flavor for JSC and simplify the setup here.

Changelog:
[Internal] [Changed] -

Reviewed By: rshest

Differential Revision: D76051319

fbshipit-source-id: 79b01cc64af2466a0be47ceaa0cd211cb6b02f53
2025-06-06 04:54:44 -07:00
Pieter De BaetsandFacebook GitHub Bot 95ed8a6123 Merge all core codegen into FBReactNativeSpec (#50317)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50317

`rncore`, `FBReactNativeSpec` and `FBReactNativeComponentSpec` contain the same symbols, which leads to conflicts when we try to merge them into a single shared library. Cleanup the duplication and standardize on `FBReactNativeSpec` everywhere. I've left the Android OSS targets names as is, to avoid breaking deps.

This aligns react-native's package.json with the codegen tooling supported across iOS and Android, which is a single target for all all type-derived codegen.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D55037569

fbshipit-source-id: dbf3c0a427c9d0df96e439b04e5b123cd1069c51
2025-06-02 08:47:05 -07:00
Nicola CortiandFacebook GitHub Bot c6685d29ad Fix RNTester SampleLegacyModule not rendering in Old Arch (#51073)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/51073

Currently the SampleLegacyModule screen is not loading in OldArch for RNTester.

That's because we gate adding a `SampleLegacyModule` to the BaseReactPackage
only if NewArch is enabled.

This shouldn't be the case as we can still build RNTester in oldarch and we
should be able to visualize the SampleLegacyModule example.

Changelog:
[Internal] [Changed] -

Reviewed By: mdvacca

Differential Revision: D74009245

fbshipit-source-id: 55eae3dc6063343f57261af2742e643a8e5c2b50
2025-05-02 03:59:10 -07:00
Nicola CortiandFacebook GitHub Bot 0abd5d63e1 Back out "Migrate ReactActivity" (#50998)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50998

I'm reverting this as this change is too disruptive for the OSS ecosystem.
It will break ALL the apps written in Kotlin and it's coming too close to the branch cut which is in less than one week.

We need to re-do this migration in a non breaking manner after the branch cut as this is highly disruptive for little benefit at this point

Changelog
[Android][Changed] - Back out "[RN][Kotlin] Migrate ReactActivity"

Original commit changeset: 936263100ca9

Original Phabricator Diff: D73507044

Reviewed By: mdvacca

Differential Revision: D73864144

fbshipit-source-id: 264921b1f1cd38301e66364de4b619807272bd27
2025-04-29 21:50:25 -07:00
Ruslan ShestopalyukandFacebook GitHub Bot 403feb9bc2 Migrate ReactActivity (#50871)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50871

# Changelog:
[Android][Changed] - ReactActivity has been migrated to Kotlin.

Reviewed By: cortinico

Differential Revision: D73507044

fbshipit-source-id: 936263100ca93dafd643a53e5cb799fd5ed7e584
2025-04-28 01:53:11 -07:00
Nicola CortiandFacebook GitHub Bot 1c920d305d RNTester - Do not explicitely enable legacyWarningsEnabled (#50930)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50930

Due to D73591315, we don't need to specify the `legacyWarningsEnabled` for RNTester anymore as it's effectively ignored.

Changelog:
[Internal] [Changed] -

Reviewed By: rshest, cipolleschi

Differential Revision: D73654270

fbshipit-source-id: 9428634fb8374024940e4041de60d679b6f352a2
2025-04-25 07:49:59 -07:00
Jakub PiaseckiandFacebook GitHub Bot c008604e0a Fix changing font scale breaking text (#45978)
Summary:
Fixes https://github.com/facebook/react-native/issues/45857

The general idea behind this PR is the same for both platforms: dirty all nodes with `MeasurableYogaNode` trait when the layout is constrained with a new `fontSizeMultiplier`. There were a few caveats:
- `ParagraphShadowNode` marks its layout as clean in the constructor in most cases. To prevent that from using a stale measurement I'm using the font scale multiplier stored in `content_` property of the node. That value is then compared with the scale used to create the attributed string kept in the node's state. If those differ, the layout is not cleared.
- On Android, font scale wasn't passed down to the `SurfaceHandler`
- On Android, text measurement relies on cached `DisplayMetrics` which were not updated when the system font scale changed.
- `AndroidTextInputShadowNode` wasn't using `fontSizeMultiplier` at all. I needed to add it in all places where an `AttributedString` is constructed.

## Changelog:

[GENERAL] [FIXED] - Fixed text not updating correctly after changing font scale in settings

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

Test Plan:
So far tested on the following code:

```jsx
function App() {
  const [counter,setCounter] = useState(0);
  const [text,setText] = useState('TextInput');
  const [flag,setFlag] = useState(true);

  return (
    <SafeAreaView
        style={{
          flex: 1,
          backgroundColor: '#fff',
          alignItems: 'center',
          justifyContent: 'center',
        }}
    >
      <Text style={{fontSize: 24}}>RN 24 Label Testing {flag ? 'A' : 'B'}</Text>
      <TextInput value={text} onChangeText={setText} style={{fontSize: 24, borderWidth: 1}} placeholder="Placeholder" />
      <Pressable onPress={() => setCounter(prevState => prevState + 1)} style={{backgroundColor: counter % 2 === 0 ? 'red' : 'blue', width: 200, height: 50}} />
      <Pressable onPress={() => setFlag(!flag)} style={{backgroundColor: 'green', width: 200, height: 50}} />
    </SafeAreaView>
  );
}
```

Reviewed By: NickGerleman

Differential Revision: D71727907

Pulled By: j-piasecki

fbshipit-source-id: 240fb5fa4967a9182bce7e885798b233d1e25aea
2025-04-14 08:57:05 -07:00
Nicola CortiandFacebook GitHub Bot 7ca2811750 Add a legacyWarningsEnabled property to enable Legacy Warnings on NewArch (#50470)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50470

This diff introduces a new property called `legacyWarningsEnabled` for `gradle.properties` that
toggles the Legacy Arch warnings for users.

I've also introduced a new `ReactNativeApplicationEntryPoint` that is generated by RNGP. This class
effectively wrap `DefaultNewArchitectureEntryPoint` by setting warnings and also invoking SoLoader.
It will reduce the errors in the user space.

As of now warnigns appear in Logcat, but I'm looking into adding some UI in a subsequent diff.

Changelog:
[Android] [Added] - Add a `legacyWarningsEnabled` property to enable Legacy Warnings on NewArch

Reviewed By: mdvacca

Differential Revision: D72383907

fbshipit-source-id: bcd659a23ec5b468958124f0f6650ff72d01ce81
2025-04-04 08:17:07 -07:00
Janic DuplessisandFacebook GitHub Bot b614c966ab Setup a Macrobenchmark for RNTester (#49486)
Summary:
Benchmark to test changes from https://github.com/facebook/react-native/issues/49449

Might be nice to have some version of this in the repo.

## Changelog:

[INTERNAL] [ADDED] - Setup a Macrobenchmark for RNTester

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

Test Plan:
### Methodology

Picked various JS file from websites (facebook, instagram) to artificially grow RN tester bundle somewhat realistically. The files are required lazily from a button press callback to simulate the code being included, but not executed, as it would be in a large app that uses lazy requires for the different screens.

I've also made the RN tester screens lazy so all their code is not loaded initially. This is more representative of real apps. Note this is implemented in a hacky way just for the purpose of this test. It would actually be nice to implement this properly.

The tests were made using low end device Samsung Galaxy A03s.

### Compression ON with 10.5 mb bundle

#### Peak allocated memory

60.9 mb

#### ReactInstance.loadJSBundler

148.64 ms

#### Benchmark

timeToFullDisplayMs      min 1,825.0,   median 1,911.1,   max 1,994.8
timeToInitialDisplayMs   min   834.9,   median   860.9,   max   903.9

#### APK

Size: 22.9 mb
Download size: 14.5 mb

### Compression OFF with 10.5 mb bundle

#### Peak allocated memory

51.5 mb

#### ReactInstance.loadJSBundler

946 us

#### Benchmark

timeToFullDisplayMs      min 1,752.8,   median 1,827.2,   max 1,977.5
timeToInitialDisplayMs   min   837.7,   median   881.3,   max   937.2

#### APK

Size: 28 mb
Download size: 14.5 mb

Reviewed By: rshest

Differential Revision: D70002286

Pulled By: cortinico

fbshipit-source-id: 436597f439ba244649373870c1facefdb12297d9
2025-03-04 12:56:07 -08:00
Peter AbbondanzoandFacebook GitHub Bot 071506fa61 Add tinted vector drawable example to RNTester (#48541)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48541

Shows how to use tintColor in conjunction with new XML file format, and serves as a good E2E test bench to ensure that drawables don't accidentally reuse the same state (if the underlying implementation isn't careful enough to call `buildCopy`, both icons will render red)

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D64136753

fbshipit-source-id: 3bd0933e587364425ac14a0635690d4b274a55fe
2025-01-09 19:56:12 -08:00
Kudo ChienandFacebook GitHub Bot e42a3a6b84 Migrate jsc-android to mavenCentral (#47972)
Summary:
Since people mostly use Hermes, it doesn't make sense to download jsc-android from npm even when jsc is not used. This PR migrates the jsc-android to [mavenCentral](https://repo1.maven.org/maven2/io/github/react-native-community/jsc-android/2026004.0.0/). The new jsc-android supports Android 16KB memory page sizes and packaged by prefab.
Relevant PRs:
  - https://github.com/react-native-community/jsc-android-buildscripts/pull/184
  - https://github.com/react-native-community/jsc-android-buildscripts/pull/185

## Changelog:

[ANDROID] [CHANGED] - Migrate jsc-android to mavenCentral

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

Test Plan: CI passed

Reviewed By: cipolleschi

Differential Revision: D66772407

Pulled By: cortinico

fbshipit-source-id: e34d2d138996e394763ef67d7aad65bb3e7b13dc
2024-12-06 12:50:34 -08:00
Pieter De BaetsandFacebook GitHub Bot aec7a66ae8 Remove deprecated ReactModuleInfo constructor (#47681)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47681

These were deprecated back in D49262824, so should be safe to remove now.

Changelog: [Android][Removed] Removed hasConstants constructor from ReactModuleInfo

Reviewed By: mdvacca

Differential Revision: D66127070

fbshipit-source-id: 3bd441c96597598470f16c7770c4dfa4ada563a0
2024-11-22 08:05:41 -08:00
Pieter De BaetsandFacebook GitHub Bot 145c72f816 Convert com.facebook.react.bridge.ReadableNativeArray to Kotlin (#47484)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/47484

Small change to types in the base class: all non-primitives return optional from ReadableArray, which matches the semantics in ReadableMap. We already rely on this in some cases, but the current nullability annotations were incorrect, and null values from the array would be passed through from `getMap` and `getArray`.

Changelog: [Android][Breaking] ReadableArray non-primitive getters are now correctly typed as optional

Reviewed By: Abbondanzo

Differential Revision: D65596278

fbshipit-source-id: 5574e9000b07de292bd0da5f1b071aac0eb331d6
2024-11-22 01:53:48 -08:00
Nicola CortiandFacebook GitHub Bot 972c2c864c Bump Kotlin 1.9.x to 2.0.x (#46955)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46955

This is a major bump of Kotlin. It comes with no breaking changes for the Kotlin API, but there are several new warnigns that I had to fix.
Most importantly several `override` methods that are overriding Deprecated API, also need to be deprecated as well in Kotlin.

Changelog:
[Android] [Changed] - Bump Kotlin 1.9.x to 2.0.x

Reviewed By: tdn120

Differential Revision: D64179842

fbshipit-source-id: 295ab2636ce9f9bb04e9d8c7ed27d9f8a1a64338
2024-10-11 05:34:02 -07:00
Nicola CortiandFacebook GitHub Bot a268b2bf53 Enable warningAsErrors for RN-Tester (#46817)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46817

As I've cleaned up all the RN Tester warnings, I'm enable warningAsErrors for RNTester to make
sure we keep up with our warning count.

Changelog:
[Internal] [Changed] - Enable warningAsErrors for RN-Tester

Reviewed By: cipolleschi

Differential Revision: D63837633

fbshipit-source-id: f83273dadc7aa10ce7ae52ae790279819fb88345
2024-10-09 03:12:27 -07:00
Nick GerlemanandFacebook GitHub Bot 0b0ac81fbe Fix some cases where we override setBackgroundColor on View-level instead of VM level (#46846)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46846

As of D61658739, BaseViewManager setting color now goes through BackgroundStyleApplicator, which gives a default implementation of setting a background color, while storing information in a way where we can impement things like border radii and shadows on background for out of the box views.

I knew this could lead to breaks where we previously overrode view-level `setBackgroundColor` to do something custom, but didn't override on VM level, but didn't see any external usages so I assumed it should be relatively safe. Turns out we have some internal usages which run into this pattern (D63913128 already fixed one), including a usage in RN itself! Let's override the view managers in these to delegate to the view's custom drawing.

Changelog:
[Android][Fixed] - Fix some cases where we override setBackgroundColor on View-level instead of VM level

Reviewed By: Abbondanzo

Differential Revision: D63922722

fbshipit-source-id: af988d1436c790be97b2be1325541aa418bf43a3
2024-10-04 18:43:49 -07:00
Nicola CortiandFacebook GitHub Bot 7bb12ebbea Convert react/nativemodule/samples/ to Kotlin (#46816)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46816

This converts the same native module from Java to Kotlin.
I've converted the whole module as it was quite simple + I've fixed some of the warnings.

Changelog:
[Internal] [Changed] - Convert react/nativemodule/samples/ to Kotlin

bypass-github-export-checks

Reviewed By: javache

Differential Revision: D63837631

fbshipit-source-id: bb126d7649a6e8a36510bf2b252ecdfae91fe09f
2024-10-04 07:57:46 -07:00
Nicola CortiandFacebook GitHub Bot 2136c19944 Bump SoLoader to 0.12.1 and remove unnecessary extra manifest metadata. (#46461)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46461

This bumps SoLoader to 0.12.1 inside React Native and cleans up the extra
`com.facebook.soloader.enabled` metadata which are not necessary anymore.

Changelog:
[Internal] [Changed] - Bump SoLoader to 0.12.1 and remove unnecessary extra manifest metadata

Reviewed By: cipolleschi

Differential Revision: D62581188

fbshipit-source-id: ff990c0af1f0f51070037fcb4c7c13fbe6bae234
2024-09-13 03:51:58 -07:00
Nicola CortiandFacebook GitHub Bot d7c1e5b989 Unblock RNTester instacrashing due to SoLoader not being enabled (#46459)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46459

After the SoLoader 0.12.0 bump I've noticed RNTester is instacrashing due to us not having enabled it
explicitely in the Manifest:

Changelog:
[Internal] [Changed] - Unblock RNTester instacrashing due to SoLoader not being enabled

Reviewed By: cipolleschi

Differential Revision: D62580751

fbshipit-source-id: 3b291e7f82daf1a6bd61bc9588c2d49a389801ef
2024-09-12 14:16:33 -07:00
Vladimir MakaevandFacebook GitHub Bot 3949d9b5ba Update ktfmt component on FBS:master
Reviewed By: zertosh

Differential Revision: D62584126

fbshipit-source-id: 46170730dd7cabfa5e366a3139a9119c319592cc
2024-09-12 14:06:06 -07:00
Nicola CortiandFacebook GitHub Bot 81e8c39f0a Do not stub SoLoader and use version 0.12.0 (#46422)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46422

Stubbing SoLoader comes with a couple of breaking changes (e.g. users in OSS are using `com.facebook.common.logging.FLog` which is exposed by Fresco).

In order to reduce those breaking changes, here I'm moving React Native to use SoLoader 0.12.0.
This new version comes with a constructor that accepts a MergedSoMapping implementation which we provide only for OSS apps.

Please note that the CI on this Diff will be red till SoLoader 0.12.0 releases.

Changelog:
[Internal] [Changed] - Do not stub SoLoader and use version 0.12.0

Reviewed By: cipolleschi

Differential Revision: D62447566

fbshipit-source-id: 6ff38799ed0c9f40cf3ab84be8a05979def63dc2
2024-09-12 07:17:22 -07:00
Thomas NardoneandFacebook GitHub Bot c942469700 Re-enable ktfmt on RN (#46441)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46441

Changelog: [Internal]

Reviewed By: zertosh

Differential Revision: D62518893

fbshipit-source-id: ca2ff83018716a4dc1e2dcfb8596138d088ce9f4
2024-09-11 19:06:25 -07:00
Alan LeeandFacebook GitHub Bot f7479e6a1c set inset based padding to RNTester (#46354)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46354

**Issue:**
With forced edge-to-edge on Android 15, RNTester title at top overlaps with the status bar and bottom tab bar overlaps with bottom nav bar

**Solution:**
Add margins based on inset values to the ReactRootView which is the contentView for RNTesterActivity which acts as global padding within RNTester

Changelog:
[Android][Changed] - Adding padding for RNTester on Android 15 forced edge-to-edge

Reviewed By: mdvacca

Differential Revision: D62247910

fbshipit-source-id: 7b35d0c2016b6897b5de436a4245c9e910559541
2024-09-05 15:56:54 -07:00
Phillip PanandFacebook GitHub Bot e881a1184c convert TurboReactPackage to BaseReactPackage in oss (#46055)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46055

Changelog: [Android][Breaking]

BaseReactPackage is a 1:1 replacement for the deprecated TurboReactPackage. TurboReactPackage has been deprecated since 0.74. let's move the codebase to the recommended standard.

Reviewed By: cortinico

Differential Revision: D61329022

fbshipit-source-id: cef69e37bb2be7f6dccbab70d0996c33a8abf091
2024-08-16 17:41:32 -07:00
Nicola CortiandFacebook GitHub Bot 6dc01dad09 Do not depend on OSS SoLoader anymore (#45873)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45873

I'm removing the Gradle dependency on OSS SoLoader and stubbing it with our own implementation.
This will allow us to implement merging of further .so libraries and

As Fresco also depends on SoLoader, I had to stub the `NativeLoader` dependency as well.

Changelog:
[Android] [Breaking] - Do not depend on OSS SoLoader anymore and do not expose Fresco `api` dependency.

Reviewed By: mdvacca

Differential Revision: D60652007

fbshipit-source-id: 6e70a5c37ba9337fbe8772e192b886ba4693c7f1
2024-08-14 05:07:56 -07:00
Alex HuntandFacebook GitHub Bot e9e5fb0141 Remove unstable_fuseboxEnabled API (#45926)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45926

Removes the temporary `unstable_fuseboxEnabled` API on both platforms. Fusebox is enabled by default on `main` since https://github.com/facebook/react-native/pull/45469.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D60893243

fbshipit-source-id: 7ca4550eafb979730c0c5829df4c200f11e0df30
2024-08-07 06:40:13 -07:00
Thomas NardoneandFacebook GitHub Bot a696d2ed6b Deprecate MapBuilder and remove Kotlin usages (#45743)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45743

This is a Java-centric class that can be replaced by Kotlin's map extensions.

Changelog:
[Android][Deprecated] Deprecate MapBuilder

Reviewed By: cortinico

Differential Revision: D60309106

fbshipit-source-id: 4a764fa1d59993dc735b2181a2270dc79a0e0396
2024-08-02 13:58:32 -07:00
Nicola CortiandFacebook GitHub Bot bd4aec869b RNGP - Do not attempt to load JSC from other repositories (#45598)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45598

I've noticed we attempt to load JSC from the Sonatype Snapshot repository.
That is inefficient as we already know that JSC is available only inside node modules.
This change makes the repository resolution stricter by better specifying which
repo can download which dependency.

Changelog:
[Internal] [Changed] - Do not attempt to load JSC from other repositories

Reviewed By: cipolleschi

Differential Revision: D60116002

fbshipit-source-id: 21a2213708f5b0103860a59f3342f1bc0f59cdb9
2024-07-23 08:12:42 -07:00
Nicola CortiandFacebook GitHub Bot 0529818d36 Fix several build warnings on RN-Tester (#45569)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45569

Same as title

Changelog:
[Internal] [Changed] - Fix several build warnings on RN-Tester

Reviewed By: realsoelynn

Differential Revision: D60036158

fbshipit-source-id: 549b84f52594e1a442058222a3a45118739a1eb3
2024-07-22 12:16:12 -07:00
generatedunixname89002005232357andFacebook GitHub Bot 85dd14c912 Revert D59170923 (#45447)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45447

This diff reverts D59170923
Breaking OSS build

Changelog: [Internal]

Reviewed By: blakef

Differential Revision: D59759991

fbshipit-source-id: 39aa0b447a90801d1da5a39461b33b4c4cc4197b
2024-07-15 13:44:09 -07:00
Peter AbbondanzoandFacebook GitHub Bot 018d0621c1 Declare public resources from images that are loaded by name (#45421)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45421

RNTester contains Android resources that are loaded by name and not resolved by Metro. As a result, these assets are not automatically linked when RNTester JS code is embedded in other projects. This is considered "legacy" loading and is generally discouraged, but is still showcased as an alernative way of loading resources.

I also modified the Image test to ensure that flag status is printed so it's obvious why the vector drawable hasn't loaded.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D59585555

fbshipit-source-id: d42fb44d8846d8e7c7aa01dca4cec89ae85a9195
2024-07-15 12:39:06 -07:00
Peter AbbondanzoandFacebook GitHub Bot aad9240fd4 Support loading vector drawables in ImageView (#45354)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/45354

Fresco has indicated that they have no plans to support loading vector assets and similar drawable types in Drawee-backed views ([issue](https://github.com/facebook/fresco/issues/329), [issue](https://github.com/facebook/fresco/issues/1463), [issue](https://github.com/facebook/fresco/issues/2463)). Guidance has been to instead load the vector drawable onto the backing image view ourselves. On the React Native side, having the ability to load vector drawables has been requested many times ([issue](https://github.com/facebook/react-native/issues/16651), [issue](https://github.com/facebook/react-native/issues/27502)).

I went this route over using a custom Fresco decoder for XML assets because vector drawables are compiled down into binary XML and I couldn't find a trivial, performant way to parse those files in a context-aware manner. This change only accounts for vector drawables, not any of the other XML-based drawable types (layer lists, level lists, state lists, 9-patch, etc.). Support could be added easily in the future by expanding the `getDrawableIfUnsupported` function.

## Changelog

[Android] [Added] - Added support for rendering XML assets provided to `Image`

Reviewed By: javache

Differential Revision: D59530172

fbshipit-source-id: 3d427c06238287e0a3b7f9570ac20e43d76126c7
2024-07-15 08:54:48 -07:00
Blake FriedmanandFacebook GitHub Bot b7e70968fa fix config generation without community cli (#45224)
Summary:
The rn-tester android build assumes the react-native-community/cli is available.  This is no longer the case.

Changelog: [Internal]

Differential Revision: D59170923

Pulled By: blakef

fbshipit-source-id: 6f414c2be387ef46dd50ce09a98beb230c8e73b9
2024-07-15 08:00:36 -07:00
Gijs WeteringsandFacebook GitHub Bot b44e3f69a4 Add java and JS coverage collection to RNTester for Jest E2E (#44856)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44856

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D58360098

fbshipit-source-id: dd06f9d3f2fe887cb9311ccfef811a2965ca5750
2024-06-12 11:48:07 -07:00
Alex HuntandFacebook GitHub Bot 55e08a9319 Enable Fusebox by default in RNTester (#44895)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44895

Enables the new debugger stack (codename Fusebox) in RNTester.

This feature is experimental and is enabled for testing purposes only. This change **should not** be adopted as the default by React Native frameworks.

Changelog: [Internal]

Reviewed By: cortinico, rubennorte, NickGerleman

Differential Revision: D58366246

fbshipit-source-id: 809a1edb79ced4a7920457ed661cc3d863b35c7b
2024-06-12 08:30:40 -07:00
Nicola CortiandFacebook GitHub Bot 14ccf6bc9c Remove android.enableJetifier (#44876)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44876

We probably don't need Jetifier anymore at this point.
Also see: https://github.com/react-native-community/template/pull/9

Changelog:
[Internal] [Changed] - Remove `android.enableJetifier`

Reviewed By: rshest

Differential Revision: D58416487

fbshipit-source-id: f60c58aaf17b90c610959589fcd46026979c749a
2024-06-12 02:58:16 -07:00
Nicola CortiandFacebook GitHub Bot d0012b7dcd Simplify build_android (#44870)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44870

This just simplifies the build_android step on GHA

Changelog:
[Internal] [Changed] - Simplify build_android

Reviewed By: cipolleschi

Differential Revision: D58407537

fbshipit-source-id: 2bb34ef8b8d1883e653914488d4d417356f0f1d2
2024-06-11 08:34:46 -07:00
Alex HuntandFacebook GitHub Bot 3303dd35ed Expose unstable_loadFusebox API on Android (#44858)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44858

- Enables an opt-in to the Fusebox stack on Android for both architectures in open source.
- Templates use of this opt-in in RNTester.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D58359907

fbshipit-source-id: d565dc8e00747dff56d3060e36e7f59e7dd2aec5
2024-06-11 06:11:35 -07:00
Nicola CortiandFacebook GitHub Bot cf914e412d RNGP - Autolinking. Add support for linking projects. (#44799)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44799

This is the final part of core autolinking:
1. I split RNGP into an `app-plugin` and a `settings-plugin`. This was necessary as the Gradle modules need to be loaded inside the settings.gradle.kts.
2. I've introduced a Settings Plugin to take care of either invoking the `config` command from CLI or receiving a file in input.
3. I've removed the former `RunAutolinkingConfigTask` as now the command is invoked inside the settings plugin
4. I've added hashing computed based on the lockfiles so we won't be re-executing teh `config` command if the lockfiles are not changed.
5. I've updated RN-Tester to use the core autolinking rather than manual linking for the 2 libraries it's using.

Changelog:linking
[Internal] [Changed] - RNGP - Autolinking. Add support for linking projects

Reviewed By: blakef

Differential Revision: D58190363

fbshipit-source-id: 6ab8b36729e77ca715f50a4a00aa0ca4eb5b63b1
2024-06-07 10:32:16 -07:00
Kudo ChienandFacebook GitHub Bot d999e9bf1e Add BindingsInstaller for TurboModules on Android (#44526)
Summary:
Add synchronous JS bindings installation for TurboModules. That would help some 3rd party JSI based modules to install JS bindings easier.
https://github.com/facebook/react-native/issues/44486 for Android

## Changelog:

[Android] [ADDED] - Add BindingsInstaller for TurboModules

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

Test Plan:
Added test in RN-Tester TurboModule test case

 {F1660267530}

 {F1660287029}

Reviewed By: javache

Differential Revision: D57223328

Pulled By: philIip

fbshipit-source-id: d4a69a16f6ce77c0a0fd63f008bea929b1964ab8
2024-05-30 20:43:27 -07:00
Gijs WeteringsandFacebook GitHub Bot 99238d2bb9 Configure ViewHierarchy dump for RNTester
Summary: Changelog: [Android][Added] add FBEndToEndDumpsysHelper stub to RNTester Android to be able to dump ViewHierarcies internally.

Reviewed By: makovkastar

Differential Revision: D54662739

fbshipit-source-id: 5236ae84ed648d431a8f01558f8f84049480ba39
2024-05-20 07:57:10 -07:00
Nick GerlemanandFacebook GitHub Bot 82c6f8a580 Set and require android:supportsRtl="true" for RTL layout (#44538)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44538

Android originated without RTL support. When RTL support was added, Applications needed to set `android:supportsRtl="true"` in their manifest, to allow Android to do RTL specific layout and drawing. This became the default for new projects created by Android Studio at some point.

React Native was not setting this in template, which means apps created from it do not do any of Android's RTL layout, text alignment, or drawing (e.g. in D3652980 8 years ago, a native drawer component came from the wrong side of the screen). RN would still layout the app using Yoga in RTL if in RTL locale though.

This change sets `android:supportsRtl` in template matching default new Android projects, and to avoid mismatched states in the future, will only tell I18NManager that RTL is allowed if `android:supportsRtl` is also set. This is breaking, since existing apps may not get Yoga RTL support unless telling Android that the application should support RTL layout.

Changelog:
[Android][Breaking] - Set and require `android:supportsRtl="true"` for RTL layout

Reviewed By: joevilches

Differential Revision: D57248205

fbshipit-source-id: 3f60c9f855db26f8d34a2e05d460f95961f5ffeb
2024-05-16 19:06:18 -07:00
Nicola CortiandFacebook GitHub Bot 44e78ff74a Fix accidentally broken build_android job
Summary:
I accidentally broke build_android.
Here the two fixes:
1. Make sure the constructor of PackageList2 are actually called `PackageList2`
2. Make sure the package of `OSSLibraryExamplePackage` is `com.facebook.react.osslibraryexample`

Changelog:
[Internal] [Changed] - Fix accidentally broken build_android job

Reviewed By: dmytrorykun

Differential Revision: D56756601

fbshipit-source-id: 862597ca829d702d880624d29276193f8548715d
2024-04-30 08:02:20 -07:00
Nicola CortiandFacebook GitHub Bot 1df1570810 RNGP - Setup the RunAutolinkingConfigTask to run the config command
Summary:
This diff is part of RFC0759
https://github.com/react-native-community/discussions-and-proposals/pull/759

Here I'm creating the `runAutolinkingConfig` task.

This task is responsible of either:
- Invoking the `npx react-native-community/cli config` command (or the one specified by the user)
- Copying the config output file specified by the user (if any).

The task re-executes only if any of the lockfile are actually changed otherwise it just returns as "UP-TO-DATE"

This allows us to

Changelog:
[Internal] [Changed] - RNGP - Setup the RunAutolinkingConfigTask to run the config command

Reviewed By: cipolleschi, blakef

Differential Revision: D55475596

fbshipit-source-id: 3c687f965c59eb82fc447546ebd936ba401f34f2
2024-04-30 02:49:48 -07:00
Dmitry RykunandFacebook GitHub Bot 1cb0a3342a Add react-native-test-library package (#43068)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43068

This diff adds `react-native-test-library` package.
It contains native module and native component example, and targets both the new and the old architecture. It has structure similar to many OSS React Native libraries, and is supposed to be used to test the integration with third-party libraries.

It is integrated with RNTester as the **OSS Library Example** screen.

{F1457510909}

**Change Background** tests native commands.
**Set Opacity** tests native props.
**Get Random Number** tests native module.

Changelog: [Internal]

Reviewed By: RSNara

Differential Revision: D50793835

fbshipit-source-id: ff6daefab10e6e9f13049e3013f8f63cfa8a929e
2024-04-09 11:35:43 -07:00
Ramanpreet NaraandFacebook GitHub Bot 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