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:
[General][Added] - Add `react-native/metro-config` package
Pull Request resolved: https://github.com/facebook/react-native/pull/36502
## Context
### React Native Metro config → React Native repo (https://github.com/facebook/react-native/pull/36502)
We (the React Native team) are aiming to relocate the default Metro config for React Native out of `react-native-community/cli-plugin-metro` and **into the React Native repo + app template** as a new `react-native/metro-config` package.
This is the first (and minimum viable) phase we can ship to separate the release process of Metro from RN CLI in order to reduce coupling and iterate faster for our users.
**See full motivation, design, and test plan here: https://github.com/facebook/react-native/pull/36502**
## Changes
- This PR adds the new `react-native/metro-config` package, reproduces all static values previously defined in RN CLI. The values which remain in RN CLI are dynamic values derived from CLI options passed by the user.
{F906910591}
Reviewed By: cortinico
Differential Revision: D44099692
fbshipit-source-id: 672a67e19d866ac2c64fc84983b5d82c604918c6
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
Summary:
changelog: [internal]
`setNativeProps` have been implemented in Fabric but require a React change to be accessible from JavaScript components. For React sync to be imported in OSS builds, React needs to have have a new release in NPM.
To work around this limitation, I manually copied over lines of code that glue together setNativeProps to OSS build.
Reviewed By: cortinico, cipolleschi
Differential Revision: D44216496
fbshipit-source-id: b34b598c1a317bdc03cc5a4cadb3f7c610059709
Summary:
This diff optimizes text measurement by adding a layer of caching per shadow node.
When ReactFeatureFlags.enableTextMeasureCachePerShadowNode is enabled, we will cache and reused measurements per shadow node.
This optimization showed a 2x improvement on text rendearing when a screen contains a big amount of text components.
Changelog: [Internal] Internal
Reviewed By: sammy-SC
Differential Revision: D44221170
fbshipit-source-id: c3e7ba1ad216929826a99585874981717c90e13b
Summary:
Right now RNTestePage either adds a large spacer to the end of content, unless `noSpacer` is added. But with `noSpacer`, scrolling content may not be reachable because we are putting padding on the wrong container.
This fixes that and removes a few cases where we had multi hundred px empty space in favor of uniformly taking up the parent, and a 10px padding. This also moves the constant margin at the top of RNTesterBlock to the container, so that in the E2E container we can save the 30px.
Changelog:
[Internal]
Reviewed By: javache
Differential Revision: D44197303
fbshipit-source-id: 8dc67f3588bc28316e2fee8d25a0bc59995f1728
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36537
##Changelog:
[Internal] -
This popped up when I was landing D44172494.
Order of arguments evaluation to a function call in C++ is unspecified, therefore there was a potential danger of use after move in two places in `Differentiator.cpp`
This diff fixes it.
Reviewed By: javache
Differential Revision: D44215210
fbshipit-source-id: 828ca379e2ba5a40506f1ff3136150af63ea1ff7
Summary:
> [Codegen 92] The getCommandOptions function in parsers/typescript/components/options.js and parsers/flow/components/options.js is the same. move it in parser-commons and use it in the original files. If the file two options.js files are empty, delete them.
> [Codegen 93] The getOptions function in parsers/typescript/components/options.js and parsers/flow/components/options.js is the same. move it in parser-commons and use it in the original files. If the file two options.js files are empty, delete them.
Part of Issue https://github.com/facebook/react-native/issues/34872
## Changelog:
<!-- 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
-->
[Internal][Changed] - Move getCommandOptions and getOptions to parsers commons from parsers components options
Pull Request resolved: https://github.com/facebook/react-native/pull/36413
Test Plan: `yarn jest react-native-codegen`
Reviewed By: rshest
Differential Revision: D43957023
Pulled By: cipolleschi
fbshipit-source-id: 4f8bf6f8fe69b20d0fb976afee7da244ef634e12
Summary:
> [Codegen 78 - Assigned to Pranav-yadav] It depends on [Codegen 75][Codegen 76][Codegen 77] Extract the logic that emits Partial values in an emitPartial function, which takes the Parsers as parameter.
>[Codegen 79 - Assigned to Pranav-yadav] It depends on [Codegen 78] Extract the basic cases logics (case Stringish, case Int32, case Double, ..., case Partial. `Flow` lines and `TypeScript` lines into a function emitCommonTypes in `parsers-primitives.js`. Make sure that the default case returns `null`. Call this function in the default: case `Flow`, `TypeScript` of the `index.js` file: if the function return something, return that from the default case; otherwise if the `emitCommonTypes` returns `null`, keep the current default implementation (throw the error).
### Changes
- merged TS & Flow parsers' logic for `Partial` case to `emitPatial` fn
- merged TS & Flow parsers' logic for below cases:
- `Stringish`
- `Int32`
- `Double`
- `Float`
- `UnsafeObject`
- `Object`
- `Partial`
- into an `emitCommonTypes` fn into `parsers-primitives.js`
- add **_tests_** for `emitPartial` and `emitCommonTypes` fn's
- add `getAnnotatedElementProperties` fn to parser & impl to both TS & Flow parsers
## Changelog:
[INTERNAL] [CHANGED] - Merge TS & Flow parsers' logic for `Partial` case to `emitPatial` fn & `commonTypes` cases into `emitCommonTypes` fn
Pull Request resolved: https://github.com/facebook/react-native/pull/36450
Test Plan: - `yarn lint && yarn run flow && yarn jest react-native` ⇒ �
Reviewed By: rshest
Differential Revision: D44132308
Pulled By: cipolleschi
fbshipit-source-id: f965e85ecc5d94e57ad85334ce565a55c512fde4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36534
Changelog: [Internal]
- Added option to include react-native package in forEachPackage func
- Used this in align-package-versions.js
Reviewed By: cortinico
Differential Revision: D44152939
fbshipit-source-id: da173e78945d8185ae7e35e29d08926de1700fa4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36533
Changelog: [Internal]
Its better to have one source of truth, so we won't loose any changes if one of the files will be updated
Reviewed By: cortinico
Differential Revision: D44138311
fbshipit-source-id: 9bd938c1abe33ea1f791f7624efd57f1b37e813b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36531
Changelog: [Internal]
In order to make `react-native/tester` imports work, adding this package to `xplat/js/public`
Also moving devDependecies from `react-native/tester/package.json` to root package json to avoid checking in dev dependencies in `xplat/js/public/node_modules`
Reviewed By: cortinico
Differential Revision: D44030539
fbshipit-source-id: b06e49869cdad6e511b1675d1063a1ceac56e3e6
Summary:
This change does two things:
1) Moves RNTester on iOS to use an `.xctestplan` to configure its tests. This moves the test configuration out of the `.xcscheme` file, and into a new json file that Xcode likes. It also allows you to run the same tests multiple times with different configurations. This was done by clicking the focused button below.

Note: this is partially me upstreaming a change from React Native macOS (https://github.com/microsoft/react-native-macos/pull/190/), though at some point our Xcode project got messed up and we were no longer referencing them ��.
2) Enables Address Sanitizer and Udefined Behavior Sanitizer through the xctestplan
This should help catch some extra vulnerabilities should they ever show up while our tests run.
Notably, I did not _also_ add a configuration to run Thread Sanitizer, because tests start failing with that enabled 😅.
## Changelog:
[IOS] [SECURITY] - Enable Address and Undefined Behavior Sanitizers on RNTester
Pull Request resolved: https://github.com/facebook/react-native/pull/36443
Test Plan: CI should pass
Reviewed By: cortinico
Differential Revision: D44213517
Pulled By: cipolleschi
fbshipit-source-id: 0646174c4b416413a563e8178aa2cfca230b5e66
Summary:
This just creates the class structure for `ReadOnlyNode`, `ReadOnlyElement` and `ReactNativeElement`, with all methods throwing as unimplemented.
These classes will be gated behind a feature flag, so merging incomplete work is ok.
This doesn't add the future setters that will log warnings / throw errors when used.
See: https://github.com/react-native-community/discussions-and-proposals/pull/607
Changelog: [internal]
Reviewed By: rickhanlonii, yungsters
Differential Revision: D44060539
fbshipit-source-id: e489532fd365d9aa2bb8308847a35eb715d675e7
Summary:
This implements a basic version of DOMRectList that's close to the spec but diverges in some things (e.g.: methods could be called with an instance created through `Object.create`, etc.).
This will be used soon to implement `ReadOnlyelement.getClientRects()` (behind a flag).
See: https://github.com/react-native-community/discussions-and-proposals/pull/607
Changelog: [internal]
Reviewed By: yungsters
Differential Revision: D44060540
fbshipit-source-id: ad29b5c41f2778864e7dd7ece9223dcf73cd5d6c
Summary:
This implements a basic version of NodeList that's close to the spec but diverges in some things (e.g.: methods could be called with an instance created through `Object.create`, etc.).
This will be used soon to implement `ReadOnlyNode.childNodes` (behind a flag).
See: https://github.com/react-native-community/discussions-and-proposals/pull/607
Changelog: [internal]
Reviewed By: yungsters
Differential Revision: D44055911
fbshipit-source-id: 10b435b06ea6f75eaead85f01c2703e05bb3bd37
Summary:
This implements a basic version of HTMLCollection that's close to the spec but diverges in some things (e.g.: methods could be called with an instance created through `Object.create`, etc.).
This will be used soon to implement `ReadOnlyElement.children` (behind a flag).
See: https://github.com/react-native-community/discussions-and-proposals/pull/607
Changelog: [internal]
Reviewed By: yungsters
Differential Revision: D44055912
fbshipit-source-id: 37bcd7c12916b95a258e6b2e5717a642f478abdf
Summary:
These 3 methods are defined in the binding in native, but not in the type definition in JS.
Changelog: [internal]
Reviewed By: yungsters
Differential Revision: D44139730
fbshipit-source-id: 5ce74c61a424ece8091046425b9cd5598f14bbf1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36523
`jest/private/preprocessor.js` is only used to run tests on the workspace itself, it's not part of our exported Jest preset and is specifically excluded from publication in the `react-native` package.
Now that we have the monorepo setup, this belongs at the workspace root.
- `metro-react-native-babel-transformer` moved from RN `dependencies` to root `devDependencies` because it's only used by the preprocessor
- `jest/create-cache-key-function` added to `devDependencies` - it's also used by the `assetTransformer` in the public preset.
Changelog: [Internal]
Reviewed By: hoxyq
Differential Revision: D44197879
fbshipit-source-id: 0bbd9e2f500f53fa4f16562f05374dc601b67df6
Summary:
I added missing type `lineBreakStrategyIOS` for Text and TextInput. ([Text docs](https://reactnative.dev/docs/text))
## Changelog
[GENERAL] [FIXED] - add `lineBreakStrategyIOS` prop type for Text and TextInput
<!-- 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/36526
Test Plan: Ran `yarn test-typescript` and `yarn test-typescript-offline` with no errors.
Reviewed By: jacdebug
Differential Revision: D44213791
Pulled By: javache
fbshipit-source-id: 8d0d44e2cdd1fa362c54935326e86dde88c5ba0b
Summary:
With Metro symlink support coming soon, users will expect isolated `node_modules` resolution and hoisted `react-native` to work. Currently, we make some fragile assumptions in Ruby scripts about the location of `node_modules` packages - in particular `react-native` and `react-native-community/cli-platform-ios`.
This change invokes `node` to resolve those paths, which should allow these scripts to work in any Node JS-compliant setup.
There's a small (sub-second) performance penalty involved in invoking node, but two of these in the context of `pod install` seems reasonable. Also, these scripts [already invoke `node`](https://github.com/react-native-community/cli/blob/fb78fe8ea2fabe8e6d43f5042ecbb92e8e484e12/packages/cli-platform-ios/native_modules.rb#L26), so this isn't an additional dependency or point of failure.
*This is probably the first Ruby I've written in >10 years, review suggestions welcome!*
Changelog:
[iOS][Added] - Support workspace and isolated setups with `pod install`
Pull Request resolved: https://github.com/facebook/react-native/pull/36485
Test Plan: `pod install` succeeds on a PNPM workspace setup where `react-native-community/cli` was not at the path previously expected by this script.
Reviewed By: cipolleschi
Differential Revision: D44097440
Pulled By: robhogan
fbshipit-source-id: 8300144888d8da019451b3f792b30eabc3a568cf
Summary:
## Changelog:
[Internal] -
While merging a Contributor PR in D43816768, I got curious whether such things as detecting/fixing typos could be automated.
There is a tool called [typos](https://github.com/crate-ci/typos), which, as it turns out, works very well on source code files.
The amount of false positives was minimal, most of the suggestions were valid ones.
And the total amount of typos found and fixed was **more than 300**, which is... quite a bit :)
### Methodology
* Run `typos` separately on `ReactCommon`, `Libraries`, `React`, `ReactAndroid` and `scripts` folders inside `packages/react-native`, e.g.:
```
$ typos -w --config ~/tmp/_typos.toml ~/fbsource/xplat/js/react-native-github/packages/react-native/ReactAndroid
```
Contents of the `_typos.toml` config file:
```
[default.extend-words]
collapsable = "collapsable"
NDK = "NDK"
inout = "inout"
```
(yeah, it really didn't like the "collapsable" word, for some reason ;))
* Inspect all the changes manually and revert false positives (as mentioned, their amount was minimal)
Note that most of the changes are inside things like comments and error messages, however there are a few among identifier name fixes (`typos` is actually quite smart at understanding naming conventions in code) - I kept the suggestions in cases that are local and not part of a public API. There are also misspelled file name changes in a couple of cases.
Reviewed By: NickGerleman
Differential Revision: D44172494
fbshipit-source-id: 86e27edbbb99e09135e3cdd5d7cea8ffeb8307f4
Summary:
Nightly builds are broken at the moment - at least in the first instance this looks to be because a reference to `template/package.json` was missed in the monorepo PR. This repairs it.
Changelog: [Internal]
Reviewed By: GijsWeterings
Differential Revision: D44205810
fbshipit-source-id: c810b7a211db7162569a67fca26771fce79d4f9d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36522
We don't need to register Babel for internal tests, Jest takes care of hooking require. This resolves an internal require-clobbering issue.
Changelog: [Internal]
Reviewed By: GijsWeterings
Differential Revision: D44197281
fbshipit-source-id: ee076d431b0c49ae4a2da609d964cdd66bca27f8
Summary:
Changelog: [Internal] - Ensure pointercancel events have zeroed location properties
When looking at the pointercancel test the remaining assertion failures were from the expectation that pointercancel events should be reported at [0, 0]. This diff ensures this occurs.
Reviewed By: NickGerleman
Differential Revision: D43886424
fbshipit-source-id: dda37153bd077500599f35db99f114c1a0823120
Summary:
Changelog: [Internal] - Ensure trailing leave/out pointer events are fired after a cancel event
The pointercancel test checks that pointerleave/pointerout events are fired after a pointercancel which preivously wasn't occuring so this added call ensures so.
Reviewed By: NickGerleman
Differential Revision: D43886121
fbshipit-source-id: 9ea801e8f5fcd5855832cfac973bda6ba905998d
Summary:
That's a first step to make sure our C++ tests can effectively run.
Here I'm setting up the pipeline to at least compile those tests and make sure they can be executed on a Android Emulator
Changelog:
[Internal] [Changed] - Setup CMake to run the GTest suite
Pull Request resolved: https://github.com/facebook/react-native/pull/36477
Test Plan: CI needs to be green.
Reviewed By: rshest
Differential Revision: D44066754
Pulled By: cortinico
fbshipit-source-id: f963e0d7d4d9473eada53d7feecfabc21f3c3196
Summary:
On Android `AccessibilityInfo.isReduceMotionEnabled()` returns false even when "Disable Animations" is enabled. This fixes https://github.com/facebook/react-native/issues/31221.
## Changelog
<!-- 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
-->
[ANDROID] [FIXED] - Fix check of "reduce motion" setting on android
Pull Request resolved: https://github.com/facebook/react-native/pull/36508
Test Plan: Have some code logging the value of `AccessibilityInfo.isReduceMotionEnabled()` or using it to change the UI. Run that code on Android without and with "Disable Animations" enabled. See the value is always `false` without the fix, but changes to `true` when "Disable Animations" is enabled with the fix.
Reviewed By: cortinico, rshest
Differential Revision: D44163583
Pulled By: javache
fbshipit-source-id: ad239454ea68b381e0c7f024df797b3646aeefd7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36515
Buck is using a older version of Robolectric which doens't have
`RuntimeEnvironment.getApplication()`. Reverting to the older
accessor.
Changelog:
[Internal] [Changed] - Fix test_buck by using RuntimeEnvironment.application
Reviewed By: cipolleschi
Differential Revision: D44171240
fbshipit-source-id: d2b49e3b08ffd737bc70ea3e0cb6b291cc36425f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/36510
This sets up a small offline mirror for Robolectric tests
and allows to run them both on CircleCI and on the internal CI.
allow-large-files
Changelog:
[Internal] [Changed] - Make robolectric tests run in offline mode
Reviewed By: cipolleschi
Differential Revision: D44066692
fbshipit-source-id: 3974d92169ed5c8947f72c953e83a7bf6fadca54
Summary:
We can now use the `build` lifecycle task rather than a custom buildAll.
This task will also run linters and other checks on our builds.
Speficially I realized we were missing some permission in the manifest of RN-Tester
which were missed once we bumped to SDK 33.
Changelog:
[Internal] [Changed] - Use the default `build` task rather than `buildAll`
Reviewed By: cipolleschi
Differential Revision: D44055845
fbshipit-source-id: c9adbbeaaaf7ab8a8000fc1dce84ec39427fb26e
Summary:
This makes sure all the tests are executed inside the `ReactAndroid/src/test` folder.
Currently, we're not executing those tests as they're broken. In this diff I took care of:
- Re-enabling them as much as I could
- Ignoring the ones that are ignored also on BUCK
Those tests will have to be entirely re-written as they're using PowerMock which is
unmaintained and not working well with JDK 17+ (that's also why I had to add
the `--illegal-access=permit` and the `--add-opens` directing to allow mocking).
In general, I believe this is a net positive change as it allows us to add new JUnit tests
that are effectively executed, while the current status is ignoring all of them.
Changelog:
[Internal] [Changed] - Enable JVM Unit Tests for Gradle
Reviewed By: cipolleschi
Differential Revision: D41523697
fbshipit-source-id: dc9f2c4c93d0e6b231e8240a583ca31220152d3f
Summary:
##Changelog:
[Internal] -
There are small typos in:
- Libraries/Core/setUpTimers.js
- Libraries/LogBox/Data/LogBoxData.js
- Libraries/Pressability/Pressability.js
- Libraries/Renderer/implementations/ReactFabric-dev.js
- Libraries/Renderer/implementations/ReactNativeRenderer-dev.js
- ReactCommon/react/nativemodule/core/platform/ios/RCTBlockGuard.h
Fixes:
- Should read `snapshot` rather than `snapsho`.
- Should read `symbolication` rather than `sybolication`.
- Should read `polyfilled` rather than `polyfiled`.
- Should read `instance` rather than `instace`.
- Should read `gesture` rather than `gestute`.
Semi-automated pull request generated by
https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md
Pull Request resolved: https://github.com/facebook/react-native/pull/36372
Reviewed By: cortinico, cipolleschi
Differential Revision: D43816768
Pulled By: rshest
fbshipit-source-id: 1346cb3a26748c41d72a3c388d81713ddf2272ed