Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48054
Web debugging should be fully removed as of recent, so lets remove some of the gunk that was powering it, and checks for that environment.
I did some string searches for the following:
* isAsyncDebugging
* debugRemotely
* isDebuggingRemotely
* isRemoteDebuggingAvailable
* WebSocketExecutor
* JavaJSExecutor
* ProxyJavaScriptExecutor
* RELOAD_APP_EXTRA_JS_PROXY
* getJSBundleURLForRemoteDebugging
* onReloadWithJSDebugger
* setRemoteJSDebugEnabled
* WebsocketJavaScriptExecutor
* createRemoteDebuggerBundleLoader
1. `expo-modules-core` exposes its own `isAsyncDebugging` by checking for `nativeCallSyncHook`, but does not depend on `DebugEnvironment`.
2. `expo-dev-menu` does read `isDebuggingRemotely` from `DevSettings`.
3. Realm does a check in Native using `objc_lookUpClass("RCTWebSocketExecutor")` but will gracefully handle `nil` if it does not exist
4. Some more usages (e.g. `onReloadWithJSDebugger`) in vendored packages of `expo-dev-launcher` for RN 0.74
I created an issue for Expo mentioning both here: https://github.com/expo/expo/issues/33371
Changelog:
[General][Breaking] - Remove some web debugging remnants
Reviewed By: huntie
Differential Revision: D66553934
fbshipit-source-id: deec382b1c8bda393fddb8682aa91b26afd9fbe3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48913
This brings us to parity with normalize-color, and is mostly similar to hsl, with the notable exception there is not a separate alpha variant, and only modern function syntax is supported. Again, I took the math from normalize-color, and sanity tested it against reference function provided by Color Spec.
I'm going to let that cap off color function support for now, and leave the rest as TODO.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D68594471
fbshipit-source-id: 95702d576e068655d34e52a714d38e4fd718bbc9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48912
The implementation of `hwb()` color functions added in https://github.com/facebook/react-native/pull/34600 is pretty flawed.
`hwb()` color functions do not allow comma delimited values. So most of the examples in the unit test here will fail to parse on web. Like `hsl()`, these should also allow numeric non-hue components (instead of just %), and angle values for hue (instead of just numbers), and this is also missing support for alpha values, though these are less dangerous compared to allowing and encouraging incorrect delimiters.
https://www.w3.org/TR/css-color-4/#the-hwb-notation
These were added for web compat, and the examples fail to parse on web, so I'm opting to just remove this incorrect support before implementing this more correctly in the Fabric CSS parser in next diff. I did not attempt to fix the other issues I discovered with the PR implementation in the last couple diffs, around mixing and matching syntax allowed in legacy/modern, along with allowing inconsistent delimiters.
Changelog:
[General][Breaking] - Remove incorrect hwb() syntax support from normalize-color
Reviewed By: lenaic
Differential Revision: D68591172
fbshipit-source-id: 36d670b096ae9fac4bc24938877ad083d4dd336a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48878
Creates a new `scheduleAnimatedCleanupInMicrotask` feature flag to experiment with deferring the `AnimatedProps` cleanup using the microtask queue.
This is different from the previous approach of deferring invocation of the completion callback, which impacted the timing of composite animations such as `Animated.parallel` and `Animated.sequence`, because we are deferring detaching the `AnimatedNode` graph instead. This will only impact the timing of completion callbacks as a result of invalidating `AnimatedProps` (either by passing in new `AnimatedValue` instances or unmounting the component).
This should minimally impact scheduling and have lower risk of user-visible behavior change because React already provides minimal guarantees around when updates are committed (and effects attached/detached).
This also enables us to significantly simplify the current convoluted dance we do to optimized around reference counting in the AnimatedNode graph.
Changelog:
[General][Changed] - When an Animated component is updated or unmounted, `AnimatedNode` instances will now detach in a microtask instead of synchronously in the commit phase of React. This will cause the completion callback of finished animations to execute after the commit phase instead of during it.
Reviewed By: rickhanlonii
Differential Revision: D68527096
fbshipit-source-id: 99346b8ddbf6a01725376c692b0351be679b9e89
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48975
After cutting 0.78-stable, we need to bump the monorepo packages to `0.79.0-main`
## Changelog:
[Internal] - Bump monorepo packages to `0.79.0-main`
Reviewed By: cortinico, huntie
Differential Revision: D68715005
fbshipit-source-id: cb5abbf05e8638683687be8d61d66b3037111572
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48973
changelog: [internal]
This test is broken, let's disable it until it is fixed.
Reviewed By: javache
Differential Revision: D68709385
fbshipit-source-id: f61b287ad7ef921dd26fa290cc7a484d0b550091
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48968
I've noticed we have a lot of `public` and `protected` modifiers for classes that are actually `internal`.
Those are unnecessary as the class itself is `internal` and there is no way to extend the visibility of single fields.
Changelog:
[Internal] [Changed] -
Reviewed By: mdvacca
Differential Revision: D68707255
fbshipit-source-id: 5b93d01dceba1b5031ac608e58ec898c1a1eaf51
Summary:
We've noticed that the HMR on Android doesn't seem to be connecting when using a HTTPS-proxied Metro instance, where the proxy is hosted through Cloudflare. This is only an issue on Android - not iOS - and likely caused by the HMR Client not being set up properly on Android.
- On Android, we run `.setup('android', <bundleEntryPath>, <proxiedMetroHost>, <proxiedMetroPort>, <hmrEnabled>)` in the [**react/devsupport/DevSupportManagerBase.java**](https://github.com/facebook/react-native/blob/53d94c3abe3fcd2168b512652bc0169956bffa39/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/DevSupportManagerBase.java#L689-L691) file.
- On iOS, we run `[self.callableJSModules invokeModule:@"HMRClient" method:@"setup" withArgs:@[ RCTPlatformName, path, host, RCTNullIfNil(port), @(isHotLoadingEnabled), scheme ]];` in the [**React/CoreModules
/RCTDevSettings.mm**](https://github.com/facebook/react-native/blob/53d94c3abe3fcd2168b512652bc0169956bffa39/packages/react-native/React/CoreModules/RCTDevSettings.mm#L488-L491) file.
Notice how Android does not pass in the scheme/protocol of the bundle URL, while iOS actually does? Unfortunately, because the default protocol (`http`) mismatches on Android when using HTTPS proxies, we actually try to connect the HMR client over `http` instead of `https` - which is rejected by Cloudflare's infrastructure even before we can redirect or mitigate this issue.
This change adds scheme propagation to Android, exactly like we do on iOS for the HMR Client.
## Changelog:
[ANDROID] [FIXED] Pass the bundle URL protocol when setting up HMR client on Android
<!-- 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/48970
Test Plan: It's a little bit hard to test this out yourself, since you'd need a HTTPS-based proxy and reject HTTP connections for HTTPS/WSS Websocket requests.
Reviewed By: fabriziocucci
Differential Revision: D68711137
Pulled By: javache
fbshipit-source-id: 230c1c91c8189c0a109d20defe085966ac8f5721
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48922
Changelog: [internal]
This is a basic subclass of Event that allows setting custom values (as opposed to `Event` that is meant to be used as a superclass).
Reviewed By: yungsters
Differential Revision: D67804060
fbshipit-source-id: 9e140cc436f8e230f37275a74df23efd4841071b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48962
Changelog: [internal]
We moved away from private fields for `EventTarget` for performance, in favor of normal fields prefixed with underscore, but this would pollute the global scope when we make it extend `EventTarget`.
This refactors the implementation to use symbols for all properties to avoid that problem, leaving only `addEventListener` and `removeEventListener` as regular properties in the prototype.
Performance-wise this is neutral or a slight improvement according to the existing benchmark.
Reviewed By: javache
Differential Revision: D68672215
fbshipit-source-id: b329548efce6059ae2b9f33afa0719e057d3b8ba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48918
Changelog: [internal]
Makes the constants read-only and accessible through `Event.prototype` as well.
Reviewed By: yungsters
Differential Revision: D67830012
fbshipit-source-id: 730622a642f08f532cebd4c183d859ccb2ca0641
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48426
Changelog: [internal]
This improves the performance of DOM `Event` interface implementation by migrating away from private fields.
Reviewed By: yungsters
Differential Revision: D67751821
fbshipit-source-id: e58e5a9cbb04e7d91cbc676ec7d1b00fff357e2e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48427
Changelog: [internal]
The `ReactNativeElement` class was refactored for performance reasons, and the current implementation does **NOT** call `super()`, and it inlines the parent constructor instead.
When it eventually extends `EventTarget`, things won't work as expected because the existing `EventTarget` implementation has constructor dependencies.
This refactors the current implementation of `EventTarget` to eliminate those constructor side-effects, and eliminates the constructor altogether.
This breaks encapsulation, but it has some positive side-effects on performance:
1. Creating `EventTarget` instances is faster because it has no constructor logic.
2. Improves memory by not creating maps to hold the event listeners if no event listeners are ever added to the target (which is very common).
3. Improves the overall runtime performance of the methods in the class by migrating away from private methods (which are known to be slow on the babel transpiled version we're currently using).
Extra: it also simplifies making window/the global scope implement the EventTarget interface :)
## Benchmark results
Before:
| Latency average (ns) | Latency median (ns) | Samples | Task name | Throughput average (ops/s) | Throughput median (ops/s) |
| ---|--- |--- |--- |---|---|
| 8234.22 ± 0.27% | 8132.00 | 121445 | dispatchEvent, no bubbling, no listeners | 122323 ± 0.02% | 122971 |
| 9001.22 ± 0.41% | 8883.00 | 111097 | dispatchEvent, no bubbling, single listener | 111981 ± 0.02% | 112575 |
| 51777.94 ± 0.58% | 51247.00 | 19314 | dispatchEvent, no bubbling, multiple listeners | 19393 ± 0.04% | 19513 |
| 8256.65 ± 0.29% | 8152.00 | 121115 | dispatchEvent, bubbling, no listeners | 122031 ± 0.02% | 122669 |
| 9064.32 ± 0.44% | 8933.00 | 110323 | dispatchEvent, bubbling, single listener per target | 111265 ± 0.02% | 111944 |
| 51879.66 ± 0.27% | 51447.00 | 19276 | dispatchEvent, bubbling, multiple listeners per target | 19325 ± 0.04% | 19437 |
After:
| Latency average (ns) | Latency median (ns) | Samples | Task name | Throughput average (ops/s) | Throughput median (ops/s)|
| ---------------------|---------------------|---------|--------------------------------------------------------|----------------------------|--------------------------|
| 5664.62 ± 0.50% | 5588.00 | 176535 | dispatchEvent, no bubbling, no listeners | 178219 ± 0.02% | 178955 |
| 7232.86 ± 0.50% | 7131.00 | 138258 | dispatchEvent, no bubbling, single listener | 139540 ± 0.02% | 140233 |
| 50957.51 ± 0.71% | 50336.00 | 19625 | dispatchEvent, no bubbling, multiple listeners | 19751 ± 0.04% | 19866 |
| 5692.36 ± 0.50% | 5618.00 | 175675 | dispatchEvent, bubbling, no listeners | 177315 ± 0.02% | 177999 |
| 7277.82 ± 0.38% | 7181.00 | 137404 | dispatchEvent, bubbling, single listener per target | 138560 ± 0.02% | 139256 |
| 50493.64 ± 0.28% | 50105.00 | 19805 | dispatchEvent, bubbling, multiple listeners per target | 19855 ± 0.04% | 19958 |
Reviewed By: yungsters
Differential Revision: D67758408
fbshipit-source-id: f8da1788251c9e21377de5ab730875bcc7610361
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48431
Changelog: [internal]
Adds a regression test to make sure we implement the correct spec-compliant behavior for a possible bug in ~~the Web spec~~ __Chrome__: https://github.com/whatwg/dom/issues/1346
Edit: the bug is in the Chrome implementation, not in the spec.
Reviewed By: javache
Differential Revision: D67758702
fbshipit-source-id: ecaeacac3bce286e692880f05d70297ba0c2c736
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48429
Changelog: [internal]
This implements a (mostly) spec-compliant version of the [`Event`](https://dom.spec.whatwg.org/#interface-event) and [`EventTarget`](https://dom.spec.whatwg.org/#interface-eventtarget) Web interfaces.
It does not implement legacy methods in either of the interfaces, and ignores the parts of the spec that are related to Web-specific quirks (shadow roots, re-mapping of animation events with webkit prefixes, etc.).
IMPORTANT: This only creates the interfaces and does not expose them externally yet (no `Event` or `EventTarget` in the global scope).
Reviewed By: yungsters
Differential Revision: D67738145
fbshipit-source-id: c86db29821552cc1a1b6e1023cc3a21ae55febd5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48965
Running codegen should not be a Cocoapods responsibilities, but it should be something that runs before Cocoapods to ensure that the code is already in the right place.
This change moves the invocation of Codegen to the react-native's core-cli-utils so that frameworks can integrate better with it.
It should also make it easier to migrate away from Cocoapods.
## Changelog:
[iOS][Changed] - Invoke Codegen as part of the Core-cli-utils package
Reviewed By: cortinico
Differential Revision: D68706136
fbshipit-source-id: 548c9ffad62bc561fcc948babaf75de5dad82f86
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48966
In our previous fix for concurrent-ruby, we have been a bit too strict. Version 1.3.4 is a valid and working version. The broken version is 1.3.5.
## Changelog:
[iOS][Changed] - Fix Gemfile versions
Reviewed By: cortinico
Differential Revision: D68706060
fbshipit-source-id: 8ab7a4df0eb83a82603729ff8460e64908ddc465
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48961
One of Cocoapods responsibility is to run Codegen while creating the Xcode workspace. Moving away from Cocoapods, this is a step we need to move to a different place.
This change let us to disable running codegen at cocoapods time when we pass the `RCT_SKIP_CODEGEN=1` or when we pass the `RCT_IGNORE_PODS_DEPRECATION=1` flag calling pod install.
When calling `pod install` with `RCT_IGNORE_PODS_DEPRECATION` we are either:
* using one of the Scripts provided by Expo or by the Community CLI
*or*
* we are preparing the project using the legacy mode and, therefore, we want to keep running codegen.
## Changelog
[iOS][Changed] - Stop running codegen when running pod install
Reviewed By: cortinico
Differential Revision: D68704604
fbshipit-source-id: 252e90544886c3dbfd7eff38c344dd4784a0af38
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48960
We are moving away from Cocoapods toward alternative solution.
We are adding this deprecation message to help inform our users that this change is happening.
Part of the Cocoapods tasks will be moved to an alternative script that will be invoked by Expo and by the Community CLI. The warning message tells the users what to do as an alternative to `pod install`.
## Changelog:
[iOS][Deprecated] - deprecate calling `pod install` directly
Reviewed By: cortinico
Differential Revision: D68704127
fbshipit-source-id: df93008afc055254d0c0da09566c84af99248310
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48933
## Motivation
Modernising the react-native codebase to allow for ingestion by modern Flow tooling
## This diff
- Updates files in Libraries/Interaction to use `export` syntax
- Appends `.default` to requires of the changed files.
- Updates the public API snapshot (intented breaking change)
Changelog:
[General][Breaking] - Files inside `Libraries/Interaction` use `export` syntax, which requires the addition of `.default` when imported with the CJS `require` syntax.
Reviewed By: huntie
Differential Revision: D68629953
fbshipit-source-id: 526b18d9b64c4b27b6e3198a9725075fa11e345a
Summary:
Changelog: [General][Fixed] Update tests to support new `didOpen` delegate fn
Add support for the new `didOpen` delegate function in tests.
To follow up separately: the borked tear down sequence when these two tests are ran together (they pass when ran individually)
```
buck2 test @//fbobjc/mode/buck2/ios-tests fbsource//xplat/js/react-native-github/packages/react-native/ReactCommon/jsinspector-modern:testsAppleMac -- ReactInstanceIntegrationTest RuntimeTargetDebuggerSessionObserverTest
```
Reviewed By: hoxyq
Differential Revision: D68632974
fbshipit-source-id: 59da6d9e2d09f2c7e219c1902dd6f9b8ddfee9dc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48943
changelog: [internal]
A new helper function on Fantom flushAllNativeEvents, which will flush all pending native events.
Reviewed By: javache
Differential Revision: D68566753
fbshipit-source-id: 6cb19416e39807b9b381ff068cea5c2458101174
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48907
changelog: [internal]
Introduce new function `Fantom.scrollTo`, which will fake a scroll to particular position.
Calling the method will call onScroll event using codepath that iOS uses. It will also set C++ state so the new scroll position is observable from JavaScript.
Reviewed By: javache
Differential Revision: D68554703
fbshipit-source-id: 2fc71e96836a03ec343053ceed85764c4bc2f5c7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48917
Cleaning up this flag which has already been rolled out
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D68622852
fbshipit-source-id: 5767515d02ce9804976a1363532e1e626aeae0d8
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48916
Cleaning up this feature flag since we no longer require this gating. This was already fulled rulled out as default.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D68621578
fbshipit-source-id: 3fd3ad007b8beb8e2525ffa7b4da372be1dbbd94
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48877
This is a minor refactor to hoist logic that is not actually specific to the `AnimatedProps` lifecycle out of the hook named `useAnimatedPropsLifecycle`.
This will make it easier to iterate on the implementation of `useAnimatedPropsLifecycle` using a feature flag in a subsequent diff.
This has no behavior change.
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D68516034
fbshipit-source-id: 2cd6d9b0f2a5c0ada10cf01c8c14ed5510fbf25a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48919
I suspect this class is unused and we should not be building it.
The same `AndroidUnicodeUtils.java` is provided by facebook/hermes instead.
Changelog:
[Internal] [Changed] -
Reviewed By: tdn120, mdvacca
Differential Revision: D68623307
fbshipit-source-id: 0a290d31e3b1103947a9dd3c46821958be9223e7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48665
## Motivation
Modernising the react-native codebase to allow for ingestion by modern Flow tooling
## This diff
- Updates files in Libraries/Utilities to use `export` syntax
- `export default` for qualified objects, many `export` statements for collections (determined by how it's imported)
- Appends `.default` to requires of the changed files.
- Updates Jest mocks of the `Platform` module, which happened to touch a lot of test files.
- Updates the public API snapshot (intented breaking change)
Changelog:
[General][Breaking] - Files inside `Libraries/Utilities` use `export` syntax, which requires the addition of `.default` when imported with the CJS `require` syntax.
Reviewed By: huntie
Differential Revision: D68152910
fbshipit-source-id: 07f3a0957f1dbaf44f53974c6f28b273558406eb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48901
## Motivation
Modernising the react-native codebase to allow for ingestion by modern Flow tooling.
## This diff
- Updates files in `Libraries/Text`, `Libraries/Share` and `Libraries/Settings` to use `export` syntax.
- Appends `.default` to requires of the changed files.
- Updates test files.
- Updates the public API snapshot *(intented breaking change)*
Changelog:
[General][Breaking] - Files inside `Libraries/Text`, `Libraries/Share` and `Libraries/Settings` use `export` syntax, which requires the addition of `.default` when imported with the CJS `require` syntax.
Reviewed By: huntie
Differential Revision: D68562844
fbshipit-source-id: bd71a341e33d3629121aa61549139c4b1cd62c3f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48926
# Changelog: [Internal]
Leverage [`devtools` field](https://developer.chrome.com/docs/devtools/performance/extension#devtools_object) inside [`detail` object](https://developer.mozilla.org/en-US/docs/Web/API/Performance/measure#detail) to make extension tracks work.
Right now we are only specifying track name, later we could use many more fields:
```
interface ExtensionTrackEntryPayload {
dataType?: "track-entry"; // Defaults to "track-entry"
color?: DevToolsColor; // Defaults to "primary"
track: string; // Required: Name of the custom track
trackGroup?: string; // Optional: Group for organizing tracks
properties?: [string, string][]; // Key-value pairs for detailed view
tooltipText?: string; // Short description for tooltip
}
```
In the next few diffs I will extend the spec of the local implementation for `performance.measure` and `performance.mark` to get this propagated correctly.
Reviewed By: huntie
Differential Revision: D68624603
fbshipit-source-id: 99a5d233ee1dbcd690ad8a6802ca993071f63f2c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48923
# Changelog: [Internal]
Starting from this diff, React Native will emit inspector traces, the ones that will have the same UI as if it was recorded in a browser.
We are going to fake it by sending "TracingStartedInPage" event. For a corresponding logic on Chrome DevTools Frontend side, see [this](https://github.com/ChromeDevTools/devtools-frontend/blob/192673131cf3e6e0bcdb4a97bd0bd39c75f1b3c2/front_end/models/trace/handlers/MetaHandler.ts#L68-L80) as a starting point.
Because of this, custom tracks are now grouped under "Timings" track, although with a better color scheme:
- We no longer need the logic for placing tracks under arbitrary thread ids to have them grouped.
- The real support for extension tracks (custom tracks for Performance panel) will be added in the next diff.
Reviewed By: huntie
Differential Revision: D68439734
fbshipit-source-id: 8e5c525a71578375904edc6d473308eb710b5867