Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48486
[Changelog] [Internal] - Add RuntimeSchedulerKey constant for RuntimeScheduler lookup
Similar to https://github.com/facebook/react-native/pull/48127 this adds a contant to avoid typos when inserting or retrieving the RuntimeScheduler
Reviewed By: rshest
Differential Revision: D67822346
fbshipit-source-id: af982c6d4b875ffde06aae8e953c4892754a074b
Summary:
**iOS** does offer a native property for **UITextField** called `inputAssistantItem`. According to the [documentation](https://developer.apple.com/documentation/uikit/uitextinputassistantitem), we can hide the **"shortcuts"** by setting the `leadingBarButtonGroups` and `trailingBarButtonGroups` properties to empty arrays.
I propose adding a new property for **TextInput** in **React Native**, which would set these native properties to empty arrays. This new property could be called `disableInputAssistant` or `disableKeyboardShortcuts` and would be a `boolean`.
Developers can manage this behavior (the redo & undo buttons and suggestions pop-up hiding) after applying these native props.
https://github.com/react-native-community/discussions-and-proposals/discussions/830
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
[IOS] [ADDED] - [TextInput] Integrate a new property - `disableKeyboardShortcuts`. It can disable the keyboard shortcuts on iPads.
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[IOS] [ADDED] - [TextInput] Integrate a new property - `disableKeyboardShortcuts`. It can disable the keyboard shortcuts on iPads.
Pull Request resolved: https://github.com/facebook/react-native/pull/47671
Test Plan:
Manual
1. Open TextInput examples.
2. Scroll down and reach the "Keyboard shortcuts" section.
3. Test each case.
Note: **TextInput** behaves the same as now when the new prop is not passed or is `false`.
https://github.com/user-attachments/assets/5e814516-9e6c-4495-9d46-8175425c4456
Reviewed By: javache
Differential Revision: D67451609
Pulled By: cipolleschi
fbshipit-source-id: 59ba3a5cc1644ed176420f82dc98232d88341c6e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48450
Changelog: [internal]
This implements a basic benchmark to compare `ReactFabricHostComponent` and `ReactNativeElement` (legacy and DOM implementations for native component instances).
Reviewed By: rshest
Differential Revision: D66698546
fbshipit-source-id: dd4bde833e5c9eb32c79a52d06f3c360fb012e23
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48451
Changelog: [internal]
Modifies the execution of benchmarks in CI to run benchmarks in test mode when they don't define a `verify` method.
If a benchmark uses `verify`, the test is meant to make sure that the benchmark doesn't regress in CI. If it doesn't, then running the benchmark on CI doesn't provide much value. In that case, we run a single iteration of each test case just to make sure things don't break over time.
Reviewed By: rshest
Differential Revision: D67637754
fbshipit-source-id: 33b78a9c809386cf2e040314b0427de6a53da3e3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48452
Changelog: [internal]
Implements a basic API to run benchmarks with Fantom (using `tinybench` under the hood):
```
import {benchmark} from 'react-native/fantom';
benchmark
.suite('Suite name', {
// options
})
.add(
'Test name',
() => {
// code to benchmark
},
{
beforeAll: () => {},
beforeEach: () => {},
afterEach: () => {},
afterAll: () => {},
},
)
.verify(results => {
// check results and throw an error if the expectations fail
});
```
Features:
* Print benchmark results in the console as a table.
* It opts into optimized builds automatically
* Verifies that optimized build is used (unless manually opting out of the check via `disableOptimizedBuildCheck`).
* Supports verification of results (making expectations and making the test fail if the benchmark doesn't meet some expectations).
Reviewed By: rshest
Differential Revision: D66926183
fbshipit-source-id: 61cfa7689ea7684eb870fbbc815b8d236a1871e6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48453
Changelog: [internal]
Adds tinybench 3.1.0 (which has support for sync execution) and defined Flow types for the package.
Reviewed By: dmytrorykun
Differential Revision: D66698545
fbshipit-source-id: faf44add74e5711ac0d50794ce3360eedc45f0a5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48454
Changelog: [internal]
This implements a native module for Fantom to provide information about the CPU time used by the current process. This will be used by Fantom as the clock to run benchmarks more accurately.
It provides 2 implementations:
1. One based on `clock_gettime` with `CLOCK_THREAD_CPUTIME_ID` that's available on Linux. This provides the CPU time for the current process with decent precision (tens of nanoseconds).
2. A fallback implementation that uses a monotonic clock (not actually CPU time).
We can add a MacOS equivalent in a following diff.
Reviewed By: rshest
Differential Revision: D67596312
fbshipit-source-id: dd712c0171aa998ddbb6fed9187b3c467cd5417d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48504
Following D67857739, fixes accidental change where the removed `ReactNativeFeatureFlags` flag read was not replaced with `true`. This temporarily disabled Fusebox on `main`, where not configured via other build flags.
{F1974195736}
Changelog: [Internal]
Reviewed By: robhogan
Differential Revision: D67857739
fbshipit-source-id: 2a6fb2e6733035245e7ad959c7d3c650a9fde994
Summary:
Currently the `AppStateModule` doesn't have any unit tests in the Android implementation. This should make it safer for future changes or refactors.
## Changelog:
[INTERNAL] - Add `AppStateModule` Android unit tests
Pull Request resolved: https://github.com/facebook/react-native/pull/48492
Test Plan:
```bash
yarn test-android
```
Reviewed By: cipolleschi
Differential Revision: D67857498
Pulled By: cortinico
fbshipit-source-id: f90ced1cf02ac12a3438495b425ce7931decf19a
Summary:
As a prerequisite of enabling running unit tests on CI again, this PR suggests changes needed to the Ruby unit tests.
I've added comments on the code below, justifying changes where I deem a justification might be needed.
For use internally, I suggest accessing the folly_config and boost_config directly via the `Helpers` class instead of the `get_folly_config` and `get_boost_config` because these global functions are defined in `react_native_pods` which would be result in circular requires. An alternative would be to move these global functions to a separate file.
## Changelog:
[INTERNAL] [FIXED] - Fix Ruby unit tests.
Pull Request resolved: https://github.com/facebook/react-native/pull/48498
Test Plan:
- `cd packages/react-native`
- `./scripts/run_ruby_tests.sh`
Reviewed By: rshest
Differential Revision: D67852809
Pulled By: cipolleschi
fbshipit-source-id: 54d8bd708a9e3fd9aef3569ac89ec6ddcd244437
Summary:
This PR updates podspecs and resolve the following Xcode warnings:
```
Run script build phase '[CP-User] [RN]Check rncore' will be run during every build because it does not specify any outputs. To address this issue, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase.
```
```
Run script build phase '[CP-User] [RN]Check FBReactNativeSpec' will be run during every build because it does not specify any outputs. To address this issue, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase.
```
Enabling the `always_out_of_date` flag will uncheck "Based on dependency analysis" in a script phase.
## Changelog:
[INTERNAL] [FIXED] - Resolve run script build phase warnings
Pull Request resolved: https://github.com/facebook/react-native/pull/48495
Test Plan:
1. Run `bundle exec pod install` in the RNTester folder
2. Open the Xcode workspace
3. Check "Based on dependency analysis" is unchecked in the '[CP-User] [RN]Check rncore' script phase and the '[CP-User] [RN]Check FBReactNativeSpec' script phase
Reviewed By: cipolleschi
Differential Revision: D67835376
Pulled By: rshest
fbshipit-source-id: 11eec80d8172bc0129bfdcf7c79b5edf40427fab
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48490
## Changelog:
[Internal] -
This makes the `RootViewTest` and `JSPointerDispatcher` tests to use mockito-kotlin instead of the Java Mockito, which is the legacy of the conversion of the corresponding tests from Java.
Which:
* is the right thing to do, as we have more Kotlin-idiomatic tests
* helps with some Kotlin conversion with classes under test down the line, as Kotlin Mockito handles things like nullability etc properly
Reviewed By: javache
Differential Revision: D67824679
fbshipit-source-id: 055e9c7c4a33164ce6f4b9a5c47f16051d2a132f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48469
This change downloads the generated artifact and uses it in the E2E tests
## Context
While looking at the recent failures of the E2E tests, I realized that the Hermes, NewArch, Debug variant often fails to build, not to test, for some misconfiguration.
I also realized that we are already building that varaint successfully once, so why not reuse it? To reuse prebuilds, we need a few steps:
1. make sure we build all the variants we need
2. store the .app file as an artifact
3. download the artifact and use it in the E2E tests
## Changelog:
[Internal] - Build release variant for RNTester
Reviewed By: mdvacca
Differential Revision: D67800932
fbshipit-source-id: 6f3c8bbc42ad95cabab85dafff00e233a936d136
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48444
While debugging why the Debug variant was failing, I realised that the code to store video artifacts and the code to record the videos were not working properly.
This diff fixes that
## Context
While looking at the recent failures of the E2E tests, I realized that the Hermes, NewArch, Debug variant often fails to build, not to test, for some misconfiguration.
I also realized that we are already building that varaint successfully once, so why not reuse it? To reuse prebuilds, we need a few steps:
1. make sure we build all the variants we need
2. store the .app file as an artifact
3. download the artifact and use it in the E2E tests
## Changelog:
[Internal] - Build release variant for RNTester
Reviewed By: mdvacca
Differential Revision: D67760436
fbshipit-source-id: ee4b034f7c54cbf0b46c0afc16c31389b11353fe
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48442
This change stores the RNTester `.app` in an artifact so that E2E tests can reuse it.
## Context
While looking at the recent failures of the E2E tests, I realized that the Hermes, NewArch, Debug variant often fails to build, not to test, for some misconfiguration.
I also realized that we are already building that varaint successfully once, so why not reuse it? To reuse prebuilds, we need a few steps:
1. make sure we build all the variants we need
2. store the .app file as an artifact
3. download the artifact and use it in the E2E tests
## Changelog:
[Internal] - Build release variant for RNTester
Reviewed By: mdvacca
Differential Revision: D67760380
fbshipit-source-id: 8be0bbbadf4240dce1bcf5b44dadb41d49ed4c06
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48439
Changelog: [internal]
This is in preparation for implementing `getRootNode` and `ownerDocument` properly in the DOM APIs.
Reviewed By: rshest
Differential Revision: D67137215
fbshipit-source-id: bda6b1f843f219e03df533797fa9e4adbaa54c60
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48438
Changelog: [internal]
Just adding tests to make sure we cover the cases where the root is unmounted.
Reviewed By: rshest
Differential Revision: D67752010
fbshipit-source-id: 3cc17cd25878013a26dc407640be00e8dc251eea
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48434
Changelog: [internal]
We were starting to repeat this logic too much in tests, so extracting so we can reuse it.
Reviewed By: rshest
Differential Revision: D67520443
fbshipit-source-id: 64e4e5b35f83dc45e41bb0efae9685aeaf0cf2e2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48436
Changelog: [internal]
Changing the defaults to use something that resembles a real device (in this case the iPhone 14 which is a very common device).
Reviewed By: christophpurrer
Differential Revision: D67759914
fbshipit-source-id: 87fe3be19196ece62c412e5076c601be746a4f22
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48468
Clang will add this code by default at the preprocessor phase. I'd observed a difference in output on sandcastle where it didn't include `stdlib` by default.
This stops `stdlib` being included locally. **It isn't important wrt tracking user API changes.**
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D67793848
fbshipit-source-id: 0c88aee05a78e2410b308fe10c48db2552b8a148
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48460
We can only specify `hg` as a dependency, so have to use it in our shell script.
Changelog: [Internal]
Reviewed By: GijsWeterings
Differential Revision: D67718641
fbshipit-source-id: 557d980a9b6c3dbcd2621481d39a24b47075a3f9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48457
Adding CI support will require executing through buck. Sandboxing means the package has to be well-formed to work, so this cleans up some earlier mess.
- yarn workspace
- check-api.sh to configure the environment correctly when running form sandcastle
- explicity dependencies in our package.json
This is the first step
Changelog: [Internal]
Reviewed By: GijsWeterings
Differential Revision: D67726588
fbshipit-source-id: 7f8605695e323ef332550820b23b85d3af5f4d69
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48456
This is the current output of running the api snapshotting tool. I've also shown some test examples that show how trivial changes affect the API file.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D67713415
fbshipit-source-id: f68c7e15b0d1e26878e39f22f49e64cdd7340df2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48435
Cleans up the runtime `fuseboxEnabledDebug` feature flag. The modern CDP backend has been enabled by default in open source since 0.76.
- Updates `ReactInstanceIntegrationTest` to preserve testing under both backend modes (legacy Hermes debugger vs Fusebox).
- Preserves ability to override `ReactNativeFeatureFlags` in tests via `InspectorFlagOverridesGuard` — we anticipate that future CDP features will continue to read from the `ReactNativeFeatureFlags` system (`fuseboxEnabled` was/is a special case).
Changelog: [Internal]
Reviewed By: robhogan
Differential Revision: D67759600
fbshipit-source-id: 5878dd879bae435e59c48823a9b9faf85561b028
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48440
Changelog: [internal]
Modifies the Fantom runner to read 2 new environment variables to help with debugging:
- `FANTOM_PRINT_OUTPUT`: prints the output of the CLI to the output of the test.
- `FANTOM_LOG_COMMANDS`: logs the buck commands executed by the runner, so they can be re-run outside the runner for debugging, etc.
Reviewed By: rshest
Differential Revision: D67682750
fbshipit-source-id: aff48c4f47078db1be53e0ee105089fbc921768f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48372
Changelog: [internal]
Implements log streaming in Fantom tests. This allows us to see the logs emitted from tests as they're logged, so we don't need to wait until the test completes to flush all of them at the same time.
Reviewed By: rshest
Differential Revision: D67600609
fbshipit-source-id: efb3125e13fd9aec1800a5f1ddaf0d93dcb29218
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48371
Changelog: [internal]
Adds a new favor for `runCommand` and `runBuck2` that works asynchronously and support parsing their output in real time.
Reviewed By: javache
Differential Revision: D67600614
fbshipit-source-id: 99dd2ce9bff11036829f214bf19208b10c9c1b25
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48369
Changelog: [internal]
This improves logs in Fantom by preserving the original log levels. It's also in preparation for adding support for log streaming in tests.
Reviewed By: javache
Differential Revision: D67600616
fbshipit-source-id: 1c4997d5e836a78327f33092527543fe025c90c6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48367
Changelog: [internal]
We removed the calls to `AppRegistry` in Fantom, so this filter isn't necessary anymore (just a no-op).
Reviewed By: rshest
Differential Revision: D67600610
fbshipit-source-id: d985cc5f0ee1728ac72c567bc091a6c2877f2659
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48391
Changelog: [internal]
When we enabled log streaming in Fantom, we saw a lot of logs that we were previously not forwarding (console.error, console.warn) in existing tests.
This removes all the warnings and errors from those tests.
Reviewed By: rshest
Differential Revision: D67602299
fbshipit-source-id: 111f373eafd8707f2746ff727894f1fa4283b83f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/48432
Changelog: [internal]
This moves the native module definition for Fantom to the `react-native` package so we can migrate the module to use the codegen.
Also implements the migration.
Reviewed By: christophpurrer
Differential Revision: D67759729
fbshipit-source-id: d79d078908b05fc4b6f5f26f0144ab7e3485cb83