Commit Graph

38536 Commits

Author SHA1 Message Date
Pieter Vanderwerff 2608a37564 Deploy 0.216.0 to xplat (#39319)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39319

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D49031141

fbshipit-source-id: 926f471d0843484466918f28dd0369d38db333a7
2023-09-07 09:00:56 -07:00
Nicola Corti c0244c6445 Add no_output_timeout: 30m to E2E jobs (#39322)
Summary:
Just increases the timeout as the E2E test runs

## Changelog:

[INTERNAL] - Add no_output_timeout: 30m to E2E jobs

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

Test Plan: CI should be green

Reviewed By: cipolleschi

Differential Revision: D49056677

Pulled By: cortinico

fbshipit-source-id: c9b9af4b0fe2331a217438e303316a1f379c9e8d
2023-09-07 08:31:25 -07:00
Cody Bennett a228b0f341 BlobManager: implement Blob from ArrayBuffer (#39276)
Summary:
Fixes a critical networking path used commonly in graphics code, among many other use-cases. It is commonplace to store images within a single binary such as a GLB (see [KHR_binary_glTF](https://github.com/KhronosGroup/glTF/blob/main/extensions/1.0/Khronos/KHR_binary_glTF/README.md#overview)). Base64 encoded glTF can be critically slow in older browsers with an increased size, so it's not a suitable fallback for those targeting multiple platforms. Furthermore, large base64 payloads can cause crash behavior on native when passed via JSI (e.g. `expo-gl`). For textures, this can be several megabytes of high precision data, and a uri from a blob is preferred rather than writing platform-specific workarounds via the filesystem.

A user-land patch I've employed in [pmndrs/react-three-fiber](https://github.com/pmndrs/react-three-fiber), as well as [existing user-land patches](https://github.com/mrousavy/react-native-blob-jsi-helper), is to test the `Blob` constructor with an empty `ArrayBuffer`. `base64-js` is used here since it's already installed with `react-native` for binary utils elsewhere. This is declared as a dependency in the linked library since this is an implementation detail, but will be de-duplicated at install time.

```js
import { fromByteArray } from 'base64-js'

// Patch Blob for ArrayBuffer if unsupported
try {
  new Blob([new ArrayBuffer(4)])
} catch (_) {
  global.Blob = class extends Blob {
    constructor(parts, options) {
      super(
        parts?.map((part) => {
          if (part instanceof ArrayBuffer || ArrayBuffer.isView(part)) {
            part = fromByteArray(new Uint8Array(part))
          }

          return part
        }),
        options,
      )
    }
  }
}
```

## Changelog:

[INTERNAL] [FIXED] - Implement Blob from ArrayBuffer

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

Test Plan:
Run the following at the project root to selectively test changes:

`jest packages/react-native/Libraries/Blob`

> **Note**: base64 encoding will add an additional ~33% size increase to binary data as part of this PR. This is padded to 4 bytes so a byte length of 4 will encode as 8. Native `ArrayBuffer` support would not have this behavior and remove the overhead of base64 encoding back and forth. This is a growing behavior across the networking stack, such as in `FileReader`.

Reviewed By: NickGerleman

Differential Revision: D48954160

Pulled By: dmytrorykun

fbshipit-source-id: 9d3b984aefe16bad2ee1088140b6e1160df52f55
2023-09-07 03:41:49 -07:00
Saad Najmi 1b78da8b43 min_ios_version_supported -> min_supported_versions (#39310)
Summary:
## Summary:

One of the most common diffs we have in React Native macOS is simply extending the `platforms` key Inside every pod spec to include macOS. React Native tvOS does the same to add tvOS. In the future, React Native may support visionOS, at which point we do the same thing again. Let's define a `min_supported_versions` hash that can be overridden at one place that is extensible to more platforms, instead of just specifying `min_ios_version_supported`.

Note: In doing this change, I have set it that `React-Hermes.podspec` doesn't build for macOS anymore. I think this is safe, since anyone using Hermes on macOS was probably using React Native macOS where we already have a diff to add macOS back?

## Changelog:

[IOS] [CHANGED] - Add min_supported_versions helper to cocoa pods scripts

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

Test Plan: CI should pass.

Reviewed By: NickGerleman

Differential Revision: D49014109

Pulled By: dmytrorykun

fbshipit-source-id: d44fc7b750c70cc263a2c89502c022a0db9a4771
2023-09-07 03:16:23 -07:00
Adam Cmiel 4d9bd90401 - xplat RN (#39250)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39250

https://developer.apple.com/documentation/foundation/nsstring/1497289-stringwithcstring

## Changelog:
[iOS][Fixed] - Remove usage of deprecated stringWithCString function

Reviewed By: christophpurrer

Differential Revision: D48692609

fbshipit-source-id: 36d96470adfc2ebb4a6a83522131644fda54f2aa
2023-09-06 17:23:32 -07:00
Intl Scheduler 030c26d678 translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907940938256
Sandcastle Job Instance ID: 4503600666692019
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D49038807

fbshipit-source-id: 2715b40215e30bda5668c3e4fc85d697e3e56f42
2023-09-06 17:10:09 -07:00
Maciej Jastrzębski 2749fbca9a fix: role="searchbox" should assing "SearchField" trait on iOS (#39314)
Summary:
Experimenting with Accessibility Inspector on iOS I've discovered that while when assigning `accessibilityRole="searchbox"` to a text input results in "Traits" reporting "Search Field" trait. However, when using ARIA-compatible `role="search"` such trait is not assigned, and text input will have an empty trait.

Afaiu this is incorrect as using `role="search"` and `accessibilityRole="searchbox"` should equivalent effect.

## 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 FIXED - `role="searchbox"` now assigns "Search Field" accessibility trait to a view

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

Test Plan: No UI changes, it affects only accessibility.

Reviewed By: NickGerleman

Differential Revision: D49014039

Pulled By: dmytrorykun

fbshipit-source-id: 5fb194e67fbf2ac339d9a746e3ce6aaed2d32558
2023-09-06 15:06:46 -07:00
generatedunixname89002005325672 ef3e771a23 Daily arc lint --take KTFMT (#39315)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39315

Changelog: [Internal]

Reviewed By: hick209

Differential Revision: D49004383

fbshipit-source-id: 4e0f6af998b35dba92788250360aa3f20e645020
2023-09-06 08:38:52 -07:00
Nick Gerleman 9411e593e2 Enable -Wconversion (#39291)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39291

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

This enables clang warnings around potentially unsafe conversions, such as those with mismatched signedness, or ones which may lead to truncation.

This should catch issues in local development which create errors for MSVC (e.g. Dash), who's default `/W3` includes warnings akin to `-Wshorten-64-to-32`.

This full set of warnings here is a tad spammy, but probably more useful than not.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D48954777

fbshipit-source-id: 1ccc07b99d09d1c2d428158149698ffd04025605
2023-09-06 08:16:42 -07:00
Pieter De Baets 850349b1d2 Fix Transform flip example on new renderer (#39259)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39259

This matches the [behaviour we had in the old renderer](https://github.com/facebook/react-native/blob/main/packages/react-native/React/Views/UIView%2BReact.m#L145) where zIndex is mapped to the CALayer's zPosition. This is required to prevent clipping of views in rotation transforms as currently used in the TransformExample.

Changelog: [iOS][Fixed] Rotation transforms are no longer clipped when zIndex is applied

Reviewed By: christophpurrer

Differential Revision: D48905010

fbshipit-source-id: 56dea38da94ae32a88bbce3f29c3cce9ddbbf010
2023-09-06 07:41:46 -07:00
Dmitry Rykun 99a306dd9e Reuse test_ios_rntester to run iOS tests (#39277)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39277

When we were reworking the Build logic in CI, we thought that the `test_ios` job and the `test_ios_rntester` jobs were the same. But, actually, they aren't.
So, now, we are seeing failures in the `test_ios` because its caches are not updated.

This changes remove the duplication of the two jobs, making sure that they use the same job, adding the possibility to run tests directly in rntester.

## Changelog:
[Internal] - Reuse test_ios_rntester to run iOS tests

Reviewed By: motiz88

Differential Revision: D48950096

fbshipit-source-id: e297d77fbd18f03873ed7a16a595e186d0e2453a
2023-09-06 07:18:48 -07:00
Pieter De Baets 38cb9d4a88 Fix view recycling incorrectly resetting transform (#39306)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39306

This broke on Android platforms where `ReactFeatureFlags.enableViewRecycling` is enabled, as `setTransform` no longer directly mutates the transform properties, but instead goes through `setTransformProperty`

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49008194

fbshipit-source-id: 7e5543b8ce79caaaf380f20010bdde69f6e212b1
2023-09-06 06:39:11 -07:00
Ruslan Shestopalyuk edff5e977e Fix OSS Android build with enableWarningsAsErrors=true (#39311)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39311

## Changelog:
[Internal] -

Follow up to https://github.com/facebook/react-native/pull/39284 (D48960815), which landed and broke one of the build clauses on CircleCI tests (treating unused parameters as errors, even though they are expected to be unused).

Reviewed By: hoxyq

Differential Revision: D49010472

fbshipit-source-id: 469bf3a9923b85e465d4574e69e9372c16fbc125
2023-09-06 06:27:43 -07:00
Vojtech Novak b08d0df95f refactor: improve useColorScheme subscription efficiency (#38001)
Summary:
motivation: re-rendering `useColorScheme()` hook with what is on the main branch means there is a subscribe + unsubscribe dance happening.

related docs: https://react.dev/reference/react/useSyncExternalStore#my-subscribe-function-gets-called-after-every-re-render

## Changelog:

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

Pick one each for the category and type tags:

[INTERNAL] [CHANGED] - improve useColorScheme subscription efficiency

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

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

Test Plan: tested locally in an app

Reviewed By: rshest

Differential Revision: D49008053

Pulled By: javache

fbshipit-source-id: f8a9fc8950277e2bae8bd8774bf21312a67d46d5
2023-09-06 06:24:03 -07:00
Pieter De Baets 7ac58772b1 Clarify meaning of State constructor args (#39307)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39307

Make it explicit that the second arg for the State update constructor is the old State object, which we use to increment the revision.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D49008431

fbshipit-source-id: 649bdd136a4a6eb25858d8bfb7c41b725e593685
2023-09-06 05:58:57 -07:00
Saad Najmi fb30fcaa2f Remove redundant ifdefs for ArrayBuffer backwards compatibility (#39302)
Summary:
We're well past a minimum iOS 10 / macOS 10.11 version. Let's remove these ifdefs that seemed to have been added for backwards compatibility around the use of [ArrayBuffers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)

## Changelog:

[IOS] [REMOVED] - Remove redundant ifdefs for ArrayBuffer backwards compatibility

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

Test Plan: CI should pass.

Reviewed By: rshest

Differential Revision: D49007666

Pulled By: javache

fbshipit-source-id: 03ebe303eda45ce043e3c2f9e2a5165ba798b15c
2023-09-06 05:23:13 -07:00
IzuEneh 89739780a6 Convert ReactPropForShadowNodeSpecTest to Kotlin (#39284)
Summary:
This PR converts ReactPropForShadowNodeSpecTest to Kotlin. https://github.com/facebook/react-native/issues/38825

## Changelog:

[INTERNAL] [CHANGED] - Kotlinify ReactPropForShadowNodeSpecTest.java

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

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

Test Plan: `./gradlew :packages:react-native:ReactAndroid:test` must pass

Reviewed By: javache

Differential Revision: D48960815

Pulled By: rshest

fbshipit-source-id: d66ab64373e300c5fff6fa2013faac473890804c
2023-09-06 04:18:58 -07:00
Arushi Kesarwani 1e2af658f3 Cocoapods changes for Bridgeless -> Runtime (#39299)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39299

`Bridgeless` -> `Runtime` for the actual Ruby file
changelog: [internal] internal

Reviewed By: fkgozali

Differential Revision: D48986015

fbshipit-source-id: d815fc33b7589dd2b0099cea1151d08d3314ee70
2023-09-06 01:28:08 -07:00
Danny Su cc059bf6aa Remove deprecated inspector and jsinspector (#39300)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39300

Changelog: [Internal]

`ReactCommon/hermes/inspector` and `ReactCommon/jsinspector` are unused in the React Native repo as of D48897203 and D48966244, respectively. Now that we've removed the last remaining references to them from internal Meta code, we can safely delete them from React Native.

Reviewed By: christophpurrer

Differential Revision: D48983212

fbshipit-source-id: 9a70178b19fb461c00a2304697b647b7bebe74c3
2023-09-05 21:00:22 -07:00
Fábio Henriques 5258f3a7b4 Convert ReactPropAnnotationSetterSpecTest to Kotlin (#39104)
Summary:
This PR converts `ReactPropAnnotationSetterSpecTest.java` to Kotlin as requested in [this issue](https://github.com/facebook/react-native/issues/38825).

## Changelog:

[INTERNAL] [CHANGED] - Convert ReactPropAnnotationSetterSpecTest to Kotlin

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

Test Plan:
1. Run `./gradlew :packages:react-native:ReactAndroid:test`.
1. All tests should pass.

Reviewed By: rshest

Differential Revision: D48974801

Pulled By: mdvacca

fbshipit-source-id: 2a666250315b0d83ccb08edde75d37e3083a2026
2023-09-05 14:15:23 -07:00
Moti Zilberman a04a91838f Fork jsinspector as jsinspector-modern (#39288)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39288

Forks `ReactCommon/jsinspector` → `ReactCommon/jsinspector-modern`.

The Gradle, CocoaPods and Buck builds of React Native have been updated to use `jsinspector` everywhere (outside of `ReactCommon/hermes/inspector`, which is itself dead code as of D48897203). The code in `ReactCommon/jsinspector` is thus deprecated and unused in the open source build, and will be deleted in an upcoming diff (likely before the 0.73 cut).

Changelog: [Internal]

Reviewed By: blakef

Differential Revision: D48966244

fbshipit-source-id: db81739da83ef9be73690d95d010065e3b3441c7
2023-09-05 12:47:52 -07:00
Carmen Krol 79b293ea33 Fix announcement issue with Switch (#39298)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39298

Previously, switches were being announced using Talkback in this order: [state][role][label] but they should be announced as [state][label][role].

Reviewed By: NickGerleman

Differential Revision: D48807314

fbshipit-source-id: e827b9ca6d3b61b5bd2884f0f0ce6ddae00bb7df
2023-09-05 10:33:01 -07:00
Arushi Kesarwani a13d463a59 Internal summary in pods (#39266)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39266

Changing the summary in internal pods as per suggestions in D48789176

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D48921731

fbshipit-source-id: cce2a59d5424ac959dd1c78e718d3d060ef94a2e
2023-09-05 09:21:49 -07:00
Nick Gerleman a410ef97f6 Only disable throttling when scrollEventThrottle isn't set (#39293)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39293

This QE is meant to change behavior to not throttle if `scrollEventThrottle` isn't set, but it's actually disabling throttling entirely.

This changes the gating to instead change the initialization path to set `_scrollEventThrottle = 0` when the QE is set.

`_scrollEventThrottle` is already set to zero when the `scrollEventThrottle` prop is removed/set to null, as the default value in ScrollViewProps.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D48968754

fbshipit-source-id: c46c7f5093a60e326267c2e5f2f86dc2d545ac7f
2023-09-05 09:02:19 -07:00
generatedunixname89002005325672 c8d72156bc Daily arc lint --take KTFMT (#39297)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39297

Changelog: [Internal]

Reviewed By: hick209

Differential Revision: D48950527

fbshipit-source-id: be72dd01318de23700570d2b135d550ae1ec5743
2023-09-05 08:52:56 -07:00
Pieter De Baets 242c835c42 Fix backfaceVisibility after transform changes (#39294)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39294

Because we now apply the transform property after all properties have been applied, the [custom logic we have for backfaceVisibility](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/view/ReactViewGroup.java#L1004) no longer applied correctly.

Changelog: [Fixed] backfaceVisibility is correctly applied again after the transform changes.

Reviewed By: fabriziocucci

Differential Revision: D48968421

fbshipit-source-id: f94793f4c14fe0ecf686408ac41d7163c78dbc35
2023-09-05 08:29:33 -07:00
Nick Gerleman d468d9d57f C++ Cleanup 10/N: YGNodeCalculateLayout (#39195)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39195

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

## This diff

This splits out all of the logic under `YGNodeCalculateLayout` to a couple of different files, does some mechanical renaming, and starts to split up the implementation a tiny bit. After this, core layout functions are all C++ convention and namespaced.

Each new file is marked as a move for the sake of blame history. It means Phabricator has a very inaccurate count of lines removed though.

## This stack

The organization of the C++ internals of Yoga are in need of attention.
1. Some of the C++ internals are namespaced, but others not.
2. Some of the namespaces include `detail`, but are meant to be used outside of the translation unit (FB Clang Tidy rules warn on any usage of these)
2. Most of the files are in a flat hierarchy, except for event tracing in its own folder
3. Some files and functions begin with YG, others don’t
4. Some functions are uppercase, others are not
5. Almost all of the interesting logic is in Yoga.cpp, and the file is too large to reason about
6. There are multiple grab bag files where folks put random functions they need in (Utils, BitUtils, Yoga-Internal.h)
7. There is no clear indication from file structure or type naming what is private vs not
8. Handles like `YGNodeRef` and `YGConfigRef` can be used to access internals just by importing headers

This stack does some much needed spring cleaning:
1. All non-public headers and C++ implementation details are in separate folders from the root level `yoga`. This will give us room to split up logic and add more files without too large a flat hierarchy
3. All private C++ internals are under the `facebook::yoga` namespace. Details namespaces are only ever used within the same header, as they are intended
4. Utils files are split
5. Most C++ internals drop the YG prefix
6. Most C++ internal function names are all lower camel case
7. We start to split up Yoga.cpp
8. Every header beginning with YG or at the top-level directory is public and C only, with the exception of Yoga-Internal.h which has non-public functions for bindings
9. It is not possible to use private APIs without static casting handles to internal classes

This will give us more leeway to continue splitting monolithic files, and consistent guidelines for style in new files as well.

These changes should not be breaking to any project using only public Yoga headers. This includes every usage of Yoga in fbsource except for RN Fabric which is currently tied to internals. This refactor should make that boundary clearer.

Reviewed By: rshest

Differential Revision: D48770478

fbshipit-source-id: 2a74b86441c3352de03ae193c98fc3a3573047ed
2023-09-05 05:24:54 -07:00
antliann deb81853f5 Add missing type for TextInput.readOnly in Typescript (#39281)
Summary:
The `readOnly` prop is available in the `TextInput` implementation (see [usage https://github.com/facebook/react-native/issues/1](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/TextInput/TextInput.js#L1646), [usage https://github.com/facebook/react-native/issues/2](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/TextInput/TextInput.js#L1671)), but the corresponding Typescript type is currently missing. Those who use Typescript get an invalid prop error when using the `readOnly` prop on `TextInput`.

Having this prop type included in TypeScript would fix the bug above and also would be beneficial for consistency and comprehensive type support.

Notably, this prop is also included in the Flow types [here](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Components/TextInput/TextInput.flow.js#L814).

## 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
-->

[GENERAL] [FIXED] - Add missing type for TextInput.readOnly in Typescript

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

Test Plan: N/A

Reviewed By: rshest

Differential Revision: D48955477

Pulled By: NickGerleman

fbshipit-source-id: 9d3431351b8ad65a4d2fc57939b98c167dc70cee
2023-09-05 04:57:52 -07:00
Riccardo Cipolleschi 735f4ed62a Fix use_hermes condition in React-Core (#39262)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39262

The use_hermes condition in React core was imprecise as using hermes is the default now. So, if USE_HERMES is not defined, then we are using hermes.

## Changelog:
[iOS][Fixed] - Use the right condition in React-Core for USE_HERMES.

Reviewed By: dmytrorykun

Differential Revision: D48907854

fbshipit-source-id: daeaa1782f23e0ab3992240e70f49ff0b2fd75de
2023-09-05 04:08:02 -07:00
Riccardo Cipolleschi 89dfc082fd Allow to control flipper with an Env var (#39261)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39261

This change allow us to control whether we want to install flipper or not in RNTester using an env var.
This is just a simple quality of life change to speed up local testing.

## Changelog:
[Internal] - Allow to control whether to install Flipper or not from an env variable

Reviewed By: dmytrorykun

Differential Revision: D48907743

fbshipit-source-id: ef0f9362890e2d66be55018622f9b3bf9620bd95
2023-09-05 04:08:02 -07:00
Intl Scheduler 4bc089a93d translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907940863070
Sandcastle Job Instance ID: 13510799920495023
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D48956847

fbshipit-source-id: eb143f2959dbbfb1de83e2162d2b811d0bb7061e
2023-09-04 14:41:01 -07:00
Moti Zilberman 3ec22c1e69 Add option to enable experimental debugger frontend (#39227)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39227

Changelog: [Internal]

1. Adds an `unstable_experiments` option to `createDevMiddleware` in `react-native/dev-middleware`.
2. Adds `enableCustomDebuggerFrontend` (default `false` for now) as an experiment flag controlling whether the new debugger frontend (D48680624, D48682302) is in use. We plan to enable this by default in RN 0.73 after additional testing.

If enabled, the new debugger frontend will only be used for the `/open-debugger` flow

Reviewed By: huntie

Differential Revision: D48602725

fbshipit-source-id: 598865b559478df1f19420daf3633ee6c233362a
2023-09-04 12:21:47 -07:00
Nick Gerleman b7d2d2cd4b C++ Cleanup 9/N: YGAssert (#39201)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39201

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

## This diff

This moves and renames `YGAssert`, and removes it from the public API, since external users should not need to call into internal Yoga assert functions, and the current API prevents us from making this a macro later to include the condition in the message.

## This stack

The organization of the C++ internals of Yoga are in need of attention.
1. Some of the C++ internals are namespaced, but others not.
2. Some of the namespaces include `detail`, but are meant to be used outside of the translation unit (FB Clang Tidy rules warn on any usage of these)
2. Most of the files are in a flat hierarchy, except for event tracing in its own folder
3. Some files and functions begin with YG, others don’t
4. Some functions are uppercase, others are not
5. Almost all of the interesting logic is in Yoga.cpp, and the file is too large to reason about
6. There are multiple grab bag files where folks put random functions they need in (Utils, BitUtils, Yoga-Internal.h)
7. There is no clear indication from file structure or type naming what is private vs not
8. Handles like `YGNodeRef` and `YGConfigRef` can be used to access internals just by importing headers

This stack does some much needed spring cleaning:
1. All non-public headers and C++ implementation details are in separate folders from the root level `yoga`. This will give us room to split up logic and add more files without too large a flat hierarchy
3. All private C++ internals are under the `facebook::yoga` namespace. Details namespaces are only ever used within the same header, as they are intended
4. Utils files are split
5. Most C++ internals drop the YG prefix
6. Most C++ internal function names are all lower camel case
7. We start to split up Yoga.cpp
8. Every header beginning with YG or at the top-level directory is public and C only, with the exception of Yoga-Internal.h which has non-public functions for bindings
9. It is not possible to use private APIs without static casting handles to internal classes

This will give us more leeway to continue splitting monolithic files, and consistent guidelines for style in new files as well.

These changes should not be breaking to any project using only public Yoga headers. This includes every usage of Yoga in fbsource except for RN Fabric which is currently tied to internals. This refactor should make that boundary clearer.

Reviewed By: rshest

Differential Revision: D48769809

fbshipit-source-id: b5480ac54781bc01b00c158b07d2d751fac87d37
2023-09-04 11:20:17 -07:00
Nick Gerleman 51572cea11 C++ Cleanup 8/N: Yoga-internal (#39198)
Summary:
X-link: https://github.com/facebook/yoga/pull/1355

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

## This diff

This splits up `Yoga-internal.h` which has become a grab bag. The actual header is left, with the purpose of being a private C ABI for bindings, but everything else is moved to a place more appropriate or removed.

A few notes:
1. `yoga::isUndefined` is replaced with `std::isnan` to avoid a layer of indirection (we will never be able to change its representation anyway). Internal usages of `YGFloatIsUndefined` are also replaced with `std::isnan` since the previous being at a library boundary means I'm not sure it can be inlined/.
2. `leading`, `trailing` arrays are factored into proper functions
3. `Values` is replaced entirely with `std::array`, since most of it was unused.

## This stack

The organization of the C++ internals of Yoga are in need of attention.
1. Some of the C++ internals are namespaced, but others not.
2. Some of the namespaces include `detail`, but are meant to be used outside of the translation unit (FB Clang Tidy rules warn on any usage of these)
2. Most of the files are in a flat hierarchy, except for event tracing in its own folder
3. Some files and functions begin with YG, others don’t
4. Some functions are uppercase, others are not
5. Almost all of the interesting logic is in Yoga.cpp, and the file is too large to reason about
6. There are multiple grab bag files where folks put random functions they need in (Utils, BitUtils, Yoga-Internal.h)
7. There is no clear indication from file structure or type naming what is private vs not
8. Handles like `YGNodeRef` and `YGConfigRef` can be used to access internals just by importing headers

This stack does some much needed spring cleaning:
1. All non-public headers and C++ implementation details are in separate folders from the root level `yoga`. This will give us room to split up logic and add more files without too large a flat hierarchy
3. All private C++ internals are under the `facebook::yoga` namespace. Details namespaces are only ever used within the same header, as they are intended
4. Utils files are split
5. Most C++ internals drop the YG prefix
6. Most C++ internal function names are all lower camel case
7. We start to split up Yoga.cpp
8. Every header beginning with YG or at the top-level directory is public and C only, with the exception of Yoga-Internal.h which has non-public functions for bindings
9. It is not possible to use private APIs without static casting handles to internal classes

This will give us more leeway to continue splitting monolithic files, and consistent guidelines for style in new files as well.

These changes should not be breaking to any project using only public Yoga headers. This includes every usage of Yoga in fbsource except for RN Fabric which is currently tied to internals. This refactor should make that boundary clearer.

Reviewed By: rshest

Differential Revision: D48769241

fbshipit-source-id: 5b8e2192309539e7c133c3b3b29b445b59dd5835
2023-09-04 11:20:17 -07:00
Nick Gerleman d2e91599c8 PointerAlignment: Left
Summary:
This changes Clang format config to enforce left pointer alignment instead of right, in accordance with https://www.internalfb.com/intern/wiki/Cpp/CppStyle/

Changelog: [Internal]

bypass-github-export-checks

Reviewed By: sammy-SC

Differential Revision: D48952040

fbshipit-source-id: 108329b2f11d2041a31dee3334c7801d69a3f1ad
2023-09-04 10:55:18 -07:00
Alex Hunt 321f7dbcad Add 'j' to debug key handler (#39256)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39256

## Context

RFC: Decoupling Flipper from React Native core: https://github.com/react-native-community/discussions-and-proposals/pull/641

## Changes

- Adds `j` key handler to open JS debugger (mirroring Expo CLI).
- Updates `isDevServerRunning` to consider server scheme and host.
- Reorders key prompts.

Changelog:
[General][Changed] Add 'j' to debug key trigger from CLI

Reviewed By: motiz88

Differential Revision: D48873335

fbshipit-source-id: e3f208522c19857c565fa73f8b81d646a7e4ff31
2023-09-04 06:36:42 -07:00
Alex Hunt f688a2d4be Update /open-debugger to try first target when unspecified (#39255)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39255

Changelog: [Internal]

Reviewed By: motiz88

Differential Revision: D48873336

fbshipit-source-id: 8d3aac383de1cefa303a89fbfee9a23ce906a979
2023-09-04 06:36:42 -07:00
Ales Pergl 054ab62be0 Fix building Android on Windows (#39190)
Summary:
Currently Android fails to build on Windows, because CMake cannot work with
native Windows paths that are passed to it as build arguments. This change
converts the input paths to the CMake format.

## Changelog:

[Android] [Fixed] - Fix building Android on Windows.

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

Test Plan: Build the React Native Android project on Windows. It should complete successfully.

Reviewed By: NickGerleman

Differential Revision: D48948140

Pulled By: cortinico

fbshipit-source-id: 6d584c2a10e683cdb6df0dd6dcd5875da7e06e2b
2023-09-04 05:28:46 -07:00
Oskar Kwaśniewski 7f26b088b2 Convert ColorUtilTest to Kotlin (#38979)
Summary:
Converts ColorUtilTest to kotlin as requested in https://github.com/facebook/react-native/issues/38825

## Changelog:

[INTERNAL] [CHANGED] - Convert ColorUtilTest to Kotlin

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

Test Plan:
1. Run `./gradlew :packages:react-native:ReactAndroid:test`.
2. All tests should pass.

Reviewed By: fkgozali, cortinico, arushikesarwani94

Differential Revision: D48802302

Pulled By: mdvacca

fbshipit-source-id: 876caf288bd5df1e1fdc4b0b20b41afdfacf364f
2023-09-04 04:29:05 -07:00
Broda Noel 83885f1d69 Update Image.d.ts (#39230)
Summary:
I've seen that this throws a warning:
```
<ImageBackground source={{ uri: undefined }}>
```

But this is properly working, without a warning, thus, I believe the code is allowing it:
```
<ImageBackground source={isLoading ? undefined : { uri: 'https://....' }}>
```

## Changelog:

[GENERAL] [CHANGED] - Fixed `source` in `Image` type

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

Test Plan: Not necessary. It's just a DOC change

Reviewed By: rshest

Differential Revision: D48939824

Pulled By: NickGerleman

fbshipit-source-id: fca2e07b7b4d4b947e365bb9d82fcf4cea484951
2023-09-04 03:05:40 -07:00
Moti Zilberman 4dea63530f Fork ReactCommon/hermes/inspector as inspector-modern (#39253)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39253

X-link: https://github.com/facebook/hermes/pull/1112

Changelog: [Internal]

Forks `ReactCommon/hermes/inspector` → `ReactCommon/hermes/inspector-modern`. More changes to `inspector-modern` will come in subsequent diffs.

The Gradle, CocoaPods and Buck builds of React Native have been updated to use `inspector-modern` everywhere. The code in `ReactCommon/hermes/inspector` is thus **deprecated** and unused in the open source build, and will be deleted in an upcoming diff (likely before the 0.73 cut).

NOTE: The reason we're not immediately deleting `ReactCommon/hermes/inspector` is that there are a handful of references to it in Meta's internal monorepo (*outside of React Native*) that we are in the process of migrating away. Once we've deleted the existing `ReactCommon/hermes/inspector`, we *may* rename `inspector-modern` back to `inspector`.

Reviewed By: blakef

Differential Revision: D48897203

fbshipit-source-id: 13682747d280a3231b7f6bce560f25ad174304e9
2023-09-04 02:48:02 -07:00
Intl Scheduler 152afe9244 translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907940832858
Sandcastle Job Instance ID: 13510799920053222
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D48941197

fbshipit-source-id: 41d203e41df61c743f2372fe84c3eb9756bb04ba
2023-09-03 19:16:09 -07:00
Yedidya Feldblum 041f459d8c forward-compatible use of u8"..." strings (#39264)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39264

X-link: https://github.com/facebook/hermes/pull/1113

Since C++20, the type of a `u8"..."` string literal is `const char8_t[N]` whereas prior to C++20 the type is `const char[N]`. `char8_t` has the same size, alignment, and signedness as `unsigned char` but is a different type from `unsigned char`, as well as being a different type from `signed char` and from `char`.

In context, the uses of the `u8"..."` expect `const char*` (to which `const char[N]` decays) and not `const char8_t*` (to which `const char8_t[N]` decays). To fit the string to the context since C++20, we must `reinterpret_cast` to `const char*`; this is a type-level no-op prior to C++20.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D48908076

fbshipit-source-id: e68d8fc4ff9dfb9528846901e37e2775c2b98866
2023-09-02 16:23:34 -07:00
Intl Scheduler 7a0d2a06fb translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907940766435
Sandcastle Job Instance ID: 22517999172097970
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D48929200

fbshipit-source-id: 0a19658d278a4832a5defaba85c3f7c4f589167a
2023-09-02 01:01:49 -07:00
Peter Xu b0a9053e67 Update typings for StyleSheet.create to catch typos in style keys (#39225)
Summary:
Previously, when you tried to create some styles using `StyleSheet.create`, you can create styles with invalid styles:

```ts
const styles = StyleSheet.create({
  container: {
    marginLeft: 1,
    magrinRight: 1, // This is a typo, but would not cause typecheck errors
  },
});
```

The root cause is that Typescript uses a looser [Excess Property Checks](https://www.typescriptlang.org/docs/handbook/2/objects.html#excess-property-checks) if we're using template types rather than using the actual specific types in the function signature.

- https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/62481

## Changelog:

[INTERNAL] [FIXED] - Make StyleSheet.create better check property keys for typos

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

Test Plan: Added a test in __typeTests__, which should get run by CI.

Reviewed By: rshest

Differential Revision: D48859679

Pulled By: NickGerleman

fbshipit-source-id: 43aa69cf85cd69353d053b782dba73ab2027eb64
2023-09-01 21:40:37 -07:00
Jacob Parker 5f40f0800e Implement transform-origin for old arch iOS (#38626)
Summary:
Adds transform-origin for old arch iOS

See also intergalacticspacehighway's work for iOS Fabric and Android:-

- https://github.com/facebook/react-native/pull/38559
- https://github.com/facebook/react-native/pull/38558

## Changelog:

[IOS] [ADDED] - Added support for transform-origin on old arch

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

Test Plan: See RN tester

Reviewed By: NickGerleman

Differential Revision: D48528353

Pulled By: javache

fbshipit-source-id: 09592411e26484d81a999a7e601eff751ca7ae0b
2023-09-01 13:03:50 -07:00
Nishan 9e68599daf feat: android transform origin (#38558)
Summary:
This PR adds transform-origin support for android to make it easier to review. https://github.com/facebook/react-native/pull/37606#pullrequestreview-1513082850 by javache. I'll answer feedback from javache below.

## Changelog:
[Android] [ADDED] - Transform origin
<!-- 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/38558

Test Plan: Run iOS RNTester app in old architecture and test transform-origin example in `TransformExample.js`.

Reviewed By: NickGerleman

Differential Revision: D48528339

Pulled By: javache

fbshipit-source-id: e255a7f364e57396dada60b2c69c724cec406f51
2023-09-01 13:03:50 -07:00
Nishan 177ef21ea2 feat: ios fabric transform origin (#38559)
Summary:
This PR adds transform-origin support for iOS fabric. This PR also incorporates feedback/changes suggested by javache in the original [PR.](https://github.com/facebook/react-native/pull/37606)

## Changelog:
[IOS] [ADDED] - Fabric Transform origin
<!-- 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/38559

Test Plan: Run iOS RNTester app in old architecture and test transform-origin example in `TransformExample.js`.

Reviewed By: NickGerleman

Differential Revision: D48528363

Pulled By: javache

fbshipit-source-id: 347b7c5896ad19ad24278de81b0e055e4cb01016
2023-09-01 13:03:50 -07:00
Pieter De Baets a69bc7f1fd Simplify shadow node fragment placeholders (#39239)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39239

We can avoid static guards and heap allocation memory by forcing a default initialized shared_ptr (which is constexpr), and telling the compiler to not bother with registering a destructor, as these shared_ptr will never hold a value.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D48867013

fbshipit-source-id: c31f535bb19382878c9f21d7145188bd91b63265
2023-09-01 09:53:57 -07:00
Arushi Kesarwani 2b98cda74e Bridgeless -> Runtime in iOS (#39248)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39248

`Bridgeless` -> `Runtime` in .podspec

changelog: [internal] internal

Reviewed By: fkgozali, cipolleschi

Differential Revision: D48789176

fbshipit-source-id: bc656097e0274c7381e66117d91e7300d5c6f6c4
2023-09-01 09:45:48 -07:00