Commit Graph

12270 Commits

Author SHA1 Message Date
Nick Gerleman 75a5ec05bd Descriptive CocoaPods error if CMake is not installed (#37839)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37839

The CocoaPods build assumes that a `cmake` command is present during `pod install`. It acts gracefully if it is not and propagates an empty string path, leading to a confusing error during the build, and requiring a `pod deintegrate` after CMake is installed because of when the binary is set.

This replaces the usage with `Pod::Executable::which!`, the built-in CocoaPods method of finding an executable from `PATH` which errors out the build if not found. This will cause a failure during `pod install`, when we are looking for the command, and specify that `cmake` is the missing executable.

This branch is only taken for source builds, so this will not show up in the cases where we do not need CocoaPods.

Changelog:
[iOS][Fixed] - Descriptive Cocoapods Error if CMake is not installed

Reviewed By: cipolleschi

Differential Revision: D46670007

fbshipit-source-id: d508743d51f9b99e1bce7d4d3cef6395d5abf46d
2023-06-13 14:38:13 -07:00
Phillip Pan a4dae044df test RCTInstance initialization (#37860)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37860

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D46547013

fbshipit-source-id: 2b1593799ce2b5d29e7ea6df4373ff6c92b51065
2023-06-13 14:24:12 -07:00
Phillip Pan be2b0e2d8a lift out ShimRCTInstance to RCTTestUtils (#37859)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37859

Changelog: [Internal]

as title

Reviewed By: cipolleschi

Differential Revision: D46547014

fbshipit-source-id: ca89d659d24fa0fcef1c39fc47fc758cee34f7d8
2023-06-13 14:24:12 -07:00
Phillip Pan 03c978d2cc add unit test for start method on RCTHost (#37858)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37858

Changelog: [Internal]

in this diff, i add a test that runs `start` validates that the lifecycle `hostDidStart:` is called as a result.

notably, i created a custom shim for `RCTInstance` to completely stub out its behavior.

Reviewed By: cipolleschi

Differential Revision: D46508066

fbshipit-source-id: e815aee64d06b160f2cbdc52720a8e698d11c680
2023-06-13 14:24:12 -07:00
Ruslan Shestopalyuk 922681f15b Add getTestId into views/common (#37851)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37851

## Changelog
[Internal] -

The `testId` value in practice can be used for other things than e2e tests - e.g. there is already a use case for Accessibility, but also we may want to log it as an extra data point with e.g. performance metrics.

This exposes a helper function to extract a `testId` from a view.

Differential Revision: D46684365

fbshipit-source-id: 17602307c468a906ef4d0679e826dbcd1eb651b7
2023-06-13 11:54:54 -07:00
Nick Gerleman 09d357c0df Fix undefined symbols _FBcoreLocalexxHash48 and _RCTLocalizedStringFromKey in OSS (#37838)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37838

We see a linker failure in the OSS build because our header exports C-style functions (not ObjC), that Objective C will assume are C ABI, but we build them as C++ functions.

Internally these are all marked as `extern "C"`, so to not deviate I did the same here to expose these always as plain C functions.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D46671506

fbshipit-source-id: 5b3005074303763d55801c4d24ac9250b96d45ba
2023-06-13 08:06:24 -07:00
Gabriel Donadel b5f52216b0 Add getObjectProperties function to Parser (#37789)
Summary:
[Codegen 128] This PR add a `getObjectProperties` function to the Parser interface, which returns the properties of an object represented by a type annotation as requested on https://github.com/facebook/react-native/issues/34872

## Changelog:

[INTERNAL] [ADDED] - Add getObjectProperties function to codegen Parser

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

Test Plan: Run `yarn jest react-native-codegen` and ensure CI is green

Reviewed By: cipolleschi

Differential Revision: D46584748

Pulled By: rshest

fbshipit-source-id: 7f509b6f8754472a9b3048214345dc94265604ba
2023-06-13 07:45:47 -07:00
Gabriel Donadel 9c9945a5bf Revert "fix: border width top/bottom not matching the border radius" (#37840)
Summary:
In an effort to fix https://github.com/facebook/react-native/issues/37753, this PR reverts the changes introduced by https://github.com/facebook/react-native/commit/cd6a91343ee24af83c7437b3f2449b41e97760e9 and https://github.com/facebook/react-native/commit/1d5103227851ab92de889d5e7e910393b5d8743a so border-radius width calculations work as expected

## Changelog:

[ANDROID] [FIXED] - Fix border-radius width calculations

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

Test Plan:
Test border colors along with border-radius through RNTester
<img width="538" alt="image" src="https://github.com/facebook/react-native/assets/11707729/4b148d4b-35dc-4737-be00-c5ff156b0865">

Reviewed By: dmytrorykun

Differential Revision: D46684071

Pulled By: cipolleschi

fbshipit-source-id: cf7a80d0d63009b457f03d690b632e332a9b4a02
2023-06-13 07:29:02 -07:00
Pieter De Baets 3006a33baf Remove unused CookieHandler from ForwardingCookieHandler (#37775)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37775

Most of this code was made irrelevant when we dropped support for API < 21 in D24548084.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D46557892

fbshipit-source-id: 6af85a24d476fe1010eb62126b4c5e9df14a0ea2
2023-06-13 05:30:20 -07:00
TatianaKapos efc5f73f27 Specify float value in ParagraphLayoutManager (#37660)
Summary:
React-Native-Windows had to override this file because we treat certain warning as errors. This fix adds in the "f suffix" to remove the unspecified float error.

## Changelog:
[GENERAL] [FIXED] - Specify float value in ParagraphLayoutManager

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

Test Plan: Tested with RNW tests

Reviewed By: NickGerleman

Differential Revision: D46560099

Pulled By: javache

fbshipit-source-id: de593cbe60677533f5194ab8fd7e650607b5829e
2023-06-13 05:30:16 -07:00
David Vacca 3f7507bae9 Move BridgelessReactPackage to com.facebook.react package (#37697)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37697

Move BridgelessReactPackage to com.facebook.react package.
This is necessary because BridgelessReactPackage is a core package that needs to be part of RN (and should not be re-defined by all apps)

I will revisit naming in a later diff

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: cortinico, philIip

Differential Revision: D46408934

fbshipit-source-id: ac172d22a6d70c9d33d2e119da93b25736d85383
2023-06-12 20:19:06 -07:00
David Vacca 8351b08088 Fix lint warnings (#37699)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37699

Fix lint warnings

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: cortinico, philIip

Differential Revision: D46407027

fbshipit-source-id: 80acd2a811f712be6a4b228ec3450dcbdf0d3ce3
2023-06-12 20:19:06 -07:00
David Vacca f821797e51 Reduce visibility of NativeModule methods in ReactHost (#37692)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37692

In this diff I'm reducing visibility of NativeModule methods in ReactHost (from public to package)

bypass-github-export-checks

changelog: [internal] ineternal

Reviewed By: cortinico, philIip, RSNara

Differential Revision: D46296987

fbshipit-source-id: d50ff9f855c71ee9565f0bc81ffe8be2fd0e2368
2023-06-12 20:19:06 -07:00
David Vacca 579d11ca9e Rename ReactHost.preload -> ReactHost.start (#37694)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37694

Rename ReactHost.preload -> ReactHost.start to adhere to stable api

bypass-github-export-checks

changelog: [internal] internal

Reviewed By: RSNara

Differential Revision: D46294685

fbshipit-source-id: 683683a557c28759db8925e0c0dd6629463511eb
2023-06-12 20:19:06 -07:00
Vincent Riemer 001e182f08 Add PointerEventCaptureMouse WPT test (#37603)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37603

Changelog: [Internal] - Add PointerEventCaptureMouse WPT test

This diff introduces a port of the wpt test "pointerevent_capture_mouse" (https://github.com/web-platform-tests/wpt/blob/master/pointerevents/pointerevent_capture_mouse.html) in preparation of validating our pointer capture implementation.

Reviewed By: adanoff

Differential Revision: D46230497

fbshipit-source-id: ebdfaad23935b96d35da98e30bd326ae1b50759a
2023-06-12 19:27:14 -07:00
Vincent Riemer 1ae1cc01ab Add plumbing/boilerplate for an iOS implementation of the gotpointercapture and lostpointercapture events (#37602)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37602

Changelog: [Internal] - Add plumbing/boilerplate for an iOS implementation of the `gotpointercapture` and `lostpointercapture` events

This diff simply adds the boilerplate necessary to hook up the `gotpointercapture` and `lostpointercapture` events to the fabric iOS touch handler. This diff does not contain any actual implementation of their behavior as that will occur in future diffs.

Reviewed By: yungsters

Differential Revision: D44977499

fbshipit-source-id: c9da5691d399f612f1980c7692c4ca62877901a9
2023-06-12 19:27:14 -07:00
Bernhard Owen Josephus 83d7a48a46 Resubmit D46501420 (#37790)
Summary:
Multiline text in Android shows some extra space. It's easily noticeable when you set the text `alignSelf` to `flex-start`. This is because we are using `layout.getLineWidth` which will include trailing whitespace.
<img width="300" alt="image" src="https://github.com/facebook/react-native/assets/50919443/8939092b-caef-4ad8-9b34-2ccef5d20968">

Based on Android doc, `getLineMax` exclude trailing whitespace.
<img width="625" alt="image" src="https://github.com/facebook/react-native/assets/50919443/0b32e842-5fab-4fc7-8fd9-299877b9c553">

## Changelog:

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

Pick one each for the category and type tags:

[ANDROID] [FIXED] - Exclude trailing whitespace from newline character on measuring text line width

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

[ANDROID] [FIXED] - Exclude trailing whitespace from newline character on measuring text line width

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

Test Plan:
After applying the changes:
<img width="300" alt="image" src="https://github.com/facebook/react-native/assets/50919443/bfbf52b0-7e7d-4c89-8958-6af38d8bc1c7">

Code snippet:
```
<Text style={{backgroundColor: 'red', alignSelf: 'flex-start', color: 'white'}}>
    1{'\n'}
</Text>
```

Reviewed By: cortinico

Differential Revision: D46586516

Pulled By: NickGerleman

fbshipit-source-id: 3ea9c150ad92082f9b4d1da453ba0ef04b09ce51
2023-06-12 15:28:56 -07:00
Nick Gerleman 1f45459414 Localize Voiceover strings in Fabric (#37679)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37679

This reuses the localizations from the last diff on the stack, on top of the new logic added with D45797554.

Changelog:
[iOS][Fixed] - Localize Voiceover strings in Fabric

Reviewed By: philIip

Differential Revision: D46426571

fbshipit-source-id: 7e6adc9eff5e6387299e95b6ea5eba8e2607386a
2023-06-12 15:22:05 -07:00
Nick Gerleman 0e99b19257 RCTLocalizedString: Replace usages of AccessibilityResources (#37680)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37680

Changelog:
[iOS][Fixed] - Localize Voiceover strings in Paper

## Stack

React Native on iOS adds strings to Voiceover interactions to supply more information to users . Internally, and out-of-the-box externally, these are today always announced in English instead of being localized.

This stack adds a limited new internal API, `RCTLocalizedString(string, description)` to allow auto-translated strings which are consumed by both Meta and OSS.

Reviewed By: cipolleschi

Differential Revision: D46415273

fbshipit-source-id: 4174e38cef4eee251fa2d59e10763cde8e8681ad
2023-06-12 15:22:05 -07:00
Nick Gerleman f83ca12c40 RCTLocalizedString: Extract FBTs to bundle for CocoaPods (#37678)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37678

## Stack

React Native on iOS adds strings to Voiceover interactions to supply more information to users . Internally, and out-of-the-box externally, these are today always announced in English instead of being localized.

This stack adds a limited new internal API, `RCTLocalizedString(string, description)` to allow auto-translated strings which are consumed by both Meta and OSS.

Reviewed By: cipolleschi

Differential Revision: D46414630

fbshipit-source-id: 1137182dbbd89d959b3d143ce534229968bdb8f7
2023-06-12 15:22:05 -07:00
Nick Gerleman 9b47148dd8 RCTLocalizedString: Add RCTLocalizedString (#37677)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37677

## Stack

React Native on iOS adds strings to Voiceover interactions to supply more information to users . Internally, and out-of-the-box externally, these are today always announced in English instead of being localized.

This stack adds a limited new internal API, `RCTLocalizedString(string, description)` to allow auto-translated strings which are consumed by both Meta and OSS.

Reviewed By: shwanton

Differential Revision: D46414631

fbshipit-source-id: 567a3500d39c1cb830e050edb1a644e3d8d502d3
2023-06-12 15:22:05 -07:00
Nick Gerleman 15bdaefe7b RCTLocalizedString: Dirsync FBXXHashUtils to OSS (#37676)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37676

## Stack

React Native on iOS adds strings to Voiceover interactions to supply more information to users . Internally, and out-of-the-box externally, these are today always announced in English instead of being localized.

This stack adds a limited new internal API, `RCTLocalizedString(string, description)` to allow auto-translated strings which are consumed by both Meta and OSS.

Reviewed By: javache

Differential Revision: D46399962

fbshipit-source-id: 2188a1faba9339cff00f897990b727febc178361
2023-06-12 15:22:05 -07:00
Phillip Pan a300a35f28 introduce RCTTestUtils (#37810)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37810

Changelog: [Internal]

in this change, i introduce a helper file for swizzling selectors that can be used for building custom shims and fakes. i tried putting this in the cxx target, but i struggled a lot with managing the dependencies and understanding the extra behavior that was happening from being in a `rn_xplat_cxx_library`. this file is also not obj-c++, so i feel like we should decouple if possible.

it does seem like this is a new practice i'm introducing, so let me know if there's something that i'm missing.

Reviewed By: cipolleschi

Differential Revision: D46507803

fbshipit-source-id: 9be63d992b9838e9a98ee0c1c6d684fc59c3fc80
2023-06-12 13:37:39 -07:00
Phillip Pan ee38c4a40c introduce build boilerplate for ios unit tests (#37811)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37811

Changelog: [Internal]

i am looking to add ios unit tests to venice and this is the first unit test suite that will test native ios code in the new architecture afaik, so i wanted to open this up to discussion.

currently, all `XCTest` in `react-native-github` are coupled with the `RNTester` target. my main qualm with this is i am concerned that it won't scale well. currently we have only ~30ish tests but ultimately if we want a proper testing suite, surely this count will be in the hundreds and that won't be able to reasonably live in a single test target.

however, the trade is that this test will not show up in RNTester. i have added a unit test to RNTester before in D31949237, however the experience was extremely painful as i had to manually update the `project.pbxproj` to include my file, and i had to manually determine what hex value was the next one (for whatever reason, this doesn't increment at the endian...).

i am wondering if we can treat the current unit testing experience in RNTester as pretty much maintenance mode and start thinking of a improved version starting with something more modular like this.

Reviewed By: cipolleschi

Differential Revision: D46467229

fbshipit-source-id: 09de9cf8bc5f8b9c86abcaf7750a6f63686d8d1a
2023-06-12 13:37:39 -07:00
Phillip Pan 466742c9ce rename ReactInstanceTest directory from hermes to cxx (#37812)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37812

Changelog: [Internal]

I would like to add iOS unit tests, but this testing directory has a subdirectory based on features and not platform, which makes the organization challenging, so i'm moving it to a more aptly named directory.

Reviewed By: javache

Differential Revision: D46467041

fbshipit-source-id: f2ba714dc79ecb509b86b4708320c68235354240
2023-06-12 13:37:39 -07:00
Nicola Corti 3a246ed024 Remove CallInvoker parameter from toJs method in Codegen (#37832)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37832

This parameter is currently unused and is causing Android builds to fail
as they compile with `-Wall`

This is a follow-up to https://github.com/facebook/react-native/pull/37454/ as that PR updated only the `fromJs` and not the `toJs` method as well.

Changelog:
[Internal] [Changed] - Remove CallInvoker parameter from toJs method in Codegen

Reviewed By: rshest

Differential Revision: D46647110

fbshipit-source-id: 1f3e22aca7a3df11ac02b5c4b89c9311b8b1798c
2023-06-12 12:46:00 -07:00
Genki Kondo 48cdc603f5 Back out "When animating using native driver, trigger rerender on animation completion" (#37820)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37820

Original commit changeset: 185471b28f5f

Original Phabricator Diff: D46574511

Changelog: [internal]

Reviewed By: jehartzog

Differential Revision: D46629553

fbshipit-source-id: 7c8bc7970006643459a3b9c8613009614dcd3886
2023-06-12 12:09:45 -07:00
Rubén Norte c97dcc2de5 Cache properties in global.nativeFabricUIManager when accessed through FabricUIManager.getFabricUIManager (#37796)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37796

Changelog: [internal]

`global.nativeFabricUIManager` is defined as a host object in https://github.com/facebook/react-native/blob/5cc8ceeae210f2f23ef18ded7b7b614682f0d67b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp and every time a property of that object is accessed, the value is recreated by the host object (like in https://github.com/facebook/react-native/blob/5cc8ceeae210f2f23ef18ded7b7b614682f0d67b/packages/react-native/ReactCommon/react/renderer/uimanager/UIManagerBinding.cpp#L179). This is problematic because we're continuously creating copies of those methods every time we access them.

As a quick solution (until we migrate the whole native implementation to a regular object with eagerly defined properties or to a TurboModule), this creates a proxy object in JavaScript to cache all properties.

Reviewed By: rshest

Differential Revision: D46592010

fbshipit-source-id: 38f233becd2ca130fa331d61f99ba54fbf706e13
2023-06-12 11:02:22 -07:00
Rubén Norte 5fa1d8287d Validate number of arguments passed to UIManagerBinding methods (#37783)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37783

We're not checking the number of arguments received before accessing the `arguments` array in JSI methods in `UIManagerBinding`, which could cause access to garbage values. This fixes that by adding a check in all methods to ensure the number of arguments received is at least the arity of the function.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D46564580

fbshipit-source-id: 7012e0d6fb12c5024e4d6a4c0fb7a8c00263ccac
2023-06-12 11:02:22 -07:00
Rubén Norte 87c11bc3ad Implement id property in ReadOnlyElement (#37755)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37755

This implements the `id` property in `ReadOnlyElement` as an alias for the `id` or `nativeID` props of the element.

This is currently implemented using an internal API in React but we should find an alternative solution for this in Fabric in the near future. Adding this now because it's useful for debugging.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D46518381

fbshipit-source-id: 1a72fe0349c248744f49b795022b6fdb3359885d
2023-06-12 11:02:22 -07:00
Rubén Norte 08948810cb Implement scrollTop and scrollLeft (#37754)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37754

This adds a new method in Fabric to get the scroll position for an element, and uses it to implement the following methods as defined in  as defined in https://github.com/react-native-community/discussions-and-proposals/pull/607 :
* `scrollTop`: indicates the number of pixels (in device independent pixels) from the content that have moved in the vertical axis in the scroll container.
* `scrollLeft`: indicates the number of pixels (in device independent pixels) from the content that have moved in the horizontal axis in the scroll container.

These API can provide decimal values.

Changelog: [internal]

Reviewed By: javache

Differential Revision: D44757811

fbshipit-source-id: e1b58db8d9f61e823b62d54620a9a0deaae1566b
2023-06-12 11:02:22 -07:00
Gabriel Donadel 7d1f7f3f5f Fix Android border clip check (#37828)
Summary:
Instead of requiring all  types of border color values to be present we should only take into consideration the left, top, right, bottom, and allEdges values and inject block values into  colorBottom and colorTop.

This PR only addresses the first issue described here (https://github.com/facebook/react-native/issues/37753#issuecomment-1587196793) by kelset

## Changelog:

[ANDROID] [FIXED] - Fix border clip check

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

Test Plan:
Test through rn-tester if border color is being applied

<img width="482" alt="image" src="https://github.com/facebook/react-native/assets/11707729/c8c8772c-da8d-4393-bc3f-5868eca5df15">

Reviewed By: lunaleaps

Differential Revision: D46643773

Pulled By: cipolleschi

fbshipit-source-id: efb1ea81bf2462c14767a2554880eb7c44989975
2023-06-12 10:08:52 -07:00
Rubén Norte d71da6190a Define toJSON method in PerformanceEventTiming to show all fields properly when using console.log (#37808)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37808

When passing entries of type "event" to `console.log` we only see the fields defined in the base `PerformanceEntry` class because it defines a `toJSON` method but the `PerformanceEventTiming` subclass doesn't.

This implements the method in that class too to improve debuggability (while also making it more spec compliant).

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D46597764

fbshipit-source-id: ca6fba3fdbb74a4f767eebc647681e5b65ba65d8
2023-06-12 09:11:58 -07:00
Rubén Norte 33b9c8e9e2 Create module to set up PerformanceObserver (#37807)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37807

We implemented `PerformanceObserver` but didn't create a `setUp*` module for it like we did for the rest of globals in RN.

This creates the module but doesn't enable it by default (until stable in OSS). We'll require this in a case by case basis for testing.

Changelog: [internal]

Reviewed By: rshest

Differential Revision: D46597766

fbshipit-source-id: 661d009754f4310c6b83483188ed020fc1d4d63b
2023-06-12 09:11:58 -07:00
Oskar Kwaśniewski ef5d92f648 Convert DeviceInfoModuleTest to Kotlin (#37805)
Summary:
This PR converts DeviceInfoModuleTest into Kotlin as requested in https://github.com/facebook/react-native/issues/37708.

## Changelog:

[INTERNAL] [CHANGED] - Convert DeviceInfoModuleTest to Kotlin

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

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

Reviewed By: cortinico

Differential Revision: D46614375

Pulled By: rshest

fbshipit-source-id: 3fc390069628e3ce188121f3e775b28e88875af8
2023-06-12 08:00:44 -07:00
Genki Kondo 03f70bf995 When animating using native driver, trigger rerender on animation completion (#37786)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37786

When using the native driver for animations that involve layout changes (ie. translateY and other transforms, but not styles such as opacity), because it bypasses Fabric, the new coordinates are not updated so the Pressability responder region/tap target is incorrect.

Prior diffs ensure that upon completion of natively driven animations, the final values are synced to the JS side AnimatedValue nodes. In this diff, on completion of a natively driven animation, AnimatedProps.update() is called, which in turn calls the value update callback on AnimatedProps, which [triggers a rerender (via setState)](https://www.internalfb.com/code/fbsource/[566daad5db45807260a8af1f85385ca86aebf894]/xplat/js/react-native-github/packages/react-native/Libraries/Animated/useAnimatedProps.js?lines=80) which has the effect of pushing the latest animated values to Fabric.

Alternative considered was using setNativeProps, but that approach was dropped as setNativeProps was only introduced to make migration easier and should not be used for new code, as per sammy-SC.

Changelog:
[General][Fixed] - When animating using native driver, trigger rerender on animation completion in order to update Pressability responder regions

Reviewed By: rshest

Differential Revision: D46574511

fbshipit-source-id: 185471b28f5f7e3ba9d62d2ac196e9b65b07a86e
2023-06-09 18:28:39 -07:00
Genki Kondo 51cea49be7 Sync AnimatedValue JS node value when animation completes (#37779)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37779

For natively driven animations, we now get the final value of the animation on JS side in the animation end callback. We sync this value into the JS-side AnimatedValue node.

Changelog:
[General][Changed] - Sync AnimatedValue JS node value when animation completes

Differential Revision: D46498320

fbshipit-source-id: 550a3bbbd5323f917c175801b6414a721aa69be5
2023-06-09 15:09:58 -07:00
fathonyfath c5e0e2d169 Convert DialogModuleTest to Kotlin (#37795)
Summary:
This PR converts DialogModuleTest into Kotlin as requested in [this issue](https://github.com/facebook/react-native/issues/37708).

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

[INTERNAL] [CHANGED] - Convert DialogModuleTest to Kotlin

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

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

Reviewed By: cortinico

Differential Revision: D46596235

Pulled By: mdvacca

fbshipit-source-id: ef4184664ad885ebd2e8c1d51ca5bb7dc48f0610
2023-06-09 13:18:36 -07:00
Gabriel Donadel ee3a8a495a Fix loading NODE_BINARY inside Generate Legacy Components Interop (#37802)
Summary:
When trying to build an app using 0.72.0-RC.5 inside a project that uses `.xcode.env.local` the  `[CP-User] Generate Legacy Components Interop` Phase script fails to run due to a `Permission denied` error. That's because `.xcode.env.local` is not being loaded, resulting in `NODE_BINARY=" "` and then the `React-RCTAppDelegate` script tries to run `generate-legacy-interop-components.js` directly.

E.g

![image](https://github.com/facebook/react-native/assets/11707729/ce72d7d1-69ab-4477-a754-10cd52bb21a2)

In order to fix this we should run the `with-environment.sh` script instead of directly loading `.${PODS_ROOT}/../.xcode.env`

## Changelog:

[IOS] [FIXED] - Fix loading `NODE_BINARY` inside Generate Legacy Components Interop

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

Test Plan: Make sure you don't have a `.xcode.env` file and run locally a project that uses React-RCTAppDelegate

Reviewed By: cortinico

Differential Revision: D46596246

Pulled By: cipolleschi

fbshipit-source-id: 5616395f39b0fae7b2fa9e59bd72c70f39198b4d
2023-06-09 09:06:37 -07:00
Alex Danoff 96fd107d61 W3CPointerEvents: fix NPE due to null targetView (#37785)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37785

Changelog: [Android] [Fixed] - W3CPointerEvents: fix NPE due to null targetView

For reasons not entirely understood, we sometimes end up with a null `targetView` in this code path during the dispatch of an `ACTION_CANCEL`. This results in an NPE during the call to `getChildOffsetRelativeToRoot`. This change adds a null check before the call to avoid the crash.

Reviewed By: cortinico

Differential Revision: D46562263

fbshipit-source-id: fe60fe08929ed29a570a860d49915b6f5ae4a542
2023-06-09 08:42:27 -07:00
generatedunixname89002005325672 72eadcf769 Daily arc lint --take KTFMT (#37803)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/37803

Reviewed By: bigfootjon

Differential Revision: D46587932

fbshipit-source-id: acb9c4ba33cc980904996f4af54ed366abe66c70
2023-06-09 08:31:35 -07:00
Riccardo Cipolleschi b63efe2027 Remove dependency from PRODUCTION flag from React-hermes (#37723)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37723

React-hermes pod sets the `GCC_PREPROCESSOR_DEFINITIONS` flag for Debug config only, by leveraging the `PRODUCTION=1` flag.

This flag is not standard for iOS, therefore we want to remove it from the condebase to simplify the build APIs.

This change moves the setting of the `GCC_PREPROCESSOR_DEFINITIONS` flag from the podspec xcconfig (which can't distinguish between Debug and Release configurations) to a post install hook (which can).

## Changelog:
[internal] - Remove dependency on PRODUCTION=1 from React-hermes podspec

Reviewed By: dmytrorykun

Differential Revision: D46316662

fbshipit-source-id: b5764e1bf60f2e71ff171556bccbc00c0c0c62aa
2023-06-09 07:44:52 -07:00
Abdennour JEBBAR 6ebee63ab7 Convert ReactTestHelper (#37768)
Summary:
As part of the effort to Kotlin-fy React Native tests, I've converted [ReactTestHelper](https://github.com/facebook/react-native/tree/main/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/bridge/ReactTestHelper.java) to Kotlin.

## Changelog:

[Internal] [Changed] - Convert ReactTestHelper to Kotlin

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

Test Plan:
Tests pass: ./gradlew :packages:react-native:ReactAndroid:test
Formatted with [KtFmt](https://facebook.github.io/ktfmt/)

Reviewed By: rshest

Differential Revision: D46587427

Pulled By: cortinico

fbshipit-source-id: 82d08d01cf4c7cb7c05a63696e1acdacf60b1ad5
2023-06-09 07:08:08 -07:00
brunohensel 0aa330801b Migrate MultipartStreamReaderTest to Kotlin (#37743)
Summary:
Migrate [MultipartStreamReaderTest.java](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/test/java/com/facebook/react/devsupport/MultipartStreamReaderTest.java) to Kotlin.  See https://github.com/facebook/react-native/issues/37708

## Changelog:

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

Pick one each for the category and type tags:

[INTERNAL] [CHANGED] - Migrate MultipartStreamReaderTest to Kotlin

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[INTERNAL] [CHANGED] - Migrate MultipartStreamReaderTest to Kotlin

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

Test Plan:
Tests pass: ./gradlew :packages:react-native:ReactAndroid:test
Formatted with [KtFmt](https://facebook.github.io/ktfmt/)

Reviewed By: mdvacca

Differential Revision: D46559844

Pulled By: cortinico

fbshipit-source-id: 4cc7b0cb9819930567c4021dace0c48e93be333c
2023-06-09 06:18:18 -07:00
Nick Gerleman 48c0e41d06 Revert D46501420: Exclude trailing whitespace on measuring text width
Differential Revision:
D46501420

Original commit changeset: fba4acd38747

Original Phabricator Diff: D46501420

fbshipit-source-id: 64c76b96d0e12f9bd7edd4640904de9fce3b44e6
2023-06-08 18:38:55 -07:00
Genki Kondo 4b54c0b1fa return final animation values to JS when animation completes (#37782)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37782

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

When using the native driver for animations that involve layout changes (ie. translateY and other transforms, but not styles such as opacity), because it bypasses Fabric, the new coordinates are not updated so the Pressability responder region/tap target is incorrect

**This diff:**
- Returning the final values from the native side, at the same place it sets the "finished" flag. This gets sent to JS in `animated/animations/Animation.js`. In this diff I'm passing the value when 'hasFinishedAnimations' is true, but in a follow up diff I will look into other cases such as cancelled animations

Next:
2. Update the Animated.Value to reflect the new values
3. Call the onEnd function if there is one set
4. Pass the new values down for layout calculations and the correct Pressability responder region

Changelog:
[General][Changed] - return animated values to JS for natively driven animations

Reviewed By: javache

Differential Revision: D44110833

fbshipit-source-id: ce8c09fbe20c0c155260ce9561a67f7dfba30515
2023-06-08 16:53:34 -07:00
Nick Gerleman 8f7f0bf2a3 Extract logic to CellMetricsAggregator (#37777)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37777

This extracts the state and logic VirtualizedList uses to query information related to cell metrics. We will need to modify this (and other places) when fixing up RTL support for horizontal FlatList.

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D46427052

fbshipit-source-id: 0a23f6c726447de0f20c583b4d507003efd6a754
2023-06-08 15:53:10 -07:00
Nick Gerleman 96225cec2b Rename FrameMetrics to CellMetrics (#37778)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37778

These functions describe how to get the metrics of a specific cell. "Frame" here seems non-descriptive and redundant to the "Metrics" part. Renaming this before a larger refactor.

Changelog: [Internal]

Reviewed By: philIip

Differential Revision: D46427058

fbshipit-source-id: e9ad9cf15e1adfd07604eb11526de0ed8cf99000
2023-06-08 15:53:10 -07:00
Intl Scheduler ec957f5c15 translation auto-update for i18n/fb4a.config.json on master
Summary:
Chronos Job Instance ID: 1125907895823816
Sandcastle Job Instance ID: 18014399477912355
allow-large-files
ignore-conflict-markers
opt-out-review

Differential Revision: D46577121

fbshipit-source-id: 8f549f6ca7186a0aaa220d29fda10a6a7378ccf8
2023-06-08 15:45:20 -07:00
Randall71 67eb4946e3 (codegen 133) - Parser extractTypeFromTypeAnnotation (#37752)
Summary:
> [Codegen 133 - Assigned to Randall71] Create an extractTypeFromTypeAnnotation(typeAnnotation) function in the Parser base class. Implement it using [this code for Flow](https://github.com/facebook/react-native/blob/d8ced6f8953cd896471983714e722caf50783960/packages/react-native-codegen/src/parsers/flow/components/events.js#L193-L197) and [this code for TypeScript](https://github.com/facebook/react-native/blob/d8ced6f8953cd896471983714e722caf50783960/packages/react-native-codegen/src/parsers/typescript/components/events.js#L189-L193). Replace the invocation of that function with the one from the parser

This is part of https://github.com/facebook/react-native/issues/34872

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

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

Test Plan: yarn jest packages/react-native-codegen > new tests written, as well as coverage from existing tests

Reviewed By: cipolleschi

Differential Revision: D46520245

Pulled By: rshest

fbshipit-source-id: 8c5d8ca8b46fb44399089c6b694998874463ecc8
2023-06-08 14:58:15 -07:00