Commit Graph

248 Commits

Author SHA1 Message Date
Ramanpreet Nara a1b64b7f15 Introduce SampleLegacyModule example in RNTester (#38008)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/38008

Introduce a legacy module (+ example) in RNTester.

In the future, SampleLegacyModule will be used to:
- Showcase the TurboModule interop layer in RNTester, once Bridgeless mode is ready
- E2E Test the TurboModule interop layer.

The TurboModule interop layer is just an extension to the TurboModule system that allows the system to create legacy modules. Unlike regular TurboModules, these legacy modules don't need codegen for JavaScript -> native method dispatch.

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D46874160

fbshipit-source-id: f9810d0bdb3bd0c0a74099fcb6f74ca547977a53
2023-06-21 18:30:09 -07:00
Lulu Wu 28c26dc305 Add CMakeLists to build C++ files in OSS (#37969)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37969

Add CMakeLists to build Bridgeless C++ files in OSS

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D46527523

fbshipit-source-id: 93427732461f8efdeff671bff86557ecde5eea47
2023-06-19 21:31:07 -07:00
Lulu Wu a3c7102d5c Add a separate HermesInstance for internal (#37968)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37968

Currently we have 2 versions of JSITracing:
- [Internal](https://www.internalfb.com/code/fbsource/[06c0641fed51160887cdaec18d22dd39d11ee1c0]/xplat/ReactNative/react/jsi/JSITracing.h)
- [OSS](https://www.internalfb.com/code/fbsource/[06c0641fed51160887cdaec18d22dd39d11ee1c0]/xplat/js/react-native-github/packages/react-native/ReactCommon/hermes/executor/JSITracing.h)

After talking with rubennorte it's expected that the OSS version has empty implementation and we want to keep it this way for Bridgeless as well.

To include both OSS and internal JSITracing for Bridgeless, in this diff a duplicate internal HermesInstance is created, after this change:
- Internal HermesInstance will use existed internal JSITracing
- OSS HermesInstance will use existed OSS JSITracing

The newly created internal HermesInstance will be located in existed internal Hermes folder which was created for the Bridge.

**Is there a better way to solve this issue?**
- I thought about including both versions of JSITracing in ReactInstance.cpp but couldn't find a way to unify the including paths for JSITracing.h inside ReactInstance.cpp

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D46527522

fbshipit-source-id: 7d2c14a6313e89bf5daaf668867cae31442e81b1
2023-06-19 20:00:03 -07:00
Samuel Susla c1bfd0cda4 Re-add gating to RuntimeScheduler::Task around setNativeState (#37597)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37597

changelog: [internal]

In https://github.com/facebook/react-native/commit/7211ef19624304b6a4d5219a8e0a2c67651b8b33 I removed use of CoreFeatures class from RuntimeScheduler to work around a circular dependency in cocoapods.
In D46218604 I resolved the circular dependency issue and this diff adds the feature flag back.

Reviewed By: javache

Differential Revision: D46218660

fbshipit-source-id: abcdd522195cd5fa979ed3a559c00e1f2d2ae23a
2023-06-19 07:58:45 -07:00
Samuel Susla bb879d3ecb Move CoreFeatures to React-utils (#37599)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37599

changelog: [internal]

Moving CoreFeatures class to `utils` module from `core` module. There are other modules besides `core` that need to use CoreFeatures and moving it to `utils` will prevent circular dependency.

Reviewed By: javache, rshest

Differential Revision: D46218604

fbshipit-source-id: 6030f00ad37f55f0c95f4eafa61fb22808b880a4
2023-06-17 07:49:56 -07:00
Vincent Riemer 3aa42a2d3d Add plumbing/boilerplate for an iOS implementation of the gotpointercapture and lostpointercapture events (second try) (#37889)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37889

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

Lets try this again: The key difference between this and D44977499 (which I previously reverted) is that in propsConversions & primitives I've ommited the "capture" versions of those methods as it was causing issues. Since we're not doing any runtime checks of those raw props it isn't particularlly necessary (at least not yet) and if we ever want to we can address that when it comes up.

The original diff description follows:

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: adanoff

Differential Revision: D46709127

fbshipit-source-id: 339dc99e14f2e72d9116bbe84edc67cb5bfaa73b
2023-06-16 15:09:13 -07:00
Pieter De Baets a855013fc6 Use static_cast instead of static_pointer_cast where possible (#37932)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37932

`static_cast<Derived &>(*sharedBase)` is preferred over `*std::static_pointer_cast<Derived>(sharedBase)`, since we don't need to copy the underlying shared_ptr to do so. The same applies for `std::const_pointer_cast`.

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D46766558

fbshipit-source-id: 5d0b660107b2a60340952e2b5ec2792e3ed1832a
2023-06-16 08:00:57 -07:00
Andrew Wang 1525c5f342 Fix the issue that local reference overflows in Yoga 1 (#37929)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37929

X-link: https://github.com/facebook/litho/pull/952

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

Long story in short, we're trying to fix an issue with Yoga that could potentially lead to an overflow in the JNI local reference table.

Reviewed By: NickGerleman, astreet

Differential Revision: D46653732

fbshipit-source-id: 0bc34bd5a819037c046c62b651e414b249cbdcb8
2023-06-16 06:15:07 -07:00
Ramanpreet Nara 7bc2b730a8 Interop: Introduce Bridge proxy
Summary:
The TurboModule interop layer on iOS will ship with a Bridge proxy.

The Bridge proxy is an object that will try to simulate the Bridge's APIs, whenever possible, by delegating to Bridgeless abstractions.

## Changes
This diff introduces the Bridge proxy.
This diff starts attaching the Bridge proxy on legacy native module objects.

## How did we polyfill the APIs
The polyfills can be classified into these categories:
- implemented
- custom warning
- custom error
- default error
- deleted

When there was a sane implementation (e.g: the API belonged to [RCTCallableJSModules](https://www.internalfb.com/code/fbsource/[534223aa13d33b595edcb777189618efe20dd167]/xplat/js/react-native-github/React/Base/RCTCallableJSModules.m?lines=11), [RCTModuleRegistry](https://www.internalfb.com/code/fbsource/[9a3ba2b3176b6d1a1f161e33cec51bf892815311]/xplat/js/react-native-github/React/Base/RCTModuleRegistry.m?lines=13), [RCTBundleManager](https://www.internalfb.com/code/fbsource/[91fa1f7f49731a16aedbcd5a6740647dc21ff727]/xplat/js/react-native-github/React/Base/RCTBundleManager.m?lines=13), or [RCTBundleManager](https://www.internalfb.com/code/fbsource/[91fa1f7f49731a16aedbcd5a6740647dc21ff727]/xplat/js/react-native-github/React/Base/RCTBundleManager.m?lines=13)), it was implemented.

When it was safe to no-op the API (e.g: loading), it emit a custom warning.

When it was unsafe to call (i.e: we didn't want people calling the API) (e.g: RCTCxxBridge start), it emit a custom error.

All other APIs emit default errors.

Some APIs cannot emit errors because doing so makes the app not render: I put warnings and nooped those APIs.

I think we will have to tune these polyfills based off production crashes/results.

Reviewed By: mdvacca

Differential Revision: D46084318

fbshipit-source-id: c02535073956597a4bf91c14b1980f653cb6d3df
2023-06-15 18:05:55 -07:00
Alex Hunt 8b1bf058c4 Re-enable direct debugging with JSC on iOS 16.4+ (#37914)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37914

Restores https://github.com/facebook/react-native/pull/37874 (reverted earlier today), with fix for `JSCRuntime.cpp` build on Android.

Changelog: None

Reviewed By: cortinico

Differential Revision: D46762984

fbshipit-source-id: 6d56f81b9d0c928887860993b2b729ed96c0734c
2023-06-15 12:27:32 -07:00
Samuel Susla 1561d2906e Make React-utils its own pod (#37659)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37659

changelog: [internal]

To better align with how BUCK is setup internally, let's make React utils its own pod.

Reviewed By: dmytrorykun

Differential Revision: D46358021

fbshipit-source-id: c2a48a18e9839a508a87d54685115883975f3979
2023-06-15 11:44:26 -07:00
Riccardo Cipolleschi e6a2b2093c Revert D46719890: Re-enable direct debugging with JSC on iOS 16.4+
Differential Revision:
D46719890

Original commit changeset: 7fa5ae244577

Original Phabricator Diff: D46719890

fbshipit-source-id: 1e5478d0fd0d09a678111b133cc46c4bdc8fc282
2023-06-15 05:58:21 -07:00
Saad Najmi 5cf8f43ab1 Re-enable direct debugging with JSC on iOS 16.4+ (#37874)
Summary:
See: https://webkit.org/blog/13936/enabling-the-inspection-of-web-content-in-apps

As of iOS 16.4 and above, JSContexts are no longer inspectable by default. Without this, we cannot attach Safari Web Inspector to the JSContext, AKA, we can no longer direct debug. This is a simple change to re-enable that. I decided to extend the `availability` check to macOS and tvOS as I'm certain both out of tree platform forks will want this fix as well.

## Changelog:

[IOS] [FIXED] - Re-enable direct debugging with JSC on iOS 16.4+

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

Test Plan: I launched RNTester in an iOS 15, and iOS 16.4 simulator. I then verified that we can attach Safari Web inspector to both simulators' JSContexts.

Reviewed By: cortinico

Differential Revision: D46719890

Pulled By: huntie

fbshipit-source-id: 7fa5ae244577b7dbf3c9c16e65ad530cfc3e9cbd
2023-06-15 02:32:51 -07:00
Phillip Pan 0f688dc677 test runtime lifecycle callback (#37897)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37897

Changelog: [Internal]

adding unit test for `instance:didInitializeRuntime`

Reviewed By: cipolleschi

Differential Revision: D46704036

fbshipit-source-id: 6418bae56ae465f6ed9addde75d4de5719f402bb
2023-06-14 17:14:02 -07:00
Phillip Pan 066d52b7a9 test host error callback (#37894)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37894

Changelog: [Internal]

as title

Reviewed By: cipolleschi

Differential Revision: D46672582

fbshipit-source-id: b37f6840c2fa505a33988cbb4b89f66698b0c66c
2023-06-14 17:14:02 -07:00
Phillip Pan 1cac95d076 push error handling c++ parsing down (#37893)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37893

Changelog: [Internal]

i just noticed we can push more C++ code down into RCTInstance, so let's do that! will make everything easier to test as well

Reviewed By: cipolleschi, RSNara

Differential Revision: D46672345

fbshipit-source-id: fcb878698ebc9a19714ba6ff94a5760efc830958
2023-06-14 17:14:02 -07:00
Phillip Pan 7d69cd5640 test callFunctionOnJSModule (#37898)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37898

Changelog: [Internal]

as title

Reviewed By: cipolleschi

Differential Revision: D46672230

fbshipit-source-id: 8180f9dc26b44d50530fc440602acbafcf24df2f
2023-06-14 17:14:02 -07:00
Phillip Pan cc7da26f44 test RCTHost doesn't leak memory (#37896)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37896

Changelog: [Internal]

example usage of the memory test utilities

Reviewed By: cipolleschi

Differential Revision: D46625917

fbshipit-source-id: 379a76e59fb58cc4e5972195df167c52170f5e4c
2023-06-14 17:14:02 -07:00
Phillip Pan e822056618 add test helpers for memory (#37895)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37895

Changelog: [Internal]

i'm adding these helpers so we can test that our objects aren't leaking memory

Reviewed By: cipolleschi

Differential Revision: D46625916

fbshipit-source-id: d811336ae3b0ac420b81832c258d5573c20a5bc7
2023-06-14 17:14:02 -07:00
Phillip Pan 75d34407c1 test RCTInstance invalidation on RCTHost restart (#37899)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37899

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D46547012

fbshipit-source-id: 9b157678c474120aeca3896942e368678cb5b8eb
2023-06-14 17:14:02 -07:00
Riccardo Cipolleschi daa99fe5e7 Cleanup, remove the PRODUCTION flag (#37882)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37882

After some progressive changes, we can finally remove the PRODUCTION flag from the codebase.

## Changelog:
[iOS][Removed] - Remove PRODUCTION flag from iOS build logic

Reviewed By: cortinico, dmytrorykun

Differential Revision: D46726208

fbshipit-source-id: 407268779be8de32c5a6c15ba220a60b7cb9ced7
2023-06-14 10:10:16 -07:00
Vincent Riemer 9e50185d97 Back out "Add plumbing/boilerplate for an iOS implementation of the gotpointercapture and lostpointercapture events" (#37861)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37861

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

Original commit changeset: c9da5691d399

Original Phabricator Diff: D44977499

This diff appears to be causing issues as reported on T155721480 related to the file `RawPropsKeyMap.cpp` which, while I haven't figured out exactly why this is occurring, confirmed that this diff is causing the issue. In order to buy myself some more time as I diagnose this I'm backing the changes out in this diff.

Reviewed By: adanoff

Differential Revision: D46691035

fbshipit-source-id: 383b46732a3fad24a50e18ab948c96ce9bfe429e
2023-06-13 16:39:08 -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
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
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
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
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 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
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
Rubén Norte 325072575a Expose instance handles from shadow nodes directly, instead of from event emitters/targets (#37553)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37553

## Context

I added some getters in EventTarget/EventEmitter to access the React instance handle for a given shadow node/shadow node family in https://github.com/facebook/react-native/commit/43864a1d6025bfc4483dded115d51f7613018199 (D44022477), so I could implement DOM traversal methods easily.

I wanted to reuse that method to implement `MutationObserver` and `IntersectionObserver`, but unfortunately `EventEmitter`/`EventTarget` only allow access to the instance handle as long as the shadow node is mounted. That makes sense for events, but not for this use case, as with `MutationObserver` we intentionally want to have access to unmounted nodes when creating the list of `addedNodes` and `removedNodes` for the `MutationRecord` (depending on when exactly we generate this list, either `addedNodes` or `removedNodes` wouldn't be mounted).

## Changes

This reverts my original change and adds a new field in `ShadowNodeFamily` to provide access to the `InstanceHandle` at any point (even if the node isn't mounted).

This provides the same guarantees as the original method, keeping weak references to the handles to avoid memory leaks.

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D46149084

fbshipit-source-id: f76abae50134a5d55a98cab42eebeb62084024f9
2023-06-08 14:38:00 -07:00
Rubén Norte a88c0edbd3 Remove references to ShadowNodeFamilyFragment when not used to create new instances of ShadowNodeFamily (#37772)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37772

Changelog: [internal]

`ShadowNodeFragment` is used in multiple places as a general definition for the fragment, but it lacks information that's going to be constructed in the fragment itself in the future (like `eventEmitter` in D46149084).

This migrates some of the usages of this fragment to the `ShadowNodeFamily` directly (as they already have access to it).

Reviewed By: javache, sammy-SC

Differential Revision: D46190382

fbshipit-source-id: 3a879861106594d66a2580410d4d83523c288314
2023-06-08 14:38:00 -07:00
Rubén Norte 9bd5591c59 Remove references to ShadowNodeFamilyFragment from ComponentKit shadow node wrappers (#37773)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37773

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D46190383

fbshipit-source-id: e85948fbfeaaa4e057e6ff736734da0de2c06d0f
2023-06-08 14:38:00 -07:00
Fábio Henriques 6b62f12ce9 Add smartInsertDelete prop to TextInput component (#36111)
Summary:
This PR add support to configure the `smartInsertDeleteType` property in iOS inputs [as described here](https://developer.apple.com/documentation/uikit/uitextinputtraits/2865828-smartinsertdeletetype), making possible toggle this autoformatting behavior.

PR for the docs update: https://github.com/facebook/react-native-website/pull/3560

## Changelog:

[IOS] [ADDED] - Add `smartInsertDelete` prop to `TextInput` component

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

Test Plan:
* Added an example in the RNTester app to test this behavior in iOS.
* If the `smartInsertDelete` prop is `true` or `undefined`, the system will use the default autoformatting behavior.
* If the `smartInsertDelete` prop is `false`, the system will disable the autoformatting behavior.

https://user-images.githubusercontent.com/20051562/217862828-70c20344-d687-4824-8f5d-d591eff856ef.mp4

Reviewed By: javache

Differential Revision: D46546277

Pulled By: NickGerleman

fbshipit-source-id: 3172b14fb196876d9ee0030186540608204b96de
2023-06-08 12:06:15 -07:00
Pieter De Baets 6a710670f0 Handle double SurfaceHandler#stop call (#37716)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37716

We call `surfaceHandler.stop` both from `SurfaceHandlerBinding` as well as `Binding`. Since we don't check asserts in production, the second one should generally be a no-op, but may be causing a crash due to incorrectly de-referencing a unique_ptr.

Changelog: [Internal]

Reviewed By: mdvacca

Differential Revision: D46441620

fbshipit-source-id: e93b9722fd717947ebf772f545f692c2e31f816e
2023-06-08 06:51:21 -07:00
Pieter De Baets 7fb9e4f46c Provide jsi::Runtime directly to RCTTurboModuleManager (#37687)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37687

We end up creating a stub RuntimeExecutor wherever we configure this, and might as well pass in the runtime directly, to match the other binding installer signatures.

Changelog: [iOS][Deprecated] Use -[RCTTurboModuleManager installJSBindings:] instead of -[RCTTurboModuleManager installJSBindingWithRuntimeExecutor:]

Reviewed By: philIip

Differential Revision: D46390501

fbshipit-source-id: df7644ccbd04462dbbe752c60e5d5961ab50dff5
2023-06-06 08:19:19 -07:00
Phillip Pan b6b247b874 move host:didInitializeRuntime: to public api
Summary:
Changelog: [Internal]

it appears that having some access to jsi in userland will be necessary for framework developers, so i'm moving this API to the public header.

bypass-github-export-checks

Reviewed By: mdvacca

Differential Revision: D46385184

fbshipit-source-id: 7261c0a8ba8c8c9302f65d440a3a3fb2782c0666
2023-06-05 21:31:29 -07:00
Phillip Pan 7b763cd3db clean up comments and imports in RCTHost header
Summary:
Changelog: [Internal]

now that we've wrapped up the first iteration of the venice stable apis, let's clean up old comments and reorganize things to prepare this header for documentation.

bypass-github-export-checks

Reviewed By: mdvacca

Differential Revision: D46334662

fbshipit-source-id: 68d6d2e41d7f7c5b1c69f3bb72482c418e771f72
2023-06-05 19:48:29 -07:00
Phillip Pan 46d14ceab2 delete RCTHostCreationHelpers (#37703)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37703

Changelog: [Internal]

i did too good of a job refactoring that these functions don't abstract any arguments away anymore, so let's just delete it

Reviewed By: javache

Differential Revision: D46303713

fbshipit-source-id: 7e0508a7296ebc3d5c62cf0824071bd2ef041193
2023-06-05 12:31:19 -07:00
Phillip Pan e0a1a18d4b introduce RCTContextContainerHandling (#37702)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37702

Changelog: [Internal]

the context container is a DI object in our internal infra. the delegate method `createContextContainer` is used to pass down internal implementations that may be used in our infra, notably the `ReactNativeConfig`. this API used to be required for the app delegate to implement.

in this change, i introduce a protocol, `RCTContextContainerHandling`, where we shift the burden of creating the DI container to our internal infra where userland can now optionally add dependencies to this.

this also removes more C++ boilerplate for the bridgeless setup.

Reviewed By: sammy-SC

Differential Revision: D46245433

fbshipit-source-id: 552a9ab0b6a178bab592743863694ff886b152f8
2023-06-05 12:31:19 -07:00
Phillip Pan 2861dd2b1e remove bindingsInstallFunc argument from bridgeless api (#37604)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37604

Changelog: [Internal]

this isn't needed anymore, so we can delete it and remove it from our public api

Reviewed By: javache

Differential Revision: D46215054

fbshipit-source-id: 97bc7821aeea47223a4b10684efe750ff1899fa2
2023-06-05 12:31:19 -07:00
Phillip Pan 50fd76ab04 introduce internal delegate callback for jsi runtime initialization (#37605)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37605

Changelog: [Internal]

in this stack, i remove the `bindingsInstallFunc` argument from `RCTHost`'s public API.

the bindingsInstallFunc is a lambda that provides a runtime parameter, which the consumer can "install bindings" to. we have our specific use case for this internally, but there's no need to expose this.

in this change, i introduce a delegate callback path that notifies an internal delegate that the react runtime has been created.

Reviewed By: javache

Differential Revision: D46215051

fbshipit-source-id: 732d6949064b0948b5cf883dc3c0ab494c2ecd94
2023-06-05 12:31:19 -07:00
Rubén Norte 9c11b81630 Add some additional Systrace markers in Fabric (#37675)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37675

Changelog: [Internal]

Reviewed By: rshest

Differential Revision: D46393554

fbshipit-source-id: 905097c82c96c7f627f1999f53b509ba0f434dd5
2023-06-05 08:53:54 -07:00
Nick Gerleman 2d07d5f160 Native ARIA Roles: iOS Paper + Fabric (#37309)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37309

### Stack

ARIA roles in React Native are implemented on top of accessibilityRole. This is lossy because there are many more ARIA roles than accessibilityRole. This is especially true for RN on desktop where accessibilityRole was designed around accessibility APIs only available on mobile.

This series of changes aims to change this implementation to instead pass the ARIA role to native, alongside any existing accessibilityRole. This gives the platform more control in exactly how to map an ARIA role to native behavior.

As an example, this would allow mapping any ARIA role to AutomationControlType on Windows without needing to fork to add new options to accessibilityRole.

It also allows greater implementation flexibility for other platforms down the line, but for now, iOS and Android behave the same as before (though with their implementation living in native).

### Diff

This enables the `role` prop in iOS. ARIA role strings become convertible to `UIAccessibilityTrait`, which is the sink of most of the roles. We keep a list of traits derived from `role` vs `accessibilityRole` on the view, then inval and apply the result any time the prop for either is set.

Changelog: [Internal]

Reviewed By: sammy-SC

Differential Revision: D45432530

fbshipit-source-id: ced5be06e319c0b967d7511293e14e05147e5759
2023-06-04 03:48:45 -07:00
Samuel Susla dc54334c59 Create separate pod for React-debug (#37657)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37657

changelog: [internal]

Make React-debug into its own pod to align BUCK and cocoapods.

This is needed to reland RuntimeScheduler in the old architecture on iOS.

Reviewed By: rickhanlonii

Differential Revision: D46357876

fbshipit-source-id: 035aaaee8b4b106f873b4b30c8cb424867be066a
2023-06-01 11:45:57 -07:00
Riccardo Cipolleschi b50874cad4 Remove missing dependencies from React-Fabric (#37652)
Summary:
When reverting the runtimescheduler fix, we forgot to remove some lines from the React-Fabric dependencies. This broke pod install and we have a red ci since then.

bypass-github-export-checks

## Changelog:

[iOS][Fixed] - fix React-Fabric dependencies

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

Test Plan: CircleCI is green

Reviewed By: cipolleschi

Differential Revision: D46349504

Pulled By: sammy-SC

fbshipit-source-id: 8fc1bca7838a913adba702033d06dd02b93c31f9
2023-06-01 04:53:03 -07:00
Ramanpreet Nara d0fed3adb6 Remove noexcept from UIManager methods that invoke JavaScript callbacks
Summary:
As far as I'm aware, there's no way to know/guarantee whether a JavaScript callback can throw an exception or not.

So, all UIManager methods that synchronously invoke JavaScript callbacks cannot use noexcept.

If they do use noexcept, and the JavaScript callback (i.e: product code) throws an exception, the app will crash.

Changelog: [Internal]

Created from CodeHub with https://fburl.com/edit-in-codehub

Reviewed By: javache

Differential Revision: D46122985

fbshipit-source-id: 2f4356c7dbab1b3a5e0549f58e73f6de1b626ce9
2023-05-31 13:02:12 -07:00