Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46891
This was set but never directly used - fix it.
Changelog:
[iOS][Fixed] Removed usage of set but unused variable.
Reviewed By: mg-here
Differential Revision: D64029449
fbshipit-source-id: 0d60428317de95aa235f249c512fa968aa04f879
Summary:
This diff reverts D63643856
`_highestMeasuredFrameIndex` is not properly invalidated causing issues with previous logic when data size shrinks.
bypass-github-export-checks
Changelog:
[General][Changed] - Revert "Fix onEndReached not being called when getItemLayout is present and we scroll past render window"
Reviewed By: NickGerleman
Differential Revision: D64009287
fbshipit-source-id: 8a21b57f5247fc743e65f9a730ff33a9a89d2bc1
Summary:
`FpsDebugFrameCallback.getTotalTimeMS()` implementation loses accuracy due to incorrect order of type casting to int
## Changelog:
[ANDROID] [CHANGED] - Improve FpsDebugFrameCallback.getTotalTimeMS() accuracy
Pull Request resolved: https://github.com/facebook/react-native/pull/46869
Test Plan:
- Launch some test app
- Open up the [Dev Menu](https://reactnative.dev/docs/debugging#accessing-the-dev-menu) in your app and toggle Show Perf Monitor
- Compare results of current & improved implementations
Reviewed By: rshest
Differential Revision: D64024054
Pulled By: arushikesarwani94
fbshipit-source-id: 438792bace0e3443d151cf13364f6e94b66dfb5e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46878
Removes an unused code path from `ResourceDrawableIdHelper`. Vector drawables are now loaded via Fresco decoder so we don't need to offer this utility anymore. While part of the public API, it only made it into 0.76.0 RCs and should have really been marked internal.
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D64021956
fbshipit-source-id: 6e8073e0f7f079d023fa1e45a5a43f8652ca2826
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46871
changelog: [internal]
Original commit changeset: 748efce7f0b8
Original Phabricator Diff: D59859754
This is temporarily until we find an actual solution that can both cache the colors and also react to theme changes updating the colors value properly.
Reviewed By: javache
Differential Revision: D64002346
fbshipit-source-id: 9ba3bd0d653b9a0d8617f45d42c0c3d966fba01f
Summary:
Modifying the CxxReactPackage by changing the annotation from UnstableReactNativeAPI to FrameworkAPI so as to now support custom C++ TM wrapper
Changelog:
[Android][Changed] - Modify CxxReactPackage to support custom C++ TM wrapper
Reviewed By: shwanton, christophpurrer
Differential Revision: D63740964
fbshipit-source-id: 175b1104dcd11674413199b30415516d4d324a97
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46845
Previously, the parser was throwing away the values of a string union when storing it in the schema. It would only store the union as
```
{
type: 'UnionTypeAnnotation',
memberType: 'StringTypeAnnotation'
}
```
We now track the string literals through the parser and store them in the schema:
```
{
type: 'StringLiteralUnionTypeAnnotation',
types: [
{
type: 'StringLiteralTypeAnnotation'
value: 'light'
},
{
type: 'StringLiteralTypeAnnotation'
value: 'dark'
},
],
}
```
We aren't changing the generators, those still just output "string". They could eventually be made smarter.
The value of this is that the compat checker can now error when the union changes.
Changelog: [Internal]
Reviewed By: yungsters
Differential Revision: D63917685
fbshipit-source-id: 34a10e1f1910d2935837a3659f66049fd4473134
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46867
In multi-root Android React Native apps (e.g., multiple ReactFragments), if the following sequence occurs:
1. a Modal is displayed via the secondary root
2. the secondary root is destroyed
3. the app is backgrounded
4. the app is foregrounded
The LifecycleEventListener on the ReactModalHostView will fire, causing the Modal to be rehydrated in the onHostResume callback.
Removing the lifecycle event listener when the modal is detached from the window resolves the issue.
## Changelog
[Android][Fixed] Fix issues with Modals and lifecycle events in multi-surface apps
Reviewed By: alanleedev
Differential Revision: D64001103
fbshipit-source-id: 10f8304cd9cca0d5c90e39f5e361290f4fc35283
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46864
## Summary
Fresco v3.3.0 contains necessary adjustments to allow downsample overrides per image request (see https://github.com/facebook/fresco/pull/2787), as well as numerous other bug fixes and adjustments across both Drawee and Vito images.
## Changelog
[Android][Changed] - Update Fresco from 3.2.0 to 3.3.0
Reviewed By: oprisnik
Differential Revision: D63983051
fbshipit-source-id: 9ad0c40dfc864d24ffa39ca9e2bc0ddf8210f4f7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46827
You can now define a native module that takes an argument that is a specific string literal:
Like this:
```
export interface Spec extends TurboModule {
+passString: (arg: string) => void;
+passStringLiteral: (arg: 'A String Literal') => void;
}
```
On the native side, this will still generate `string`, but the schema will now store the string literal, and it will be allowed in JS. This should allow more strict flow / typescript types for modules.
This will also allow the compatibility check to fail if the literal changes.
This is a step towards accepting a union of string literals.
Changelog: [General][Added] Codegen for Native Modules now supports string literals
Reviewed By: GijsWeterings
Differential Revision: D63872440
fbshipit-source-id: e54b97d34af4a3d1af51727db0777f26fb7b778c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46764
This is a patched fix to earlier attempt (D63700769) and resolving crash due to`java.lang.IllegalArgumentException: View=DecorView@b9f88af[AdsManagerActivity] not attached to window manager`.
- removing ` !dialogWindow.isActive` check as it is always true resulting in always doing early return causing other bugs
- adding try/ catch instead so the code can still run but can catch the known exception without crashing
Changelog:
[Android][Fixed] - Fix crash for Modal not attached to window manager
Reviewed By: mdvacca
Differential Revision: D63712422
fbshipit-source-id: 85fb6df340eb1139f954c92b5f1daf0dc41671d2
Summary:
React Native [app template provided by the CLI](https://github.com/react-native-community/template) currently uses [`metro-config` directly for `MetroConfig` type](https://github.com/react-native-community/template/blob/main/template/metro.config.js#L7).
However, it doesn't have `metro-config` as neither a dependency or dev dependency, which can lead to version mismatches.
While this is obviously a mistake on the template repo side, `metro-config` versions aren't matched with `react-native` versions. Therefore, getting the correct version of `metro-config` from `react-native/metro-config` would require reflecting on `react-native/metro-config`'s package.json etc. which is far from ideal. In my opinion it's would be much better to expose `MetroConfig` type from `react-native/metro-config` directly.
Version mismatching can happen in a monorepo setup. Say we have the monorepo structure using Yarn Modern:
```tree
.
├── RN75-app (workspace)
├── RN76-app (workspace)
│ ├── metro.config.js
│ └── node_modules
│ └── react-native
│ └── metro-config (0.76)
│ └── node_modules
│ └── metro-config (version for 0.76)
└── node_modules
├── react-native
│ └── metro-config (0.75)
└── metro-config (version for 0.75)
```
`react-native@0.75` gets hoisted to the monorepo root while `react-native@0.76` sits in an RN 0.76 app workspace.
Say we have the following `RN76-app/metro.config.js` contents:
```js
const {getDefaultConfig, mergeConfig} = require('react-native/metro-config');
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* type {import('metro-config').MetroConfig}
*/
const config = {};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);
```
In this case, `require('react-native/metro-config')` would resolve to `RN76-app/node_modules/react-native/node_modules/metro-config` since `react-native/metro-config` is a (dev) dependency of the App.
However `import('metro-config).MetroConfig` would resolve to `node_modules/metro-config` since it's not a direct dependency.
This is how we have a mismatch - imported functions come from different packages than imported type.
## Changelog:
[GENERAL] [ADDED] - Expose `MetroConfig` type directly from `react-native/metro-config`.
Pull Request resolved: https://github.com/facebook/react-native/pull/46602
Test Plan:
`yarn build` to generate dist for `react-native/metro-config`, see it has the export of `MetroConfig`.
## Notes
If this PR gets approved, I'll submit relevant one to the CLI template.
Reviewed By: huntie
Differential Revision: D63258881
Pulled By: robhogan
fbshipit-source-id: e6f3c880eb4a0aa902c62932d58f243c38b07c2e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46824
Changelog: [Internal]
Removing the implementation of layout-only shadow node reference updates, since the full version of shadow node reference updates are being released.
Reviewed By: shwanton
Differential Revision: D63831453
fbshipit-source-id: 84cb231be6c16bdc4a4b12a559c41b5a77064813
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46777
Simplifies this internal logic plus ensures there is one source of truth for `reactNativeVersion` in our CLI plugin. Also, renames the `ctx` variable to `cliConfig`, to more clearly signal that this is an integration point with the Community CLI.
Completes this wave of `community-cli-plugin` simplifications.
Changelog: [Internal]
Reviewed By: robhogan
Differential Revision: D63534247
fbshipit-source-id: bf5779fcf971dee1e0caf58b071df360636c53e9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46839
The `ReactNativeFlipper` object is not referenced in the template since 0.75. We can safely remove it as users should not reference it anymore.
Changelog:
[Android] [Breaking] - Remove ReactNativeFlipper object, deprecated in 0.75
Reviewed By: huntie
Differential Revision: D63897187
fbshipit-source-id: a7d73a98550518e46f8dbc0c9b859e0afb16e8a9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46854
When segment fetch fails, it seems incorrect to call the callback twice: once with error, and once with null.
This seems like a bug.
Created from CodeHub with https://fburl.com/edit-in-codehub
Changelog: [Internal]
Reviewed By: yungsters
Differential Revision: D63959015
fbshipit-source-id: f3ebb0f4732d99d91b5717a5bf193f44d957bde4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46846
As of D61658739, BaseViewManager setting color now goes through BackgroundStyleApplicator, which gives a default implementation of setting a background color, while storing information in a way where we can impement things like border radii and shadows on background for out of the box views.
I knew this could lead to breaks where we previously overrode view-level `setBackgroundColor` to do something custom, but didn't override on VM level, but didn't see any external usages so I assumed it should be relatively safe. Turns out we have some internal usages which run into this pattern (D63913128 already fixed one), including a usage in RN itself! Let's override the view managers in these to delegate to the view's custom drawing.
Changelog:
[Android][Fixed] - Fix some cases where we override setBackgroundColor on View-level instead of VM level
Reviewed By: Abbondanzo
Differential Revision: D63922722
fbshipit-source-id: af988d1436c790be97b2be1325541aa418bf43a3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46820
Relanding this as we had to unship due to some issues, which are fixed in the previous diff
Reviewed By: NickGerleman
Differential Revision: D63844167
fbshipit-source-id: b3e62004fe87ff732aac1c1622ac35d581b4980f
Summary:
X-link: https://github.com/facebook/yoga/pull/1715
Pull Request resolved: https://github.com/facebook/react-native/pull/46799
Content box impl had a bug where we resolved padding % against the same reference length as the dimensions. Padding should always be against containing block's width. This is also true for width, but not for height, which should be against containing block's height.
This just pipes the width into our box sizing functions.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D63787577
fbshipit-source-id: e512338770f25b66506cabab5a7cde8f04397ea0
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46844
Currently we can't see when a network query is made. It makes it hard to debug performance in apps like Store because it's unclear which queries are preloaded, which are fetched as early as they can and which ones are fetched late.
Changelog: [Internal]
Reviewed By: rubennorte
Differential Revision: D63858486
fbshipit-source-id: 29d74a68f96a7d4c7b212453d7c0ceba525f3e39
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46841
Some apps are crashing because surfaces are started and stopped concurrently and this can create a deadlock.
This is an attempt to disentangle the deadlock by not moving synchronously to the main queue when starting a surface
## Changelog
[iOS][Changed] - Do not move to the main queue synchronously when starting a new surface
Reviewed By: fkgozali
Differential Revision: D63899469
fbshipit-source-id: 98cb313ebd610c65f6b06a683912856a00102e44
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46747
You can now use unions in native modules.
Support for this pretty much existed, but one callsite was throwing for non-cpp modules which meant nobody could use this.
Previously, StructCollector would throw that this was not supported because it couldn't generate it for objc. Instead of generating something smart in the native code for each option, it just tells native to treat them like the base type (number, string, object).
Changelog: [General][Added] Codegen now supports Union Types in NativeModules
Reviewed By: GijsWeterings
Differential Revision: D63664505
fbshipit-source-id: 73278ed9cd64452173c5170aba44ced71181510f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46826
This change adds `isDarkerSystemColorsEnabled()` to `AccessibilityInfo` to enable access to iOS's "Increase Contrast" setting option. It also adds a new event, `darkerSystemColorsChanged`, to enable listeners to subscribe to changes on this setting.
## Changelog
[iOS][Added] - Added `isDarkerSystemColorsEnabled()` to `AccessibilityInfo` to read "Increase Contrast" setting value
Reviewed By: cipolleschi
Differential Revision: D63880393
fbshipit-source-id: a476f8fc4d7354826bc344876b359eb1a3485f0d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46816
This converts the same native module from Java to Kotlin.
I've converted the whole module as it was quite simple + I've fixed some of the warnings.
Changelog:
[Internal] [Changed] - Convert react/nativemodule/samples/ to Kotlin
bypass-github-export-checks
Reviewed By: javache
Differential Revision: D63837631
fbshipit-source-id: bb126d7649a6e8a36510bf2b252ecdfae91fe09f
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:
- ME2E0017
- ME2E0018
## 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 ] [ Added ] - Add e2e test for button
Pull Request resolved: https://github.com/facebook/react-native/pull/46829
Test Plan:
yarn e2e-test-ios
yarn e2e-test-android
Reviewed By: rshest
Differential Revision: D63889079
Pulled By: cipolleschi
fbshipit-source-id: ca2ede3142d77170fcb4121b025eab56818ffb07
Summary:
This pr is part of issue https://github.com/facebook/react-native/issues/46757 solving tasks [ME2E0001] and [ME2E0002].
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry.
Pick one each for the category and type tags:
For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[ Internal ] [ Added ] - Add e2e test for modal
Pull Request resolved: https://github.com/facebook/react-native/pull/46796
Test Plan:
yarn e2e-test-ios
yarn e2e-test-android
Reviewed By: cortinico
Differential Revision: D63829299
Pulled By: cipolleschi
fbshipit-source-id: ff64d0babde8aea6e2586c2f69056a10533750f9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46832
After bumping to minIOSVersion 15.1, we refactored the code to remove some check.
In the refactoring, we changed how the `keyWindow` is returned and now we are unsafely casting `UIScene` to `UIWindowScene`.
We have some internal apps that use `UIScene` that are not `UIWindowScene` and the change is causing them to crash.
This change fixes the crash by checking whether the selector is available in the UIScene and casting it only in that case.
Otherwise we return `nil`, the same behavior we used to have before the refactor.
## Changelog
[iOS][Fixed] - Cast the UIScene to UIWindowScene only if the scene respond to the selector
Reviewed By: javache
Differential Revision: D63890980
fbshipit-source-id: 3230e0075f06ed3f3d759b48f9c7bd13d8787b44
Summary:
Part of this: https://github.com/facebook/react-native/issues/46757
Solves:
- ME2E0011
- ME2E0012
## 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 ] [ Added ] - Add e2e test for button
Pull Request resolved: https://github.com/facebook/react-native/pull/46805
Test Plan:
```
yarn e2e-test-ios
yarn e2e-test-android
```
Reviewed By: cortinico
Differential Revision: D63829243
Pulled By: cipolleschi
fbshipit-source-id: 87d8e62650c66fb07e116877a212eff79f10eaf2
Summary:
This PR moves `RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED` as it was used as string in the codebase and in OSS libraries.
## Changelog:
[IOS] [FIXED] - move RCTNotifyEventDispatcherObserversOfEvent_DEPRECATED to const
Pull Request resolved: https://github.com/facebook/react-native/pull/46833
Test Plan: CI Green
Reviewed By: cipolleschi
Differential Revision: D63891220
Pulled By: javache
fbshipit-source-id: d4fa1f751b4b0cb131ab6c6d4dd0a345762d7c71
Summary:
I discovered this while working on my shim of `UIGraphicsImageRenderer` for macOS (See https://github.com/microsoft/react-native-macos/pull/2209). A variable of type`CGColorRef` is not automatically retained and released when passed into a block. There was a case in `RCTBorderDrawing` where we were doing so. To fix this, we have two options:
1. Pass a `UIColor` instead (Requires a change to the signature of the function calling it)
2. Properly retain and release the variable.
The first option would technically be a breaking change (we would need to change the signature of `RCTGetBorderImage`, so I'm opting for option 2.
## Changelog:
[IOS] [FIXED] - Properly retain/release backgroundColor in RCTBorderDrawing
Pull Request resolved: https://github.com/facebook/react-native/pull/46797
Test Plan: CI should pass. Locally, borders still draw fine for me.
Reviewed By: joevilches
Differential Revision: D63827824
Pulled By: cipolleschi
fbshipit-source-id: 926601d062b90a7d741d7a1af3070cec4b8795ae
Summary:
This fixes an issue where `POST /open-debugger?appId&device&target` does not return a proper status code, meaning that the request will never be answered and clients might hang until the request timeout is hit.
## 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
-->
[GENERAL] [FIXED] - Respond with status code `200` when successfully launching RNDT
Pull Request resolved: https://github.com/facebook/react-native/pull/46814
Test Plan:
- `curl -v -X POST "<deviceUrl>"`
- This should show a proper response for the request.
before | after
--- | ---
 | 
Reviewed By: NickGerleman
Differential Revision: D63837025
Pulled By: huntie
fbshipit-source-id: ac72fc793e015f0eec498f4a35b4fb9e301c5b32
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46787
This issue was raised by a some partner that were integrating with libraries that were setting the wrong C++ version.
With this change, RN takes ownership of the version of C++ that must be supported.
## Changelog
[iOS][Breaking] - Cocoapods decide the C++ version for iOS pods
Reviewed By: blakef
Differential Revision: D63760271
fbshipit-source-id: 5e629c61accd97fb10a199430d31e8b4c73d482b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46160
We use this for all built-in components now, and rely on going through `BackgroundStyleApplicator` to be able to set additional background effects like borders, rounded corners, box shadow, outlines.
Let's use this in `BaseViewManager`, to allow exposing those other effects to all views, letting RN manage the background drawable for views using `BaseViewManager` and exposing the props for the managed styles.
This is technically breaking, in the case where a custom component could previously inherit directly from `BaseViewManager`/`ReactViewGroupManager`, (vs `SimpleViewManager`/`ReactViewManager`), then override `setBackgroundColor` on the Android View, instead of the view manager, but this effected zero of the [276 top libraries](https://github.com/elicwhite/react-native-libraries), so I don't think it would be common to hit.
Changelog:
[Android][Breaking] - Use BackgroundStyleApplicator when setting background color in BaseViewManager
Reviewed By: tdn120
Differential Revision: D61658739
fbshipit-source-id: 15af649328ea18fda3cd68e56d481ed1c0fd43c4
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46800
X-link: https://github.com/facebook/yoga/pull/1716
Had a mini heart attack thinking I set the default to content box. Wrote this to double check and it passed. Might as well check it in
Technically the default to BoxSizing.h is ContentBox, but in the style we override that. Regardless I switched that around so border box was the default.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D63802722
fbshipit-source-id: 49ed29657c964bc12a2bf70988061ab4599267ec
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46712
## Summary
Now that XML resources are loaded via Fresco decoder, this change removes the custom branch that attempts to load drawables on the main thread. Loading (i.e. binary XML decompression) is performed on a background decoder thread from Fresco the same as every other image type.
## Changelog
[Android][Fixed] - Avoid blocking the main thread when decompressing drawable resources
Reviewed By: javache
Differential Revision: D63476282
fbshipit-source-id: a8510d140f85a55b90bf4aab6fd4cf5e46dfc7fd
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/46812
Convert to Kotlin as close a 1:1 as possible.
Changelog: [Internal]
Reviewed By: alanleedev
Differential Revision: D63773448
fbshipit-source-id: 72d67ec5993ffb225b016937e6a33fc8d4a8af16