Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36681
This change is needed to add some E2E tests on the Hermes repo so that we can test Hermes against iOS other than android.
## Changelog:
[Internal][Added] - Add possibility to download Hermes from a specific commit
Reviewed By: cortinico
Differential Revision: D44460479
fbshipit-source-id: 89c196aa7c38533e4904444f7f17eb3236fc6356
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36677
## Changelog:
[Internal] - Don't cache UIManager type inside the Event data structure
A follow up to https://github.com/facebook/react-native/pull/36659
It's redundant, and it's good to have fewer "sources of truth" and keep the notion of UIManagerType separate from Event data structures.
Reviewed By: javache
Differential Revision: D44453812
fbshipit-source-id: 4efc0bb115bb4750e27afb2390afc9736ae67469
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36682
## Changelog:
[Internal][Fix] - Fix hashing function in event name mapping in PerformanceEntryReporter
A textbook mistake, when mapping event names via the constant lookup table, only the first 8 characters were effectively taken into account, thus mixing names of some events.
Reviewed By: rubennorte
Differential Revision: D44462195
fbshipit-source-id: 273891d92251014661af731618d8a549627b2983
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36669
The test: Route all TurboModules in Fb4a through the interop layer.
So now, instead of using the C++ codegen for method dispatch, TurboModules will instead be using JavaInteropTurboModule, which uses the ReactMethod annotations for method dispatch.
MobileConfig actualization diff: D44405316.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D44405336
fbshipit-source-id: 3b00028e26cdcd229e64630eef73409a3264636a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36667
## Context
TurboModuleManagerDelegate exposes two methods that create TurboModules:
- TurboModule getModule()
- CxxModuleWrapper getLegacyCxxModule()
## Problem
TurboModuleManagerDelegate.getLegacyCxxModule() is redundant: getModule() could just return all the modules that getLegacyCxxModule() returns: getLegacyCxxModule returns modules that implement TurboModule.
## Changes
So, let's deprecate getLegacyCxxModule(). This will simplify the implementation of TurboModuleManager.
Changelog: [Android][Deprecated] - Deprecate TurboModuleManager.getLegacyCxxModule
Reviewed By: cortinico
Differential Revision: D44407802
fbshipit-source-id: 88a6cf6597db76d8a74fd777d68ccf4f43aa6811
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36629
The scope of TurboModuleManager is increasing:
- Eventually, it'll be capable of creating interop NativeModules (i.e: NativeModules that don't implement TurboModule).
So, instead of creating duplicate methods for NativeModules on the TurboModuleManager, this diff changes the APIs of TurboModuleManager to work with the NativeModule interface.
Thoughts?
## Questions
**Question:** Is this a breaking change for open source?
- Technically, yes. This diff changes the public interface of TurboModuleManager.
**Question:** How large of a thrash will this cause for open source apps?
- The thrash should be minimal. People in open source shouldn't be creating their own TurboModuleManager. They also shouldn't be directly accessing the TurboModuleManager object either.
**Question:** Is this change safe?
- Yeah. All the code that calls into TurboModuleRegistry converts TurboModules it returns into NativeModules.
**Question:** Is this change move us in the right direction?
- Long term, the TurboModule system will support legacy modules as well as TurboModules.
- I think it makes a lot of sense to have one Java-facing registry: after all, Java will just treat these NativeModules/TurboModules as regular Java objects, and call public methods on them. It doesn't care if the module is TurboModule-compatible or not.
- As for the TurboModuleRegistry abstraction, I think we should eventually rename this to NativeModuleRegistry after we delete the current NativeModuleRegistry.
- Still thinking about this though. I will leave this diff in review to welcome comments.
Changelog: [Android][Deprecated] - Deprecate TurboModuleRegistry.getModule(), getModules(), hasModule(),
Reviewed By: mdvacca
Differential Revision: D43801531
fbshipit-source-id: 4af7cbc2e2dc7c1d664acbd38c83aa93aae23c9f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36628
The legacy NativeModule system supports integer and float in NativeModule method arguments and returns. This diff extends the TurboModule system for the same functionality. T
his is necessary because the TurboModule system will now need to dispatch method calls to legacy NativeModules.
NOTE: We can't actually test these changes until we run interop modules.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D44000389
fbshipit-source-id: 92282d582a0f98fcb88d83e460d4860a64fe1117
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36625
## Context
Previously, jsRepresentation would only cache the **HostFunctions** returned from TurboModule::createHostFunction().
## Changes
This diff replaces TurboModule::createHostFunction() with TurboModule::create().
Now, jsRepresentation will cache **all** the **properties** returned from TurboModule::create().
## Motivation
For interop modules, constants will be exported as properties on the TurboModule HostObject. This diff allows those constants (which are non HostFunctions) to be cached.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D44253229
fbshipit-source-id: d3dd042f4ccb6c076b83503f3712e4d1609388ce
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36626
In Bridgeless mode, With the TurboModule interop layer, the TurboModule system will need to customize the nativeModuleProxy global.
This customization would be much easier if the nativeModuleProxy global were installed by the TurboModule system (and not the Bridgeless core).
So, this diff moves nativeModuleProxy installation into the TurboModule system.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D43993197
fbshipit-source-id: 9361340c02e2d82c4e5f373f234f41dc9d72cbe4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36679
We expose a variant of `HermesExecutor.java` which allows you to set a custom max heap size. This variant also sets the `AllocInYoung/RevertToYGAtTTI`, which should never really be used without a matching call to `HermesInternal.ttiReached()`, which is not documented.
Changelog: [Internal]
Reviewed By: jpporto
Differential Revision: D44457318
fbshipit-source-id: e91b377cbc0ac596cfbe7d1178e2657b868c1067
Summary:
The `Renderer` directory is supposed to be only for files synced from the React repo. This moves the `public` directory that was added to it recently to the `ReactNative` directory.
Changelog: [internal]
bypass-github-export-checks
Reviewed By: sammy-SC
Differential Revision: D44421951
fbshipit-source-id: d098970b80cd467b5c772c3ae91ce716be373484
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36659
## Changelog:
[Android][Fixed] - Fix dispatching into incorrect UIManager type when event's target is a root view
There is a function, called [ViewUtil.getUIManagerType](https://github.com/facebook/react-native/blob/main/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/common/ViewUtil.java#L22), which infers whether we are using the new or old architecture, given a View tag ID, with the assumption being that all New Architecture tags are even (and therefore, we are in the New Architecture iff the view tag is even). See [here for more context](https://github.com/facebook/react/pull/12587/files).
This function was used to find out which type of event dispatcher to dispatch to, when going down the chain of event dispatching function calls on Android.
The problem is, that there may be cases, when this odd/even assumption breaks, in particular when the target view ID is equal to `1`, meaning that it's a root view ID and there is nothing else mounted there yet.
It's very rare that this happens in practice, but still is possible that user interacts with the screen before anything is mounted there (or if there is nothing mounted there by design).
Reviewed By: javache
Differential Revision: D44421739
fbshipit-source-id: fd5ba3c882f6c7d3c9543ebc2ec30ba000f7ca4f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36645
This broke while changing the AnimatedInterpolation back in D40571873 and D40632443, as I assumed the native side would be able to correctly handle values such as '1rad'. However these were being sent over as strings, and were thus using the string interpolation path, which does not work here.
Instead, handle both `deg` and `rad` explicitly when generating the config in JS.
Resolves issue https://github.com/facebook/react-native/issues/36608
Changelog: [General][Fixed] Resolves Animated.Value.interpolate results in NaN when output is in radians
Reviewed By: yungsters
Differential Revision: D44406034
fbshipit-source-id: fe0f3df16f2b8ec6c31f9359e4706cacc72b9951
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36662
For VR, JSPointerDispatcher skips calculating the delta of hit targets (which happens in onMove) on the frame in which the active controller is switched because the motion event is a DOWN event, not a MOVE event in that specific frame.
This diff fixes the issue by just calling onMove in addition to onDown for DOWN motion events. Unfortunately we do not have separate pointer IDs for each controller.
This won't change the behavior for non-hoverable pointers. For hoverable pointers, it will dispatch an extra pointer_enter if the hit path has changed between the last move event and the down event.
Changelog:
[Internal][Fixed] - Trigger pointer leave when active controller switched
Reviewed By: lunaleaps, javache
Differential Revision: D44377324
fbshipit-source-id: 9f668e64f486b9a12ab36563ec2b7cf93f208a54
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36575
This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.
D23670779 addedd a previous mechanism to add spans for measurement caching, like we needed to do as part of this change. It is called in more specific cases (e.g. when there is a text hint but no text), but it edits the live EditText spannable instead of the cache copy, and does not handle nested text at all.
We are already adding spans back to the input after this, behind everything else, and can replace it with the code we have been adding.
Changelog:
[Android][Fixed] - Mimimize EditText Spans 9/9: Remove `addSpansForMeasurement()`
Reviewed By: javache
Differential Revision: D44298159
fbshipit-source-id: 1af44a39de7550b7e66e45db9ebc3523ae9ff002
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36634
X-link: https://github.com/facebook/metro/pull/957
The existential type `*` has been deprecated and just an alias for `any` since version 0.163. Codemod usage of it to `any`.
This helps with diff D44276187, which makes it always an error to use `*`.
Changelog: [internal]
Reviewed By: pieterv, SamChou19815
Differential Revision: D44358809
fbshipit-source-id: c6bb55430edd086958e16989c60bc2a0a131a3fe
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36577
This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.
This change allows us to strip CustomStyleSpan. We already set all but `fontVariant` on the underlying EditText, so we just need to route that through as well.
Note that because this span is non-parcelable, it is seemingly not subject to the buggy behavior on Samsung devices of infinitely cloning the spans, but non-parcelable spans have different issues on the devices (they disappear), so moving `fontVariant` to the top-level makes sense here.
Changelog:
[Android][Fixed] - Minimize EditText Spans 8/N: CustomStyleSpan
Reviewed By: javache
Differential Revision: D44297384
fbshipit-source-id: ed4c000e961dd456a2a8f4397e27c23a87defb6e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36576
This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.
This change addresses some minor CR feedback and removes the temporary list of spans in favor of applying them directly.
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D44295190
fbshipit-source-id: bd784e2c514301d45d0bacd8ee6de5c512fc565c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36548
This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.
This change lets us set `letterSpacing` on the EditText instead of using our custom span.
Changelog:
[Android][Fixed] - Minimize EditText Spans 6/N: letterSpacing
Reviewed By: rshest
Differential Revision: D44240777
fbshipit-source-id: 9bd10c3261257037d8cacf37971011aaa94d1a77
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36544
This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.
This change makes us apply strikethrough and underline as paint flags to the underlying EditText, instead of just the spans. We then opt ReactUnderlineSpan and ReactStrikethroughSpan into being strippable.
This does actually create visual behavior changes, where child text will inherit any underline or strikethrough of the root EditText (including if the child specifies `textDecorationLine: "none"`. The new behavior is consistent with both iOS and web though, so it seems like more of a bugfix than a regression.
Changelog:
[Android][Fixed] - Minimize Spans 5/N: Strikethrough and Underline
Reviewed By: rshest
Differential Revision: D44240778
fbshipit-source-id: d564dfc0121057a5e3b09bb71b8f5662e28be17e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36545
This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.
This adds ReactForegroundColorSpan to the list of spans eligible to be stripped.
Changelog:
[Android][Fixed] - Minimize Spans 4/N: ReactForegroundColorSpan
Reviewed By: javache
Differential Revision: D44240780
fbshipit-source-id: d86939cc2d7ed9116a4167026c7d48928fc51757
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36547
This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.
This adds `ReactBackgroundColorSpan` to the list of spans eligible to be stripped.
Changelog:
[Android][Fixed] - Minimize Spans 3/N: ReactBackgroundColorSpan
Reviewed By: javache
Differential Revision: D44240782
fbshipit-source-id: 2ded1a1687a41cf6d5f83e89ffadd2d932089969
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36546
This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.
This change generalizes `stripAttributeEquivalentSpans()` to allow plugging in different spans.
Changelog:
[Internal]
Reviewed By: rshest
Differential Revision: D44240781
fbshipit-source-id: 89005266020f216368e9ad9ce382699bd8db85a8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36543
This is part of a series of changes to minimize the number of spans committed to EditText, as a mitigation for platform issues on Samsung devices. See this [GitHub thread]( https://github.com/facebook/react-native/issues/35936#issuecomment-1411437789) for greater context on the platform behavior.
We cache the backing EditText span on text change to later measure. To measure outside of a TextInput we need to restore any spans we removed. Spans may overlap, so base attributes should be behind everything else.
The logic here for dealing with precedence is incorrect, and we should instead accomplish this by twiddling with the `SPAN_PRIORITY` bits.
Changelog:
[Android][Fixed] - Minimize Spans 1/N: Fix precedence
Reviewed By: javache
Differential Revision: D44240779
fbshipit-source-id: f731b353587888faad946b8cf1e868095cdeced3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36621
After D44302691 enabled textShadow, there was a subtle 1px shadow on any new text which I did't spot, but screenshot tests did (after commit which is non-ideal, but there is more work to make these land blocking).
This is because unlike `ReactBaseTextShadowNode` in paper which defaults to a radius of zero (no shadow), `TextAttributes` in Fabric defaults to a radius of 1px. Just previously never displayed.
Without shadow:
https://pxl.cl/2z2wX
With shadow:
https://pxl.cl/2z2x0
This changes the default to zero, which will cause us to skip adding the span, and matches previous behavior in Paper.
I double-checked the other props are defaulted the same way between `BaseTextShadowNode` (Paper) and `TextAttributes` (Fabric).
Changelog:
[Android][Fixed] - Fix default shadow radius in TextAttributeProps
Reviewed By: javache
Differential Revision: D44364446
fbshipit-source-id: d207367608291048001403d292f881c0842113f9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36585
1. We don't add `ShadowStyleSpan` unless an offset is set. This is incorrect, and less permissive than `BaseTextShadowNode` in Paper.
2. We don't serialize textShadowOffset to MapBuffer
Changelog:
[Android][Fixed] - Fix textShadow on Android Fabric
Reviewed By: javache
Differential Revision: D44302691
fbshipit-source-id: 2cfd3bff3d0e4f329c98d1ed2defff94ad3b7dc3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36582
This change should fix the path to run packager.sh directly from Xcode, this was broken after the Monorepo work.
## Changelog:
[internal] - update path to run packager.sh
Reviewed By: huntie, hoxyq
Differential Revision: D44292167
fbshipit-source-id: 90e0291aa7a15189c72cae99c5d38c84c7243a80
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36609
Some random cleanup as I prepare to make these classes a better injection point for future experiments.
* Forward-declare classes where possible to reduce header import
* Return references to shared_ptr instead of copies when there are no lifetime concerns
* Use a shared JClass instance in JFabricUIManager
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D44221018
fbshipit-source-id: 1660cac964abd10ce798473e26841503430efdfe
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36581
Found that the current codegen did not properly handle a return type of `?bool` because the branch of `constexpr (is_optional_v<T>)` assumed that T was always a JSI value that needed conversion, and `supportsToJs<bool, bool>` is false.
Changelog: [General][Fixed] Issue with TurboModule C++ codegen with optional return types
Reviewed By: christophpurrer
Differential Revision: D44302352
fbshipit-source-id: 0863de06da4e5e3c18f8a1ced7179d76d8e87b99
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36571
Changelog: [Internal]
The problem is related to the way we use `js_srcs_dir` & `output_dir` options, one requires just relative path from current ruby script, other requires relative path from iOS root project (where the Podfile located)
output_dir was introduced in D43304641
resulted into the issue, described in https://discord.com/channels/514829729862516747/1087736932953509958
allow-large-files
Reviewed By: cipolleschi
Differential Revision: D44294112
fbshipit-source-id: 47fcf510e203d0880e1f92ab6ead09f4b79cb4dd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36570
I'm doing some preparations to implement this proposal to bring some DOM APIs to React Native refs: https://github.com/react-native-community/discussions-and-proposals/pull/607
To make it easier to iterate on the proposal, and to improve the separation of concerns between React and React Native, I'm moving the definition of `ReactFabricHostComponent` (the public instance provided by React when using refs on host conmponents) to the `react-native` package.
I already did some steps in the React repository to simplify this:
* Removing unused imperative events that caused increased coupling: https://github.com/facebook/react/pull/26282
* Extracting the definition of the public instance to a separate module: https://github.com/facebook/react/pull/26291
In this case, in order to be able to move the definition from React to React Native, we need to:
1. Create the definition in React Native and export it through `ReactNativePrivateInterface`.
2. Update React to use that definition instead of the one in its own module.
This diff implements the first step.
`ReactNativeAttributePayload` is required by this definition and by the one for Paper that still exists in React. I moved it here so we only define it where we use it when we remove Paper. Paper will access it through `ReactNativePrivateInterface` as well. That will also allow us to remove a few other fields in that interface.
Changelog: [Internal]
bypass-github-export-checks
Reviewed By: yungsters
Differential Revision: D43772356
fbshipit-source-id: 78dac152f415f19316ec90887127bf9861fe3110
Summary:
Changelog: [General][Removed] Remove experimental support for loading bytecode from Metro
Removes the experimental bundling strategy that offloads Hermes bytecode compilation to the packager server. The React Native parts of this experiment were never part of the public API, and the Metro parts never fully shipped in open source.
Followup from D43597007.
Reviewed By: robhogan
Differential Revision: D43604705
fbshipit-source-id: db3be553750ccbf286d876f75858299c5b750f19
Summary:
Changelog: [General][Removed] Remove internal DevSplitBundleLoader native module
`DevSplitBundleLoader` was part of an experimental bundling strategy that offloaded Hermes bytecode compilation to the packager server. The React Native parts of this experiment were never part of the public API, and the Metro parts never fully shipped in open source.
As part of implementing the simpler and more general [lazy bundling RFC](https://github.com/react-native-community/discussions-and-proposals/pull/605), we are removing `DevSplitBundleLoader` and associated code from React Native's internals.
Reviewed By: robhogan
Differential Revision: D43597007
fbshipit-source-id: 1460e9045cd7a0f5ef43144b10afb932172e223c
Summary:
We made some changes to the new instance format, so need to adapt this again after D43980374.
The previous format was never synced so we don't need to keep compatibility.
Changelog: [internal]
Reviewed By: javache
Differential Revision: D44137324
fbshipit-source-id: bb08141674e2385934772f241acb863f9050b671
Summary:
Changelog: [Internal]
React Native requires React 18 which includes `useSyncExternalStore`, so we can remove the shim. It was only used in one place (`useColorScheme`).
Reviewed By: motiz88
Differential Revision: D44163914
fbshipit-source-id: 3a94466b3d5ae8aa43e9236acb8c92fbefd04180