Commit Graph

31886 Commits

Author SHA1 Message Date
Riccardo Cipolleschi 54bbb2b4fc Move the Publish Release workflow to GHA (#44868)
Summary:
This change moves the Publish release workflow to GHA

## Changelog:
[Internal] - Move the Publish Release workflow to GHA

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

Test Plan: GHA is green

Reviewed By: cortinico, huntie

Differential Revision: D58406352

Pulled By: cipolleschi

fbshipit-source-id: 99fb1df16aeffa9d48bb4ed409847c6ac4892a82
2024-06-11 04:46:55 -07:00
Alex Hunt 812f155527 Expose unstable_fuseboxEnabled API on iOS (#44860)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44860

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

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D58364053

fbshipit-source-id: c604b1589174bf7cfd0fe1bfb5624c4edd0a125d
2024-06-11 04:38:32 -07:00
Nicola Corti 1d926d47ff Make hermesc executable
Summary:
Seems like hermesc produced by GitHub Actions is not executable. This fixes it.

Changelog:
[Internal] [Changed] - Make hermesc executable

Reviewed By: cipolleschi

Differential Revision: D58407086

fbshipit-source-id: 84d7ba950b99214dfaed09a6aa499835fd01ede0
2024-06-11 03:55:53 -07:00
Nicola Corti 7c0c9a2b93 Cleanup the .github/workflows folder (#44857)
Summary:
Just doing some cleanup of the `.github/workflows` folder:
* apply-version-label-issue.yml hasn't been working since 0.72
* ios-tests is unnecessary as it's now covered by test-all
* nightlies-feedback.yml was experimental and last execution was ~5 months ago.

We can still recover them from the Git history if necessary.

## Changelog:

[INTERNAL] - Cleanup the .github/workflows folder

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

Test Plan: Will wait for CI result

Reviewed By: NickGerleman

Differential Revision: D58362912

Pulled By: cortinico

fbshipit-source-id: d886e4f077eebfdf906169f09f96a950a361cab7
2024-06-11 03:14:49 -07:00
Nick Gerleman db0e9eaa32 Disable test_android_template on PR (#44865)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44865

This has not yet passed on main since we started testing on main two weeks ago: https://github.com/facebook/react-native/actions/runs/9316380994/job/25688028045

This change disables the GitHub Actions version `test_android_template` as a signal for PRs or diffs, since it isn't stable yet (but we still run it on main, and can manually dispatch it on any branch). This coverage is still enabled in CircleCI.

Changelog: [Internal]

Reviewed By: cortinico, alanleedev

Differential Revision: D58394745

fbshipit-source-id: 3227328b150a89b450d48784190f5d08d510cd1b
2024-06-11 03:01:18 -07:00
rickhanlonii (Meta Employee) b0c0bb4591 Fix xplat sync syntax error
Summary: DiffTrain build for commit https://github.com/facebook/react/commit/bf1bb2e5e52733a9577848f2913d06edcf24df14.

Reviewed By: yungsters

Differential Revision: D58369382

Pulled By: rickhanlonii

fbshipit-source-id: 0e6058a285108279465b3c6f4edd8d23d9ddd4b8
2024-06-11 01:46:27 -07:00
Soe Lynn 0d345698d8 Measure with transform bugfix (#44821)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44821

Changelog: [Internal]

- Originally D37994809 was attempted to fix `Inverted FlatList` but was put behind Feature Toggle because it was causing problems in other scenarios.
- Later, D45866231 which was trying to fix scaling transform issue helped solve the issue attempted by the original diff.
- But after that points, Unit test around `computeRelativeLayoutMetrics` was having two variants where Feature Toggle for D37994809 was checked in with a wrong expected value.
- This diff revert D37994809 changes and clean up the unit test.

Reviewed By: NickGerleman

Differential Revision: D58197918

fbshipit-source-id: d8ae552018617e785e4010bc5805c53a875e02a3
2024-06-10 21:03:45 -07:00
Zeya Peng 712ff8cdba make RNTesterApp's back button customizable
Summary:
## Changelog

make RNTesterApp take a `customBackButton` prop to enable overriding whether to display back button and the look
by default, only ios platform has a back button, and android app relies on back button on navigation bar that comes with platform

[Internal]

Reviewed By: christophpurrer

Differential Revision: D58218208

fbshipit-source-id: 63a47390cc6d3de057b92a3c522c1b00d942c69d
2024-06-10 20:48:12 -07:00
Joe Vilches 5b3a321422 Fix issue with alternating flex direction and percent postions (#44792)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44792

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

Fixing https://github.com/facebook/yoga/issues/1658. We had a problem where if a child had a different flex direction than its parent, and it also set a position as a percent, it would look at the wrong axis to evaluate the percent. What was happening was we were passing in the container's mainAxis size and crossAxis size to use to evaluate the position size if it was a percent. However, we matched these sizes with the main/cross axis of the child - which is wrong if the flex direction is different.

I changed it so that the function just takes in ownerWidth and ownerHeight then calls isRow to determine which one to use for the main/cross axis position. This reduces the ambiguity quite a bit imo.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D58172416

fbshipit-source-id: eafd8069e03493fc56c41a76879d1ad9b7e9236d
2024-06-10 18:25:19 -07:00
Joe Vilches 940d738b89 Fix issue where % width would be wrong if physical and relative padding defined on parent (#44791)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44791

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

This should fix https://github.com/facebook/yoga/issues/1657. Rather insidious bug but we had code like

```
  // The total padding/border for a given axis does not depend on the direction
  // so hardcoding LTR here to avoid piping direction to this function
  return node->style().computeInlineStartPaddingAndBorder(
             axis, Direction::LTR, widthSize) +
      node->style().computeInlineEndPaddingAndBorder(
          axis, Direction::LTR, widthSize);
```

That comment is NOT true if someone sets both the physical edge and relative edge. So like paddingLeft and paddingEnd for RTL. This diff simply pipes the direction to that spot to use instead of hardcoding LTR. Every file changed is just to pipe `direction`.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D58169843

fbshipit-source-id: 5b4854dddc019285076bd06955557edf73ef7ec5
2024-06-10 18:25:19 -07:00
Nicola Corti e686b4330d Tentative fix for NPE JavaTimerManager$IdleCallbackRunnable.cancel (#44852)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44852

This attempts to fix #44842 by capturing the accessed field in a new variable.
We don't have a way to reproduce this & this is a best guess fix.

Changelog:
[Android] [Fixed] - Tentative fix for NPE `JavaTimerManager$IdleCallbackRunnable.cancel`

Reviewed By: javache

Differential Revision: D58356826

fbshipit-source-id: d016df9a52f81a8d645a0a100c6bc6111841e24e
2024-06-10 13:39:27 -07:00
Riccardo Cipolleschi 7ce5e56f38 Migrate the Prepare Release workflow (#44833)
Summary:
This change migrates the prepare_release workflow from CCI to GHA

## Changelog:
[Internal] - Migrate from CCI to GHA

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

Test Plan: Test on GHA

Reviewed By: huntie

Differential Revision: D58289050

Pulled By: cipolleschi

fbshipit-source-id: 134fc7ffb66a18eec1187e14500daec2828cae61
2024-06-10 09:49:45 -07:00
Pieter De Baets fdb2427a86 Add getNativeModule(String) to ReactContext interface (#44851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44851

This method is available on the (deprecated) CatalystInstance interface, but not on ReactContext, even though it is trivially supported.

Changelog: [Android][Added] - Added getNativeModule(name) to ReactContext

Reviewed By: cortinico

Differential Revision: D58355135

fbshipit-source-id: 0cc76bb2da2b49510dc626cb8b3a3e93db5a16b0
2024-06-10 09:02:05 -07:00
Rubén Norte e94852ff28 Modify IntersectionObserver example in RNTester to showcase changes in intersection due to changes in layout, instead of scroll (#44823)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44823

Changelog: [internal]

This modifies the example for `IntersectionObserver` in RNTester to test that the API reports changes in intersection also coming from changes in layout (previously is was only from changes in scroll position).

Reviewed By: javache

Differential Revision: D58260057

fbshipit-source-id: 305d5996148730d718da30896f6cc62991b717f7
2024-06-10 08:28:45 -07:00
Peter Abbondanzo 0b8222a854 Fix status bar height calculation for all cutout sizes (#44805)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44805

Google has discouraged attempting to read the `status_bar_height` resource [since 2017](https://youtu.be/_mGDMVRO3iE?si=qGQd7gLa_qTmfLGL&t=1079). With the introduction of display cutouts there can be a mismatch between the resource value and the true status bar size (and issues like [this one](https://github.com/facebook/react-native/issues/33612) popped up). The recommended approach is to instead call `getInsets` with the proper status bar and navigation flags provided by `WindowInsets`. On older APIs where `getInsets` is not supported, we have access to `systemWindowInsetTop`.

Changelog:
[Android][Fixed] - Fixed StatusBar.currentHeight calculations to honor all cutout sizes

Reviewed By: tdn120

Differential Revision: D58088036

fbshipit-source-id: 9c035a79cbb96db1cf3b5b5c36242df7453fe205
2024-06-10 08:25:33 -07:00
Riccardo Cipolleschi 01822eb66f Add VisionOS support to GHA nightlies (#44855)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44855

We recently landed a change that added support for VisionOS in the general test case for GHA but we forgot to include nightlies.

This change takes the same changes applied to [this file](https://github.com/facebook/react-native/pull/44691/files#diff-12d2c3c126fcc84106dce4b6d2be2220f018661b111a5382ad6effc1047f66aeR114-R368) and applies them to the nightlies.

## Changelog:
[Internal] - Add GHA nightlies support for VisionOS

Reviewed By: huntie

Differential Revision: D58358115

fbshipit-source-id: 577f62e53fb530bc534ba98508801a6970aef095
2024-06-10 07:12:02 -07:00
Riccardo Cipolleschi a8f4f1d658 Fix External CI (#44854)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44854

In the previous change, I followed the suggestion of the linter but in that case I shouldn't.

This was breaking circleci and GHA

This change will fix it

## Changelog:
[Internal] - Fix OSS CI

Reviewed By: huntie

Differential Revision: D58358164

fbshipit-source-id: eba1f41c17a191aa9d3bd213fddddd8ff3c24a6a
2024-06-10 05:53:06 -07:00
Oskar Kwaśniewski 924fb3de9b feat: build visionos hermes binary on the CI (#44691)
Summary:
As discussed with cipolleschi offline, this PR adds visionOS to the prebuilt Hermes binary for the CI.

## Changelog:

[IOS] [ADDED] - Prebuilt version of Hermes for visionOS

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

Test Plan: Check if CI builds xcframework for visionOS.

Reviewed By: cortinico

Differential Revision: D58189271

Pulled By: cipolleschi

fbshipit-source-id: dc76746b2c1e22670bef4c21411a598e43dad577
2024-06-10 04:52:24 -07:00
Oskar Kwaśniewski 38bae4bdf4 fix: run nightly CI only on the main repo (#44844)
Summary:
I've noticed that nightly CI build was also running on my fork. I don't think this is necessary for every React Native fork (there are 24k of forks). This can save lots of unnecessary CI time.

## Changelog:

[INTERNAL] [FIXED] - Enable nightly run only on the main repo

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

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

Test Plan: CI Green

Reviewed By: cipolleschi

Differential Revision: D58356192

Pulled By: cortinico

fbshipit-source-id: 1384d06708220d297e67d31433fcf3ac1d58bbbc
2024-06-10 04:32:46 -07:00
Riccardo Cipolleschi 9fa0764334 Fix Nightlies for Android (#44847)
Summary:
While migrating from CCI to GHA, we mistakenly set the `ORG_GRADLE_PROJECT_reactNativeArchitectures` wrongly. The result was that the nightly was building only 1 architecture for android instead of all of them.

This change fixes that, but asking GHA to build all the architectures when running nightlies

bypass-github-export-checks

## Changelog:
[Internal] - Build all the architectures for android when running nightlies

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

Test Plan: Run a nightly from the branch and see it working

Reviewed By: huntie

Differential Revision: D58347697

Pulled By: cipolleschi

fbshipit-source-id: 43a2b83ba9183e6f5a11d1e6f6a27df622ee8cc6
2024-06-10 03:56:24 -07:00
Nicola Corti feeb4b773b Remove import of com.facebook.react.ReactSettingsExtension (#44850)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44850

I'm removing this line from settings.gradle:
```
import com.facebook.react.ReactSettingsExtension
```
and just using a fully qualified class name in the `configure{}` block
as imports cannot be conditionally included and is making hard for RNTA
to integrated those changes.

Changelog:
[Internal] [Changed] - Remove import of `com.facebook.react.ReactSettingsExtension`

Reviewed By: huntie

Differential Revision: D58354443

fbshipit-source-id: bc45516661318021a042e1c5921e28d7217cacbc
2024-06-10 03:26:34 -07:00
Nicola Corti 6937c7044b rncli.h -> autolinking.h (#44829)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44829

Another renaming that now we can merge to make clear what's the intent of this header.

Changelog:
[Internal] [Changed] - rncli.h -> autolinking.h

Reviewed By: javache

Differential Revision: D58284662

fbshipit-source-id: 7b69118f72d9b34a88ece7e0855918f5c717999a
2024-06-09 05:09:18 -07:00
Levi Buzolic 2483c63017 Add missing remove method to addEventListener Jest mocks (#44270)
Summary:
While writing some Jest tests, I noticed some instances of the following error:

```
Cannot read properties of undefined (reading 'remove')
```

Looks like there were two cases where the `{remove: () => {}}` return result was missing in the provided Jest mocks:

 - `AccessibilityInfo.addEventListener`
 - `Linking.addEventListener`

## Changelog:

[GENERAL] [FIXED] - Added missing `remove` methods for `Linking.addEventListener` and `AccessibilityInfo.addEventListener` Jest mocks

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

Test Plan: N/A

Reviewed By: christophpurrer

Differential Revision: D58324784

Pulled By: robhogan

fbshipit-source-id: f46bd55db2517413f14182ae1bb81068d8d1e9f6
2024-06-08 10:59:04 -07:00
Nicola Corti 61de7da032 PackageList2 -> PackageList (#44828)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44828

I was using PackageList2 temporarily as I was migrating to Core Autolinking.
Now we can rename everything to `PackageList` to reduce the number of changes to the template for users.

Changelog:
[Internal] [Changed] - PackageList2 -> PackageList

Reviewed By: blakef

Differential Revision: D58284661

fbshipit-source-id: 8e1cc54e248519ece05336d79bb79e3f4ca706f4
2024-06-07 11:02:40 -07:00
Vitali Zaidman 138d50f412 Update debugger-frontend from 3307f31...fa5df76 (#44839)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44839

Changelog: [Internal] - Update `react-native/debugger-frontend` from 3307f31...fa5df76

Resyncs `react-native/debugger-frontend` from GitHub - see `rn-chrome-devtools-frontend` [changelog](https://github.com/facebookexperimental/rn-chrome-devtools-frontend/compare/3307f310241a11811288f70c756fded3b9ec2951...fa5df7604089aa4015132bb66b1d0b88411cc4c6).

Reviewed By: EdmondChuiHW

Differential Revision: D58291849

fbshipit-source-id: 10dd25c205b13b3ae142e9af552c23809dd3e9ce
2024-06-07 10:49:00 -07:00
Nicola Corti 8ce450c435 Convert MountingManagerTest to Kotlin (#44837)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44837

As the title says.

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

Reviewed By: javache

Differential Revision: D58290597

fbshipit-source-id: a5c499fbffcaeef4e21ebbca1904b22803c35270
2024-06-07 10:40:36 -07:00
Ingrid Wang f4b921c1d5 Fix broken scroll view caused by D58157667 (#44820)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44820

# Changelog

[iOS][Fixed] Fixing scroll view breakage caused by #44789

Reviewed By: cipolleschi

Differential Revision: D58260014

fbshipit-source-id: 375697f1103ba7794f572f490b409a1d27304e66
2024-06-07 10:39:33 -07:00
Nicola Corti 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
Chang Yan d8a0d30e70 Build and sync lint/sort-imports from WWW (#44824)
Summary:
X-link: https://github.com/facebook/relay/pull/4708

X-link: https://github.com/facebook/metro/pull/1285

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

Run the build script based on the commit in D58271034.

Changelog: [Internal]

NOTE: Test plan and summary intentionally obfuscated because it's exported to an external github pull request, but trust me.

Reviewed By: yungsters

Differential Revision: D58271323

fbshipit-source-id: be19c63d630281b9f6feca00b24f45d000e07089
2024-06-07 10:01:49 -07:00
Benoit Girard 5a4cb3de3d Add Perfetto Hermes Sampling Data Source (#44818)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44818

Introduce a new data source for Perfetto. This one turns on the Hermes sampler, and at the end we flush the state to Perfetto.

This provides JS sampling data in Perfetto traces that can be used to easily spot JS performance problems not otherwise obvious.

Reviewed By: javache

Differential Revision: D57226087

fbshipit-source-id: 77c4a335bb462e73d74345eedc3fa634405bfd0f
2024-06-07 09:52:42 -07:00
Riccardo Cipolleschi 2b343ca449 Handle lowercase->uppercase of hermes ios artifacts (#44836)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44836

Sometimes, GHA creates artifacts with lowercase Debug/Release. Make sure that if it happen, we uppercase them.

## Changelog
[Internal] - Handle lowercase->uppercase of hermes ios artifacts

Reviewed By: cortinico

Differential Revision: D58290049

fbshipit-source-id: c1e76e9e5718500378ba08d26d5c4dd0620c78c4
2024-06-07 08:38:04 -07:00
Alex Hunt df19e597e3 Remove faviconUrl field from CDP list response (#44834)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44834

- Remove the nonstandard, unused `faviconUrl` field from CDP `/json` response targets (note: both legacy and modern targets).
- Reorder `PageDescription` members.

Changelog:
[General][Removed] - `react-native/dev-middleware`: Remove nonstandard `faviconUrl` field from CDP `/json` response

Reviewed By: hoxyq

Differential Revision: D58092090

fbshipit-source-id: a593be00464853a3fe179305efae5643d616573b
2024-06-07 08:23:45 -07:00
zhongwuzw 1a1795a537 Fixes enum codegen value cases (#44654)
Summary:
Fixes https://github.com/facebook/react-native/issues/44632

## Changelog:

[GENERAL] [FIXED] - [codegen] Fixes enum codegen value cases

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

Test Plan: https://github.com/facebook/react-native/issues/44632

Reviewed By: cipolleschi, dmytrorykun

Differential Revision: D58135645

Pulled By: cortinico

fbshipit-source-id: 5c0634ef1d1d7375d2ecfcf7f916d67fd39b7300
2024-06-07 07:53:59 -07:00
Nicola Corti 538dd1760d Add libmapbufferjni.so to pickFirst directives (#44827)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44827

After D57856389 (#44684), the build is now firing an issue as `libmapbufferjni.so` is exposed as a public `.so` and we're missing a pickFirst directive.

Changelog:
[Internal] [Changed] - Add libmapbufferjni.so to pickFirst directives

Reviewed By: javache

Differential Revision: D58284481

fbshipit-source-id: d476bd5df8ec4687177df7a698cbb6595ce62565
2024-06-07 07:06:37 -07:00
Riccardo Cipolleschi f57d6246f1 Bump build_npm_package machine to more powerful ones (#44831)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44831

The build_npm_package jobs remains sometimes in queue because there are not enough executors for it to run.
This makes our signals less reliable.

Plus, it is rebuilding part of Android, so it can benefit from a bigger machine

## Changelog:
[Internal] - Bump build_npm_package machine to more powerful ones

Reviewed By: cortinico

Differential Revision: D58284884

fbshipit-source-id: a29b7db843633ff3cfd9373cf4dbe55b24c939b1
2024-06-07 05:38:46 -07:00
Riccardo Cipolleschi a7d5bbada9 Remove Nightlies (#44830)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44830

Now that we have nightlies in GHA, we can safely remove them from CCI.

## Changelog:
[Internal] - Remove Nightlies from CCI

## Facebook:
Once this land, we need to disable the trigger in the CCI setting page.

Reviewed By: cortinico

Differential Revision: D58284941

fbshipit-source-id: 9a6ceb416de1d54f59f784a61509cd93f5684aaf
2024-06-07 05:32:44 -07:00
Pieter De Baets 7ee2dcb0f0 Cleanup enableBridgelessArchitectureNewCreateReloadDestroy (#44826)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44826

This was rolled out a while back, but some references remained.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D58190612

fbshipit-source-id: e7884909959c98eb5617c9dee75f4ce53834b05c
2024-06-07 05:24:57 -07:00
Andrew Coates dbdd4da14f Add ability to override the ViewStyle of the root View component (#44665)
Summary:
In order to host a ReactNative surface whose size is controlled by the RN content rather than the size of the surface, we need the ability to remove  the flex:1 style on the root View component.

`SurfaceHandler` has layout functions which take a `LayoutConstraint` (so min/max size).   The root View component in `AppContainer` has a hardcoded `flex:1` style.  This view is above the `WrapperComponent`, which we can currently override.  But I dont see anyway to avoid the root View having that flex style.  This flex style means that the rootview will always be the maxheight passed into the layout functions on `SurfaceHandler`.  Which prevents allowing RN surfaces that can size themselves based on their content.

This change adds a `setRootViewStyleProvider` method to `AppRegistry`, which works similar to `setWrapperComponentProvider` but allows apps to override the style property on the root View component.  In particular, this allows apps to remove the flex:1 style, which is required to enable react surfaces which are sized based on their contents.

## Changelog:

Pick one each for the category and type tags:

[GENERAL] [ADDED] - Added AppRegistry.setRootViewStyleProvider

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

Test Plan: Will be including this change into react-native-windows to enable scenarios with content sized surfaces within Microsoft Office to work with the new architecture.  Would like signoff on this direction before I go and integrate it there.

Reviewed By: javache

Differential Revision: D58138443

Pulled By: hoxyq

fbshipit-source-id: 95ab4842aa7f827867788d8787527f9675cf4fcc
2024-06-07 03:19:43 -07:00
Wojciech Lewicki f5c888c2d7 feat: move notifying observers to event dispatcher (#44474)
Summary:
Based on the discussion starting here: https://discord.com/channels/514829729862516747/1073566663825432587/1237407161991172157, I suggest moving the call to `_notifyEventDispatcherObserversOfEvent_DEPRECATED` straight to `RCTEventDispatcher.mm`. It was previously in `RCTInstance.mm` which is only relevant on bridgeless mode. We want to mimic the behavior of https://github.com/facebook/react-native/blob/06eea61c19cd730cf0c14a436f042d30791c3f4a/packages/react-native/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm#L75-L78 but without using `currentBridge` since it is considered bad practice: https://github.com/software-mansion/react-native-reanimated/issues/5497#issuecomment-2083400038.

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[IOS] [CHANGED] - Move `notifyObservers` straight to `RCTEventDispatcher.mm`.

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

Test Plan:
See that example with `stickyHeaders` still works correctly on both bridgeless and bridge mode.

Videos with it on https://github.com/facebook/react-native/blob/deee037c62a7d62a349d34db427b14d3560ddf83/packages/rn-tester/js/examples/FlatList/FlatList-stickyHeaders.js example with more items for visibility:

- bridgeless:

https://github.com/facebook/react-native/assets/32481228/8b78104a-226b-466a-9f32-60ba4ec14100

- bridge:

https://github.com/facebook/react-native/assets/32481228/f2ca67cb-578f-45d4-954f-3249c6fa9410

- old arch:

https://github.com/facebook/react-native/assets/32481228/7d642923-ddda-4dd3-8f14-c9982a03bc2e

Reviewed By: javache

Differential Revision: D57097880

Pulled By: cipolleschi

fbshipit-source-id: de1504e90529fe4f001f44f02ace329386cf7727
2024-06-07 03:15:09 -07:00
Riccardo Cipolleschi ace899a2bb Setup Nightlies (#44741)
Summary:
This change adds a separate workflow for Nightlies. This workflow do not run tests on iOS and Android and proceed to release a nightly.

**🚨 Important 🚨** We need to update the GHA secrets as there is none set.

_Note: This is a first step to ensure that we can release Nightlies from GHA. I'll factor out all the actions in following updates to cleanup and refactor once we know that everything works!_

## Changelog:
[INTERNAL] - Add nightlies workflow on GHA

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

Test Plan:
1. Add the `pull_request` trigger to see the workflow start
2. Monitored the workflow to make sure that it worked
3. Tested the nightly locally
4. Removed the `pull_request` trigger, otherwise we would publish a nightly on each PR! xD

Reviewed By: cortinico

Differential Revision: D58084002

Pulled By: cipolleschi

fbshipit-source-id: 593145392fe686930ccb00beb68d9130b8401cbc
2024-06-07 01:27:25 -07:00
filip131311 b957513cc6 Fix Application always in light mode on initial load. (#44335)
Summary:
Hi, I'm Filip from software mansion.  This PR solves a problem I stumbled upon.

On iOS, applications are always in light mode on initial load. Even if the device is turned to dark mode.

### Cause of the problem:

The initial appearance is taken from `RCTKeyWindow()`, but at the time of initialization of `RCTAppearance` it does not exist yet.

### Solution:

This PR moves repeats initialization of the appearance the first time `getColorScheme()` is called if it was not initialized properly before.

## Changelog:

[IOS] [FIXED] - Fix dark mode on initial load.

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

Test Plan:
- Create new React native app with `npx react-native@latest init AwesomeProjec`
- Run the application on iphone using simulator
- turn on dark mode using `cmd+shift+A`
- close application and run it again

### without changes:
  The application will turn on in light mode despite the simulator being set to dark mode.
  When you reload the application it works as expected (is in dark mode)

### with changes:
  Works as expected

#### note:
any change to device ui settings will trigger a listener that will set appearance to correct state, so testing of this problem should happen in as isolated conditions as possible.

Reviewed By: cortinico

Differential Revision: D58189058

Pulled By: cipolleschi

fbshipit-source-id: 9a864f3d045e966bc88601f661d221c4796c5c95
2024-06-07 01:03:29 -07:00
Blake Friedman b5fd041917 swap test_ios_template for test_ios_helloworld in CircleCI (#44815)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44815

Remove our `test_ios_template` job for `test_ios_helloworld`.

NOTE: There needs to be a followup to do the same in our Github Actions.

Changelog: [General][Changed] use helloworld instead of template for CI tests.

Reviewed By: cipolleschi

Differential Revision: D57122797

fbshipit-source-id: 744c79230b716716fdfc234832f1eb241e091893
2024-06-06 14:41:19 -07:00
Pieter De Baets 4324f08749 Add experiment to bypass bridgeless background executor (#44797)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44797

Noticed when profiling bridgeless that  that every call into JS would be passed via a (default priority) background thread first. This is inefficient from a scheduling perspective. Instead use the Task's default/immediate executor to immediately execute the success callback on the current thread and avoid a thread change.

This diff adds a new feature flag, to use the immediate executor for any ReactInstance method that doesn't require further synchronization within ReactInstance. For most methods, this is indeed unnecessary as ReactInstance will synchronize internally by scheduling work on the JS thread.

Changelog: [Android][Added] Added featureflag to avoid additional background threads during execution

Reviewed By: cortinico

Differential Revision: D58186090

fbshipit-source-id: 67ffed2d34083a6b6e7871160a2f3d6f1967d630
2024-06-06 13:15:45 -07:00
Kudo Chien 52cec1e798 Decouple DevInternalSettings from DevSupportManagerBase (#44441)
Summary:
I was tried to fix breaking changes for Expo's React Native nightlies CI testing. Recently React Native core has some effort to migrate Java code to Kotlin. Since https://github.com/facebook/react-native/commit/a977b2e69, we cannot reuse the `DevSupportManagerBase` and replace `DevInternalSettings` inside [expo-dev-client](https://github.com/expo/expo/blob/26c9f49042f53db7d37f832c133d4da0f6d64f02/packages/expo-dev-launcher/android/src/debug/java/expo/modules/devlauncher/helpers/DevLauncherReactUtils.kt#L117-L126) because we cannot access to the `DevInternalSettings` anymore because Kotlin "internal" visibility.
This PR tries to decouple `DevInternalSettings` from `DevSupportManagerBase` then we could still use reflection to change the mDevSettings.

## Changelog:

[ANDROID] [CHANGED] - Decouple `DevInternalSettings` from `DevSupportManagerBase`

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

Test Plan: CI passed

Reviewed By: tdn120

Differential Revision: D57054234

Pulled By: cortinico

fbshipit-source-id: e87d64518cf98182e1d98b215038a1755dae84a0
2024-06-06 12:14:04 -07:00
Ingrid Wang ce10ce4d98 Migrate RCTScrollView off of deprecated scrollIndicatorInsets (#44789)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44789

# Changelog

[iOS][Fixed] Remove usage of deprecated scrollIndicatorInsets in RCTScrollView

Reviewed By: cipolleschi

Differential Revision: D58157667

fbshipit-source-id: be0fd4075934060f9419a8164ad3f7fd378d3ce7
2024-06-06 09:28:29 -07:00
Elene Botchoradze ed9978b8de feat(iOS): add all supported ReturnKeyTypes (#43362)
Summary:
Related issue: https://github.com/facebook/react-native/issues/43243
As [documentation](https://reactnative.dev/docs/textinput#returnkeytype) stated for the ReturnKeyType prop on the input there are different options, like "next", "go" and etc. They are actually supported on the iOS side but we can't use it in our react native app, because of the hardcoded version of DoneButton on existing code:
<img width="887" alt="image" src="https://github.com/facebook/react-native/assets/53994979/9ecaf63b-675c-45f0-b737-7ae3e937584a">
So, I decided to add support for types which were in documentation

## Changelog:
[IOS] [ADDED]: ReturnKeyTypes
<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests

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

Test Plan:
ran yarn jest react-native-codegen and yarn jest react-native, both successfully:
<img width="420" alt="image" src="https://github.com/facebook/react-native/assets/53994979/c36b61f7-ef45-4062-ac5b-1dd2d0a9e544">

<img width="420" alt="image" src="https://github.com/facebook/react-native/assets/53994979/af83c22c-d110-4c28-94c1-d48ee27bfcfe">

Reviewed By: cortinico

Differential Revision: D56571845

Pulled By: cipolleschi

fbshipit-source-id: 74dbffb3795ab0b5c9eafa685761c2e770cd5cf9
2024-06-06 09:21:49 -07:00
Marlene Cota 3b60c86453 Fix signed/unsigned mismatch in BoundedConsumableBuffer.h (#44806)
Summary:
Previous PR (https://github.com/facebook/react-native/issues/44564) missed one int -> size_t switch to fix C4018 in react-native-windows.
![image](https://github.com/facebook/react-native/assets/1422161/373480ed-7f49-4c01-a7ac-ea65a347ab1c)

## Changelog:

[INTERNAL] - Fix signed/unsigned mismatch in BoundedConsumableBuffer.h

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

Test Plan: Builds on Windows + identical to forked file used in react-native-windows.

Reviewed By: cortinico

Differential Revision: D58234088

Pulled By: javache

fbshipit-source-id: 0453f3509c97854975b90e7a3b8c458ca977ec65
2024-06-06 08:43:50 -07:00
Moti Zilberman bbf8a87ce7 Defer HostTarget destruction until after the instance has been unregistered (#44767)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44767

Changelog: [Internal]

Fixes a lifecycle bug in both the Bridge (`com.facebook.react.bridge`) and Bridgeless (`com.facebook.react.runtime`) integrations of Fusebox in React Native Android, whereby `HostTarget::unregisterInstance` gets called after the `HostTarget` has been destroyed.

The solution consists of two parts:

1. If a ReactHost / InstanceManager is asked to destroy itself while it contains no active ReactInstance / ReactContext, we destroy the `HostTarget` immediately.
2. Otherwise, if there *is* a live ReactInstance / ReactContext that has yet to be destroyed, we wait for that to happen before destroying the `HostTarget`. In practice, we do this by checking for the BEFORE_CREATE ( = Host destroyed) lifecycle state every time we destroy a ReactInstance / ReactContext.

Reviewed By: javache

Differential Revision: D58031215

fbshipit-source-id: 321c73e85afd17a1b38c63f73aee5ebb59c00686
2024-06-06 07:38:23 -07:00
Blake Friedman 9744fa9283 cli support to bundle, build & upload (#44722)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/44722

Add support for bundling, building and uploading on iOS.  I've verified these locally and will enable on CircleCI to validate.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D57915365

fbshipit-source-id: 1e73918b31f70d337de4d3aee934c8acf88c86d0
2024-06-06 07:06:29 -07:00
Oskar Kwaśniewski 756f89aa59 feat: set Swift active compilation conditions build setting to DEBUG (#42330)
Summary:
This PR adds cocoapods utility to set `SWIFT_ACTIVE_COMPILATION_CONDITIONS` to DEBUG, which is set to this value by default (when generating a new native Xcode project).

This allows to use the `#if DEBUG` compilator directive in Swift to work out of the box, without any changes on user's side:

```swift
override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }
```

## Changelog:

[IOS] [ADDED] - Set SWIFT_ACTIVE_COMPILATION_CONDITIONS to DEBUG

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

Test Plan:
Run `bundle exec pod install` and check if the active compilation flags are populated:

![CleanShot 2024-01-17 at 13 11 03@2x](https://github.com/facebook/react-native/assets/52801365/68f119a6-af47-41bc-a1f1-9085fe4df6a0)

Reviewed By: cortinico

Differential Revision: D58188103

Pulled By: cipolleschi

fbshipit-source-id: 64746f3c7bfbdf47c2dea5e5e8cb2962635b719b
2024-06-06 04:06:28 -07:00