Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49332
## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.
## This diff
- Migrates `Libraries/Utilities/differ/*.js` to use the export syntax.
- Updates deep-imports of these files to use `.default`
- Updates codegen with a compat layer
- Updates the current iteration of API snapshots (intended).
Changelog:
[General][Breaking] - Deep imports to `Libraries/Utilities/differ/...` with `require` syntax need to be appended with '.default'.
Reviewed By: yungsters
Differential Revision: D69467423
fbshipit-source-id: 2e58a0b9711e9bdf5ca907a5b2252584f6fec9bc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49349
Follow-up on D69454101 to add more test coverage for `$ReadOnlyArray<UnsafeMixed>` as a component prop. The new type was missing from the CodegenSchema, which revealed some gaps in tests.
Changelog: [Internal]
Reviewed By: fabriziocucci
Differential Revision: D69488035
fbshipit-source-id: 19895e55e5ec4d89a790f1c388de9eea025a316c
Summary:
Fix `react-native-community/cli-platform-*` packages not being found in monorepos.
Note that we are making the assumption that `process.cwd()` returns the project root. This is the same assumption that `react-native-community/cli` makes. Specifically, `findProjectRoot()` has an optional argument that defaults to `process.cwd()`:
- [`findProjectRoot()`](https://github.com/react-native-community/cli/blob/14.x/packages/cli-tools/src/findProjectRoot.ts)
- Which gets called without arguments in [`loadConfig()`](https://github.com/react-native-community/cli/blob/14.x/packages/cli-config/src/loadConfig.ts#L89)
- `loadConfig()` gets called from [`setupAndRun()`](https://github.com/react-native-community/cli/blob/14.x/packages/cli/src/index.ts#L196), also without project root set
As far as I can see, the project root argument is only ever used in tests.
## Changelog:
[GENERAL] [FIXED] - Fix `react-native-community/cli-platform-*` packages not being found in monorepos
Pull Request resolved: https://github.com/facebook/react-native/pull/47308
Test Plan:
1. Clone/check out this branch: https://github.com/microsoft/rnx-kit/pull/3409
2. Cherry-pick https://github.com/facebook/react-native/pull/47304
3. Cherry-pick https://github.com/facebook/react-native/pull/47308
4. Run `react-native config` inside `packages/test-app`
5. Verify that `projects` is populated
**Before:**
```js
"healthChecks": [],
"platforms": {},
"assets": [],
"project": {}
}
```
**After:**
```js
"healthChecks": [],
"platforms": {
"ios": {},
"android": {}
},
"assets": [],
"project": {
"ios": {
"sourceDir": "/~/packages/test-app/ios",
"xcodeProject": {
"name": "SampleCrossApp.xcworkspace",
"path": ".",
"isWorkspace": true
},
"automaticPodsInstallation": false,
"assets": []
},
"android": {
"sourceDir": "/~/packages/test-app/android",
"appName": "app",
"packageName": "com.msft.identity.client.sample.local",
"applicationId": "com.msft.identity.client.sample.local",
"mainActivity": "com.microsoft.reacttestapp.MainActivity",
"assets": []
}
}
}
```
Reviewed By: cortinico
Differential Revision: D69465533
Pulled By: robhogan
fbshipit-source-id: 3d6cf32752a7a41d9c7e84f35b0f26ae7d7a971f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49345
This diff is causing an error to be logged for every user. Even if it's noise, its more trouble than its worth. Let's revert until feature flags check fixed.
Changelog: [Internal]
Reviewed By: makovkastar
Differential Revision: D69504966
fbshipit-source-id: 13caf715cef9a4cc6c9b7c68d3003fbced870d34
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49338
This doesn't cover all cases, but is a good start.
Where relevant, I call out inline places where there are KPs with LogBox that will be fixed separately.
## Changelog
Changelog: [internal]
Reviewed By: rubennorte
Differential Revision: D69443040
fbshipit-source-id: 7281f30aa705ae812d5b5f5f9ad03b37358de059
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49337
*Note: This diff adds helpers and updates the one test we have. The next diff adds a bunch of tests, see that diff for how these helpers are used to scale to a large number of tests.*
-----
## Overview
Adds helpers for the LogBox e2e test to make it easier to write simple, readable, tests with a healthy level of abstraction over the e2e APIs.
## API
The helpers expose an ability to render a component, and return methods to get the UI state:
```
// Returns the LogBox inspector UI as an object.
getInspectorUI: () => ?InspectorUI,
// Returns the LogBox notification UI as an object.
getNotificationUI: () => ?NotificationUI,
```
These return objects that represent the main text elements in the UI like `title` and `message`.
The helpers also provide methods for interacting with the LogBox UI:
```
// True if the LogBox inspector is open.
isOpen: () => boolean,
// Tap the notification to open the LogBox inspector.
openNotification: () => void,
// Tap to close the notification.
dimissNotification: () => void,
// Tap the minimize button to collapse the LogBox inspector.
mimimizeInspector: () => void,
// Tap the dismiss button to close the LogBox inspector.
dismissInspector: () => void,
// Tap the next button to go to the next log.
nextLog: () => void,
// Tap the previous button to go to the previous log.
previousLog: () => void,
```
## Example test
This allows writing tests like:
```
test('should log error', () => {
const logBox = renderLogBox(<ComponentThatErrors />);
// Should show notification
expect(logBox.isOpen()).toBe(false);
expect(logBox.getNotifciationUI()).toEqual({
count: '!',
message: 'error message',
});
// Tap the notification
logBox.openNotification();
// Should show log
expect(logBox.isOpen()).toBe(true);
expect(logBox.getInspectorUI()).toEqual({
header: 'Log 1 of 1',
title: 'Console Error',
message: 'error message',
stackFrames: [
'ComponentThatErrors'
],
componentStackFrames: [
'<ComponentThatErrors />',
],
isDismissable: true,
});
})
```
## Changelog
Changelog: [internal]
Reviewed By: rubennorte
Differential Revision: D69443041
fbshipit-source-id: c81ccd56a39d01d61814d29515b587096c0509c0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49343
Raise source and target version of annotation processor from 7 to 11
This is unused in OSS
changelog: [internal] internal
Reviewed By: NickGerleman
Differential Revision: D69478025
fbshipit-source-id: 28c6ed5889db423c43a36ccee396083ae7e78e5f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49317
This hooks into `enableNativeCSSParsing()` to optionally bypass viewconfig processor, and lets us parse the raw strings (or objects composed of string) in native.
Right now, to not disturb too much while this is in experimentation, this is just a facade over existing types and props storage, and we ignore any non-px lengths.
Also need to prepend
Changelog: [Internal]
Reviewed By: joevilches
Differential Revision: D69337482
fbshipit-source-id: 6093e312e0d1dc1855713da20b72bf75b98af3ea
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49316
This hooks up some build logic for `react/renderer/css`. A bit funky right now since header only, and might need to change later (it isn't neccesarily guaranteed to be header only in the future).
Changelog: [Internal]
Reviewed By: cortinico, cipolleschi
Differential Revision: D69426450
fbshipit-source-id: 77e0ef409f34daf003d28a5cd70de935bd180440
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49333
The rollout of "new architecture everywhere" should be enabled in OSS canary releases. This diff updates the ReactNativeFeatureFlags.config.js to reflect that all of the feature flags used by the new architecture are enabled by default in experimental and canary releases. Note that these feature flags were already enabled in OSS when new architecture was enabled.
changelog: [internal] internal
Reviewed By: rubennorte, NickGerleman
Differential Revision: D69419662
fbshipit-source-id: 6ecf9e38bb2fd0d3c0f7129ae16fcef8755b5da2
Summary:
> [!NOTE]
> This PR is part of JavaScriptCore Extraction to this repository: https://github.com/react-native-community/javascriptcore
This PR centralizes the setup of js engine dependencies which need to be defined when building with dynamic frameworks. This will allow us to change linked framework if using a third party one in the future
## Changelog:
[INTERNAL] [CHANGED] - centralize JS engine dependency configuration
Pull Request resolved: https://github.com/facebook/react-native/pull/49297
Test Plan: CI Green (Build needs to go properly)
Reviewed By: javache
Differential Revision: D69396641
Pulled By: cipolleschi
fbshipit-source-id: deedd12084f563f73f12f8617fdca0a6d680bf5a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49262
Changelog: [General][Breaking] Deep imports into `react-native/virtualized-lists` with require syntax may need to be appended with `.default`
Reviewed By: huntie
Differential Revision: D69308532
fbshipit-source-id: 6de15d46e0931616bc9849edbccb7cf745e15dd5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49204
Changelog: [internal]
We don't copy the options object and just access the individual properties, so using an interface is enough, and has the benefit of not having to create object copies to pass down to subclasses.
Reviewed By: yungsters
Differential Revision: D69182824
fbshipit-source-id: 9819e5627d72761c78d0f39a1861a3239066dbb2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49311
This tool enables checking the boundary between JavaScript and Native for
backwards incompatible changes to protect against crashes.
This is useful for:
- Local Development
- Over the Air updates on platforms that support it
- Theoretically: Server Components with React Native
Check out the Readme for more information
Changelog: [General][Added] Open Sourcing React Native's Compatibility Check
Reviewed By: yungsters
Differential Revision: D69277991
fbshipit-source-id: 886a983d4b17609ce771cdd93b75f34bbd8417dc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49035
## Motivation
Modernising the RN codebase to allow for modern Flow tooling to process it.
## This diff
- Migrates files in `Libraries/Modal/*.js` and `Libraries/Network/*.js` to use the `export` syntax.
- Updates deep-imports of these files to use `.default`
- Updates jest mocks
- Updates the current iteration of API snapshots (intended).
Changelog:
[General][Breaking] - Deep imports to modules inside `Libraries/Modal` and `Libraries/Network` with `require` syntax may need to be appended with '.default'.
Reviewed By: huntie
Differential Revision: D68827032
fbshipit-source-id: 98149055f82edad96e74371a79f05f88a8ab3b66
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49324
Provide Android component codegen a bit more flexibility by allowing `$ReadOnlyArray<UnsafeMixed>` and avoid casting in the view manager.
Changelog: [General][Added]
Reviewed By: fabriziocucci
Differential Revision: D69454101
fbshipit-source-id: c210647deffeb01b7db8aa07266e58c42acf14ba
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49301
The hermesc logging is extremely noisy and not relevant for the users. I'm disabling it for the task that runs metro+hermesc (only for the hermesc) part.
Changelog:
[Internal] [Changed] - Disable console logging for hermesc
Reviewed By: robhogan
Differential Revision: D69399156
fbshipit-source-id: e5f8722b33d30675aba5a8aa82c456be21254b0c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49300
With the refactor of the AppDelegate in favor ReactNativeFactory, the users can now instantiate multiple instances of react native.
However, currently, if you try to run multiple instances, the app will crash with the message:
```
libc++abi: terminating due to uncaught exception of type std::runtime_error: Feature flags cannot be overridden more than once
```
This happens also when the feature flags we would like to set are the same that we already applied. This should be an allowed scenario because reapplying the excatly same features flags should have no effect on React native and that's not the use case we want to forbid.
With this change, we are creating a static variable that checks whether we already apply that set of feature flags and it allows you to create multiple instances by keeping the same flags
## Changelog:
[iOS][Fixed] - Allow multiple RN instances to run at the same time
Reviewed By: rubennorte
Differential Revision: D69398441
fbshipit-source-id: a377c6a1402d38d66d348fa8c6a65e645973aadc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49308
changelog: [internal]
move TinyMap class to its own file in internal folder.
Reviewed By: NickGerleman
Differential Revision: D69402458
fbshipit-source-id: e16d5f33ef0e704e3336cf6f13f510206d7f5e5d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49307
changelog: [internal]
There were parts of Differentiator that were leaking outside of "mounting" module. This diff moves them to "internal" folder and changes buck so they can't be imported from outside the module.
Reviewed By: NickGerleman
Differential Revision: D69401878
fbshipit-source-id: 8aa8c96e91b088dab4f9c8b9a5e6937e09be7eb4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49304
changelog: [internal]
View culling must take transform into account when calculating whether a frame is visible or not. This diff adds that.
Reviewed By: NickGerleman
Differential Revision: D69394909
fbshipit-source-id: 4c588a64f2c8e2d35fb7d606d26adc09d3502780
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49278
The previous diff (https://github.com/facebook/react-native/pull/49272) fixed an issue where we used frame to get the size of a sublayer. This is problematic in that it scales things twice if a scaling transform is applied. I looked to see where else we do this and we have this problem (sometimes) with background color and filter.
To fix this in the general case I created a helper to size a layer to the same shape as the View's layer - so using bounds for the size, (0,0) for position on the frame, and cornerRadius/mask for border radius considerations. The only 3 layers that should be the exact same size are backgroundColorLayer, backgroundImageLayer, and filterLayer
Changelog: [iOS] [Fixed] - Fix cases where background color, filter, and background image were sized incorrectly if there was a scaling transform
Reviewed By: jorge-cab
Differential Revision: D69321790
fbshipit-source-id: 70b5d18fa01967896b1bfffdb5684c2c907f3549
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49272
Turns out bounds does not account for the proper size if a scaling transform is applied while frame does. Using the example listed in https://github.com/facebook/react-native/issues/49134, the size of the frame is the expected 240, but the size of the bounds is 200.
We had a mismatch where we use bounds everywhere in shadow image creation, but use the frame when asking for the size of the box shadow layer. What ends up happening is we have a 240x240 layer that is getting scaled again.
I refactored the shadow creation to just take a CGSize instead of a whole CALayer (which we had only used for its size anyway) so that we can be consistent with frame and bounds, and use bounds everywhere so that we only scale once.
Changelog: [iOS] [Fixed] - Fix cases where background color, filter, and background image were sized incorrectly if there was a scaling transform
Reviewed By: jorge-cab
Differential Revision: D69320213
fbshipit-source-id: a913e0df91d78ec9665752acefcae755ab607ac8
Summary:
Changelog: [Internal]
This is an automatically generated fixup patch to bring fbsource back into sync with
facebook/react on GitHub. Please land this patch as soon as possible, as the difference
reflected on here is already on GitHub and future changes may depend on these
changes!
<< DO NOT EDIT BELOW THIS LINE >>
diff-train-skip-merge
diff-train-source-id: 7e59b47d91fda2c6ef8946499d9e4457522a90d5
Generated by: https://www.internalfb.com/intern/sandcastle/job/4503601290447444/
GitHub Repo: facebook/react
Reviewed By: mofeiZ
Differential Revision: D69418289
fbshipit-source-id: 48636ba5bedfef7a09e0802f2a640be0417cdb7c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49284
All of the CMake library names in the "renderer" directory use "render" for the name, missing the last two letters of the directory name.
eye_twitch
I don't think fixing that should be breaking, since 3p libraries need to rely on the merged library anyway, so let's fix that and find/replace all these.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D69338892
fbshipit-source-id: d3b306ad0ea191728dfbacf9e2aaa12b00caa619
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49313
When the flag is enabled, we expect legacy native viewconfigs to add processor, where SVCs do not, and instead parse in native. Don't emit warnings in this case.
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D69337802
fbshipit-source-id: f4c354c3b7b6ecbe4a8a72a37ea6d60dcc336b67