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
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48927
changelog: [internal]
Remove explicit calls to root.destroy() in favour of automated system that will call it and check for memory leaks.
Reviewed By: rubennorte
Differential Revision: D68624917
fbshipit-source-id: 44be1dee9a56ec31bea5a9eefdda086a4cb4248f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48889
## Motivation
Modernising the react-native codebase to allow for ingestion by modern Flow tooling.
## This diff
- Updates files in `Libraries/Core` to use `export` syntax
- `export default` for qualified objects, many `export` statements for collections
- Appends `.default` to requires of the changed files.
- Changed `* as ExceptionsManager` to `ExceptionsManager` in import statements throughout product code.
- Updates test files.
- Updates the public API snapshot (intented breaking change)
Changelog:
[General][Breaking] - Files inside `Libraries/Core` use `export` syntax, which requires the addition of `.default` when imported with the CJS `require` syntax.
[General][Breaking] - `Libraries/Core/ExceptionsManager` now exports a default `ExceptionsManager` object, and `SyntheticError` as a secondary export.
Reviewed By: huntie
Differential Revision: D68553694
fbshipit-source-id: 51c9a404b2762cb1cdb5f56cae3a683ccdfffc7f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48854
Changelog: [internal]
Moves the internals to access instance handle and shadow node from public instances from `ReadOnlyNode` to `NodeInternals` so it's more obvious when people are reaching into internal APIs/state.
Reviewed By: javache
Differential Revision: D67654404
fbshipit-source-id: 1063bc9451eeacb79af34614df3be02466f93fa3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48795
# Changelog: [Internal]
Splitting `PerformanceTracer::stopTracingAndCollectEvents()` into 2 separate methods.
Once we add logic for starting and stopping tracing on `InstanceAgent`:
- We would need to stop tracing everywhere synchronously
- Populate data sources in `PerformanceTracer`, like JavaScript samples
- Collect all events from different data sources in one payload via `PerformanceTracer::collectEvents()`
Reviewed By: huntie
Differential Revision: D68331485
fbshipit-source-id: 0d6b21a522d841f7f734e2fad2e0fc533097fdee
Summary:
On older Android versions clipping doesn't have anti-aliasing by default which means that clipping with no border will always make the background not have anti-aliasing.
This is fixed by default on new Background and Border drawables since rendering logic is separated
Moving the clipping logic so it only runs when we have a border.
https://github.com/facebook/react-native/issues/41226
Changelog: [Android] [Fixed] - Fixed anti-aliasing not showing on older Android versions
Reviewed By: javache
Differential Revision: D68279400
fbshipit-source-id: e2383c71bd1ca89f66f42630b3712bb4cc5cd7ac
Summary:
This was causing links to not ellipsize and be scrollable. Gonna revert while I see if I can workaround
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D68596950
fbshipit-source-id: 432a059d0b10acbb45d34e0c98763680d280937b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48872
enableDeletionOfUnmountedViews feature flag has been enabled for 4 months with no errors on production, also it's been enabled in OSS since 0.76.
This diff removes the feature flag and fully rollout this fix
bypass-github-export-checks
changelog: [internal] internal
Reviewed By: sammy-SC
Differential Revision: D68511227
fbshipit-source-id: a42481c57aaab2e8c45b952af5e044bf60740df3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48843
Adds support for hsl() and hsla() funtions. This supports more modern syntax options than normalize-color, like number components, optional alpha, and fills in missing support for angle units. The underlying math was lifted pretty much directly from normalize-color though.
An aside, std::remainder for these is not guaranteed to be constexpr, but Clang is still okay with rgb function parsing to be contexpr because we never try to evaluate non-constexpr function?
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D68473990
fbshipit-source-id: 2a71d8367b22f9d1ba6a66598d40ef2683847704
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48842
This is a result of inlining isinf previously but we can never be negative infinity because we can never be less than zero.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D68474836
fbshipit-source-id: bfce78c4bd269ff2afac99c03250ede676ee1029
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48841
Right now during parsing we can ask for a next component value, with a delimeter, and even if we don't have a component value to consume, we will consume the delimeter.
This is kind of awkward since e.g. trailing comma can be consumed, then we think syntax is valid. Let's try changing this.
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D68474739
fbshipit-source-id: 47a942681bc8472ca28470eba821d4d95306ae5d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48839
In the last diff I mixed and matched `<legacy-rgb-syntax>` and `<modern-rgb-syntax>` a bit to keep compatiblity with `normalze-color`.
Spec noncompliant values have only been allowed since https://github.com/facebook/react-native/pull/34600 with the main issue being that legacy syntax rgb functions are allowed to use the `/` based alpha syntax, and commas can be mixed with whitespace. This seems like an exceedingly rare real-world scenario (there are currently zero usages of slash syntax in RKJSModules validated by `rgb\([^\)]*/`), so I'm going to instead just follow the spec for more sanity.
Another bit that I missed was that modern RGB functions allow individual components to be `<percentage>` or `<number>` compared to legacy functions which only allow the full function to accept one or the other (`normalize-color` doesn't support `<percentage>` at all), so I fixed that as well.
I started sharing a little bit more of the logic here, to make things more readable when adding more functions.
Changelog: [Internal]
Reviewed By: javache
Differential Revision: D68468275
fbshipit-source-id: f1dfab51b91a3f64436c2559daa3d1e8891db889
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48828
1. Rename `CSSComponentValueDelimeter` to `CSSDelimeter` bc the names are getting way too long.
2. Make the distinction between `Whitespace` and `OptionalWhitespace`. Note that for property values, and function blocks, the value parser will already remove trailing/leading whitespace, but it's weird that whitespace unlike others was not required to be present
3. Add `CSSDelimeter::CommaOrWhitespaceOrSolidus` for simpler parsing in the common pattern of alpha values, and move CSSColor function parsing to use that
Changelog: [Internal]
Reviewed By: lenaic
Differential Revision: D68461968
fbshipit-source-id: 388056e47dfe6ca6003b44e82e00fe416706330b