Commit Graph

12270 Commits

Author SHA1 Message Date
zhongwuzw 0e150d071e 【iOS】Fix Alert userInterfaceStyle having no effect (#39346)
Summary:
Fixes https://github.com/facebook/react-native/issues/38852

## Changelog:

[IOS] [FIXED] - Fix Alert userInterfaceStyle having no effect

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

Test Plan: Run the demo from https://github.com/facebook/react-native/issues/38852 .

Reviewed By: cipolleschi

Differential Revision: D49100720

Pulled By: dmytrorykun

fbshipit-source-id: cf8213dafc840720e9d74626e147804ea129cdf4
2023-09-11 04:50:11 -07:00
Moti Zilberman bf955a0352 Enable custom debugger frontend experiment for /open-debugger (#39317)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39317

Changelog: [Internal]

Sets `unstable_experiments.enableCustomDebuggerFrontend: true` in `dev-middleware` (see D48602725) when mounted by the RN CLI.

Reviewed By: blakef

Differential Revision: D49019399

fbshipit-source-id: 239ae26b562423a27593ce06d44f07ad2ed3be50
2023-09-10 05:20:02 -07:00
troZee e00f2445d2 fix: network call timeout (#38953)
Summary:
This PR is a continuation of this https://github.com/facebook/react-native/pull/29471. All context you can find here:

https://github.com/axios/axios/issues/2073#issuecomment-1050917487
https://github.com/axios/axios/issues/2073#issuecomment-1674817612

## Changelog:

[ANDROID] [FIXED] - change `connectTimeout` to `callTimeout` in OKHttp client

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

Test Plan:
- Throttle internet connection (You can use GSM one)

```
import axios from "axios";

axios.get('https://jsonplaceholder.typicode.com/users', {
  timeout: 5000
})
.then(response => {
  console.log(response.data);
})
.catch(error => {
  if (error.code === 'ECONNABORTED') {
    console.log('Request timed out');
  } else {
    console.log(error.message);
  }
});
```

**Expected result**

`Request timed out` should be visible in a console

**Videos**

Before

https://github.com/facebook/react-native/assets/12766071/03a3d666-6a27-4d67-bc68-6bcf6e908e19

After

https://github.com/facebook/react-native/assets/12766071/2650d02d-640c-43fe-b1e8-baeac78870f2

**Example URL**

Branch:
https://github.com/troZee/react-native/tree/fix/network-timeout-example

Commit:
https://github.com/troZee/react-native/commit/e255e1a423143c4bd4f3e37656a56ba2ecbbf3e2

Reviewed By: mdvacca

Differential Revision: D48414884

Pulled By: NickGerleman

fbshipit-source-id: 86324601f7459c154b5fc879f8b773df4901f6e0
2023-09-10 00:45:49 -07:00
Samuel Susla 17ecae9ce7 Make RuntimeScheduler tests less flaky (#39353)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39353

changelog: [internal]

Increase the wait threshold when waiting for a task in a stub queue to reduce test flakyness.

Reviewed By: makovkastar

Differential Revision: D49093046

fbshipit-source-id: 30d150f421c226587ae9e41786d2d0f95c82dfef
2023-09-09 05:43:50 -07:00
Phillip Pan 9841bd8185 decode urls before reencoding with NSURL (#39344)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39344

## Changelog:
[iOS][General] - URLs parsed by RCTConvert should be encoded respecting RFC 3986, 1738/1808

in ios 17, NSURLs are encoded respecting RFC 3986 (https://www.ietf.org/rfc/rfc3986.txt) as opposed to RFC 1738/1808 before.

following this, `NSURL`'s parsing algorithm has changed such that if they encounter a reserved character, such as `[`, the parser will percent encode all possible characters in the url, including `%`.

this causes trouble for urls that already have some encoding. for the string `%22[]`, the new parsing algorithm will return the following:

RFC 1738/1808 -> `%22%5B%5D`
RFC 3986 -> `%2522%5B%5D` (invalid encoding)

the solution here is to decode all the percentified encodings in the input string, completely stripping it of the percent encodings, and then re-encoding it. thus, the string will transform as follows:

`%22[]` -> `"[]` -> `%22%5B%5D`

we probably don't need the OS check, but including it just to be safe.

Reviewed By: yungsters

Differential Revision: D49082077

fbshipit-source-id: 21ac1e37c957db3217746f9385f9d7947261794d
2023-09-08 14:12:37 -07:00
Nick Gerleman 8658bdccbc yoga::bit_cast (#39358)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39358

This adds a function polyfilling C++ 20's `std::bit_cast`, using `memcpy()` to be safe with strict aliasing rules.

This replaces the conditional code in CompactValue for type punning, an unsafe place in YGJNI where we do it unsafely, and is used in ValuePool. The polyfill can be switched to `std::bit_cast` whenever we adopt C++ 20.

Note that this doesn't actually call into `memcpy()`, as verified by Godbolt. Compilers are aware of the memcpy type punning pattern and optimize it, but it's ugly and confusing to folks who haven't seen it before.

Reviewed By: javache

Differential Revision: D49082997

fbshipit-source-id: b848775a68286bdb11b2a3a95bef8069364ac9b5
2023-09-08 13:03:48 -07:00
Xin Chen 9dd654f7ce Add affected layoutable nodes counter in telemetry (#39205)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39205

This diff adds affected layoutable nodes count from Yoga in the telemetry for commit revision. This is used for performance monitoring next to the timestamp information we already have.

Changelog:
[Internal] - Add affected layoutable nodes count information in Fabric commit telemetry.

Reviewed By: rshest

Differential Revision: D48671209

fbshipit-source-id: b054e5dcd465122f01500fb54cba6f6d250cd256
2023-09-08 12:50:15 -07:00
Danny Su b9e14024a6 Remove unused Hermes CDP tests (#39330)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39330

These tests have been moved to the Hermes repo and shouldn't be used in the React Native repo anymore.

Changelog: [General][Changed] Removed unused Hermes inspector-modern test files

Reviewed By: mattbfb

Differential Revision: D49066703

fbshipit-source-id: a1976f0830e2b54b894417db55c21d1b3f312bfa
2023-09-08 09:41:50 -07:00
Rubén Norte 016e4af11d Consider transforms correctly in some of the new DOM layout methods (#39349)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39349

This fixes these methods to ignore transforms, as per the spec:
* `offsetLeft`
* `offsetTop`
* `offsetWidth`
* `offsetHeight`
* `clientLeft`
* `clientTop`
* `clientWidth`
* `clientHeight`

`scrollWidth` and `scrollHeight` are the last methods we need to fix, as their fix is more complex than in these cases (in scroll views, the scrollable area is the overflow of all its children with transforms applied, which is an expensive computation we don't currently do, even in host platforms where this behavior doesn't work correctly).

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D49069517

fbshipit-source-id: 3c4b897c904e33514cbeefa8ee317d3c2e4a1280
2023-09-08 05:34:34 -07:00
Rubén Norte 836511e6ba Remove unimplemented getClientRects method from ReadOnlyElement (#39348)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39348

We removed this method from the proposal, so we don't need to keep the method around unimplemented.

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D49069518

fbshipit-source-id: 5b391954b125a082d7489d166b1c1cd6444cfa1b
2023-09-08 05:34:34 -07:00
Rubén Norte f275603a2a Implement scrollWidth/scrollHeight (#39328)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39328

This adds a new method in Fabric to get the scroll size for an element, and uses it to implement `scrollWidth` and `scrollHeight` as defined in https://github.com/react-native-community/discussions-and-proposals/pull/607

Scroll size determine how much of the content of a node would move if the node was scrollable. If the content does not overflow the padding box of the node, then this is the same as the `client{Width,Height}` (the size of the node without its borders). If the content would overflow the node, then it would be the size of the content that would be scrollable (in other words, what would "move" when you scrolled).

If the element isn't displayed or it has display: inline, it return 0 in both cases.

These APIs provide rounded integers.

NOTE: The current implementation of `ScrollView` has several known bugs and inconsistencies across platforms (Android vs. iOS) and architectures (Paper vs. Fabric) (e.g.: content showing on top of the border on Android, `overflow: visible` only working on Android but not on iOS, etc.). The data that this API reports is the one that aligns with the Web (with a few limitations), and we'll need to fix the implementation to align with this.

NOTE: transforms are not considered correctly for the sake of this API, but also not applied correctly in any of the native platforms. On Web, the scrollable area is the overflow of all the children **with transforms applied** which isn't honored in RN. We''ll fix the data reported by this API when we also fix the user perceived behavior.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D49058368

fbshipit-source-id: 39a10bf7bddec9afc54f46cc02284d601b6962f3
2023-09-08 05:34:34 -07:00
Rubén Norte f2473a1afa Avoid computing contentFrame when not using overflow: visible (#39325)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39325

This diff extracts the logic to compute the content bounds of a shadow node (to compute its overflow insets) to a separate method. The new method is renamed as `getContentBounds` because layout metrics already have a method called `getContentFrame` that has a different meaning (the content box of the node, which excludes border and padding).

As a nice side-effect, we can now avoid executing this logic altogether if the node doesn't have overflow: visible (because we weren't assigning the result anywhere anyway).

NOTE: This method is made public because we need it to compute `scrollWidth` and `scrollHeight` in a following diff.

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D49020219

fbshipit-source-id: 7a65abf8523cb1dbcf0f92565fbfc228083a7d21
2023-09-08 05:34:34 -07:00
Xin Chen a63b443e62 Fix FpsDebugFrameCallback so that we properly cancel frame loop to avoid race (#38671)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38671

Fix a race condition when we unmount and mount a view using FpsView too frequently. In this case, the frame loop callback didn't get a chance to unset the  `mShouldStop` flag, causing the old frame loop continues to run unexpectedly.

The fix here guarantees `stop` would queue logic that removes the frame loop callback, and a later `start` would queue logic that attaches a new frame loop callback. Since both of them happens on UI thread, they are in sync.

Changelog:
[Android][Fixed] - Fix a race with FpsView on using FpsDebugFrameCallback.

Reviewed By: hoxyq

Differential Revision: D47849848

fbshipit-source-id: 8c4be40e86be128734bfa3f571fd3a1735976c7c
2023-09-07 20:23:59 -07:00
Rubén Norte eb5e7b20b5 Implement clientTop/clientLeft in ReadOnlyElement (#39308)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39308

This adds a new method in Fabric to get the border size for an element, and uses it to implement the following methods as defined in https://github.com/react-native-community/discussions-and-proposals/pull/607 :
* `clientLeft`: left border width of the element.
* `clientTop`: top border width of the element.
If the element isn't displayed or it has display: inline, it return 0 in both cases.

These APIs provide rounded integers.

Changelog: [internal]

Reviewed By: mdvacca

Differential Revision: D49009140

fbshipit-source-id: e667059702ca22e2b8e8721209e9c5c2553aa7ac
2023-09-07 12:01:46 -07:00
Rubén Norte f1e9a308d5 Implement clientWidth/clientHeight in ReadOnlyElement (#39305)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39305

This adds a new method in Fabric to get the inner size for an element (whole size excluding borders, which would be the scrollable size of the element), and uses it to implement the following methods as defined in https://github.com/react-native-community/discussions-and-proposals/pull/607 :
`clientWidth`: width of the element excluding the size of the left and right border.
`clientHeight`: height of the element excluding the size of the top and bottom border.

If the element isn't displayed or it has display: inline, it return `0` in both cases.

These APIs provided rounded integers.

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D49008698

fbshipit-source-id: 7c25b8c5ddbba7877ea398398f7a0b755e25d746
2023-09-07 12:01:46 -07:00
Rubén Norte 447d80ee51 Implement tagName property in ReadOnlyElement (#39278)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39278

Implements tagName as the name of the component prefixed with `RN:`.

Changelog: [internal]

Reviewed By: NickGerleman

Differential Revision: D48951824

fbshipit-source-id: 4a8387adff8ed504423d7ead7b95943bfd77ae8c
2023-09-07 12:01:46 -07:00
Pieter De Baets cbf3b7d27c Fix refs in Pressable leading to tree clone (#39324)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39324

`useImperativeHandle` without a dependencies array causes React to re-clone the tree, leading to undesirable layout effects.

Changelog: [Internal]

Reviewed By: fabriziocucci

Differential Revision: D49056493

fbshipit-source-id: 3b11cf67ab5c31abc8f920aafcf16e52a3bad3a4
2023-09-07 11:03:49 -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
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