Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39611
I'm renaming onCatalystInstanceDestroy -> invalidate, this is necessary to converge TurboModuleRegistry -> turboModuleManager in the next diffs of the stack
changelog: [intenral] internal
Reviewed By: arushikesarwani94
Differential Revision: D49469208
fbshipit-source-id: 877c5af6ad0fc378ec9cbd952f33db0ea08f761c
Summary:
This diff is reverting D49509633
D49509633: [react-native][PR] fix: Text cut off issues when adjusting text size and font weight in system settings by ryancat has been identified to be causing the following test or build failures:
Tests affected:
- [xplat/endtoend/jest-e2e/apps/facebook_xplat/ReactNativeTTRCTester/__tests__/ReactNativeTTRCTester-errorReportedManually-android-e2e.js](https://www.internalfb.com/intern/test/281475019301157/)
Here's the Multisect link:
https://www.internalfb.com/multisect/3131615
Here are the tasks that are relevant to this breakage:
We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.
If you believe this diff has been generated in error you may Commandeer and Abandon it.
Reviewed By: NickGerleman
Differential Revision: D49645585
fbshipit-source-id: 414531e067cffa109d0663d6af185dcaf8fb9c4e
Summary:
Fix https://github.com/facebook/react-native/issues/31537: [Android] React Native strips non-ASCII characters from HTTP headers
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Android] [Changed] - Allow non-ascii header values on Android and add utf-8 filename fallback in FormData
Pull Request resolved: https://github.com/facebook/react-native/pull/35060
Test Plan:
1. Clone the `react-native` repo.
2. Build the rn-tester app.
3. Prepare tests
1. Add `android:usesCleartextTraffic="true"` to AndroidManifest.xml
2. Use the following code as a server:
```javascript
const http = require('http');
const requestListener = function (req, res) {
// raw header value
console.log(req.headers['content-disposition']);
// nodejs assumes the header value is ISO-8859-1 encoded
console.log(Buffer.from(req.headers['content-disposition'], 'latin1').toString('utf-8'));
// decode encoded header value if it's sent as UTF-8
console.log(decodeURI(req.headers['content-disposition']));
res.writeHead(200);
res.end();
};
const server = http.createServer(requestListener);
server.listen(3000);
```
3. Run `adb reverse tcp:3000 tcp:3000` to connect the 3000 port on the emulator if necessary.
4. Edit `RNTesterAppShared.js` to include test code:
```javascript
useEffect(() => {
fetch('http://localhost:3000/', {
headers: {
'Content-Type': 'multipart/form-data; charset=utf-8',
'Content-Disposition': `attachment; filename*=utf-8''${encodeURI(
'filename测试abc.jpg',
)}`,
},
}).then(res => {
console.log(res.ok);
});
fetch('http://localhost:3000/', {
headers: {
'Content-Type': 'multipart/form-data; charset=utf-8',
'Content-Disposition': `attachment; filename="filename测试abc.jpg"`,
},
}).then(res => {
console.log(res.ok);
});
}, []);
```
5. Both requests should succeed; without the fix, the second request received by the server will not have the utf-8 characters "测试" in the header value.
Reviewed By: NickGerleman
Differential Revision: D40639985
Pulled By: cortinico
fbshipit-source-id: 005f2481976046a92a26239ad704780ac58d4a44
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39638
# Changelog:
[Internal] - Removing usage of stringByAddingPercentEscapesUsingEncoding
Per deprecation message:
> 'stringByAddingPercentEscapesUsingEncoding:' is deprecated: first deprecated in iOS 9.0 - Use -stringByAddingPercentEncodingWithAllowedCharacters: instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent since each URL component or subcomponent has different rules for what characters are valid.
Reviewed By: cipolleschi
Differential Revision: D49610243
fbshipit-source-id: 7c40ce9f6b643851c8aae8149acde2c435c06a76
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39593
Looking into a crash leads by assertion error in this line, I talked to NickGerleman and we think there might be some case when ContentView is not rendered, so it would have 0 child. Changing the assertion to allow 0 child.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D49508540
fbshipit-source-id: 43c50814ead24332c1b24ff2dea50d564519034b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39662
Hermesc is built with the build script that is executed by Xcode as a "Run script" build phase. For every build Xcode configures environment based on the build target. The Hermesc build script runs in that environment.
**The problem**
If we build for iPhone of iPhone Simulator, then the environment is configured for these platforms, but Hermesc must always be built for macosx.
**The old solution**
Previously we experimentally determined what envvars should be changed for Hermesc build to succeed. But it is not robust, because this may change with new Xcode releases.
**The new solution**
We clear the entire environment and only define `SDKROOT`. This is equivalent to running Cmake outside of Xcode.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D49639599
fbshipit-source-id: f8d8fccb0e61605b1fef9927dc4a3fdf79e4f212
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39640
changelog: [internal] internal
Reducing visibility from public to package only for `ReactHostImpl.getDefaultHardwareBackBtnHandler()` since it's only used within package
Reviewed By: mdvacca
Differential Revision: D49612859
fbshipit-source-id: 3c40888da732f33dc046d9363b08119e707f4ea4
Summary:
Fix typo in `packages/react/native/scripts/cocoapods/utils.rb`
## 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
-->
[iOS] [Fixed] - Fix the typo for the method `is_using_xcode15_or_greater`
Pull Request resolved: https://github.com/facebook/react-native/pull/39572
Reviewed By: dmytrorykun
Differential Revision: D49594275
Pulled By: cortinico
fbshipit-source-id: 8637fc9b10cfad3742b038ed9402585fe2af56b7
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39634
Running build from source as suggested here:
https://reactnative.dev/contributing/how-to-build-from-source
is currently broken for nightly versions (and for 0.73).
This fixes it by:
- Fixing the import of the Gradle Version Catalog
- Actually adding the Gradle version catalog to the NPM package
- Fixing how the build Codegen CLI task is invoked for build-from-source
- Updating the search directories for codegenDir/reactNativeDir from build-from-source
Changelog:
[Internal] [Fixed] - Unblock build-from-source on nightlies
Reviewed By: cipolleschi
Differential Revision: D49562595
fbshipit-source-id: 9594b7d947569d41c461a7e8287d3ae68fb87b98
Summary:
Fix Text cut off issues when adjusting text size and font weight in system settings.
This pr fixed the problem that can be reproduced with the [snack](https://snack.expo.dev/fl5DSrLBJ) on Xiaomi devices with MIUI13 and MIUI14. The problem is shown as the image below: the number "999" is cut off and only "99" is rendered.
<img src="https://github.com/facebook/react-native/assets/23273745/64269ced-4060-4ab5-8233-8199e4f2acbd" width="20%" height="20%" alt="text-cutoff-when-scaling-miui14" />
The problem is produced with setting font scaling in system settings like the image below shows.
<img src="https://github.com/facebook/react-native/assets/23273745/c31d1bf2-d038-4536-b1a4-509050f2aa7c" width="20%" height="20%" alt="settings" />
This text cut off case can be avoided by setting [`allowFontScaling`](https://reactnative.cn/docs/text#allowfontscaling) to false. But this pr can make it no matter what value `allowFontScaling` is set.
The root cause of this case, according to MIUI developers, is that Misans typeface, as a variable font which will adjust the weight of different font axes with different font size, gets different widths when Text is measured and drawn for a bug in the framework of MIUI rom. They will fix this bug in next version while this pr fixed it in old versions.
## Changelog:
[ANDROID][FIXED]-Fix Text cut off issues when adjusting text size and font weight in system settings.
<!-- 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/39581
Test Plan:
The effect after fixed is shown in the image below.
<img src="https://github.com/facebook/react-native/assets/23273745/1f93f47f-5cdf-4ee1-934a-6cb3b04309ea" width="20%" height="20%" alt="fixed" />
Reviewed By: NickGerleman
Differential Revision: D49509633
Pulled By: ryancat
fbshipit-source-id: fd93f14bdbced8026a45dc9e0299465962433de5
Summary:
Closes https://github.com/facebook/react-native/issues/35972
Closes https://github.com/facebook/react-native/issues/36713
This PR addresses a couple of issues with `useColorScheme` and the `Appearance` API.
- https://github.com/facebook/react-native/issues/38214 introduced a regression. Using to `RCTExecuteOnMainQueue` was a mistake as we need this to happen synchronously to return the result. Doing it async causes the `traitCollection` to remain uninitialized.
- The `useColorScheme` hook is updating when the app is in the background on iOS and the OS is taking the snapshots for the app switcher. This causes a flash when returning to the app as the correct color is set again. Here, we can check for the app state in `traitCollectionDidChange` and not send these events when in the background.
- Removed a line that was left over after some OS version checks were removed when support for iOS 12 was dropped.
## Changelog:
[IOS] [FIXED] - Don't send the `RCTUserInterfaceStyleDidChangeNotification` when the app is in the background.
Pull Request resolved: https://github.com/facebook/react-native/pull/39439
Test Plan: Tested on `rn-tester`, logged the changes whenever `useColorScheme` updates. It no longer happens when the app is in the background. The returned interface style on the initial render is always correct now.
Reviewed By: NickGerleman
Differential Revision: D49454281
Pulled By: javache
fbshipit-source-id: 87e24158a49c50608c79e73fb484442f5aad36a6
Summary:
In https://github.com/facebook/react-native/pull/36239 , I removed the copy of libOCMock we had locally in favor of a Pod. The references were left in RNTester's pbxproj and undefined. Let's just remove them.
## Changelog:
[INTERNAL] [FIXED] - Remove undefined references to OCMock from RNTesters' pbxproj
Pull Request resolved: https://github.com/facebook/react-native/pull/39616
Test Plan: CI should pass
Reviewed By: NickGerleman
Differential Revision: D49612102
Pulled By: ryancat
fbshipit-source-id: 85a5a67612dc58d5dba906edc1c56091d22b0978
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39585
So that to enable Bridgeless in Template android we only need to override the ReactHostInterface variable in Template's application, see D49464580
Changelog:
[Android][Changed] - Add DefaultReactHost
Reviewed By: cortinico
Differential Revision: D49463901
fbshipit-source-id: ff6ef1bef8626996a3658597d1519eec310c77c3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39519
If the `constantsToExport` method is overridden by RCTViewManager subclass, we'll out those constants in "Constants" property of the view config.
This diff also defines a property on UIManager for every view configs. This add support for `UIManager.RNTMyLegacyNativeView.Constants.PI` syntax in bridgeless mode.
Changelog: [Internal]
Reviewed By: cipolleschi
Differential Revision: D49372561
fbshipit-source-id: e9333c94ad882ee38a5a3729ccc19330d7736657
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39633
This diff sets runtime config provider for the template. It sets `native` to `false` to prioritize static view configs over native view configs.
Changelog: [Breaking] - Set runtime config provider for the Template.
Reviewed By: luluwu2032
Differential Revision: D49604628
fbshipit-source-id: 0ea19eb76fc67d0df862b82ec4b9d172ae92d56d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39631
Don't display the PopupWindow when current activity is in a bad state, other wise there will be a crash P832378432
Changelog:
[Android][Changed] - Don't display the PopupWindow when current activity is in a bad state
Reviewed By: mdvacca
Differential Revision: D49501328
fbshipit-source-id: 1a51855daa470e8da9399f72ca7211a95388e38f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39632
Found a new [crash](P837035842) caused by converting RNTesterActivity to kotlin in D49506304
Changelog:
[Android][Changed] - fix crash "lateinit property initialProps has not been initialized"
Reviewed By: cortinico
Differential Revision: D49594073
fbshipit-source-id: e6d086f6e9bc64b449e6a3da4bc1903729970e7d
Summary:
- Companion PR to https://github.com/facebook/metro/pull/1085
- The Fast Refresh changes appear to be required for using static rendering and React DOM. In frameworks like Expo Router which support both native and web, this causes users to not be able to use Fast Refresh on web.
## Changelog:
[GENERAL] [CHANGED] - Upgrade React Refresh package from 0.4.0 to 0.14.0
Pull Request resolved: https://github.com/facebook/react-native/pull/39486
Test Plan:
1. In a React Native project's `package.json`:
```json
"resolutions": {
"react-refresh": "~0.14.0"
},
```
2. Start the server with a clear Metro cache.
3. Changes should update while preserving React state.
Reviewed By: huntie
Differential Revision: D49348078
Pulled By: robhogan
fbshipit-source-id: ac3dcb096c35c6c29c6e6a919cf263559bceaa7c
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39619https://github.com/facebook/react-native/pull/39603 unintentionally changed our Gradle distribution type in `gradle.properties` to `bin`. This changes it back to `all` while preserving the upgrade to 8.3.
Generated with
```
./gradlew wrapper --gradle-version=8.3 --distribution-type all
```
Changelog:
[Internal][Changed] Revert Gradle distribution type to ‘all’
Reviewed By: NickGerleman
Differential Revision: D49569492
fbshipit-source-id: fc5b2c8a2c2cea455ed5bd0dbd6743d34b527c9b
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39513
changelog: [internal]
Using std::hash with const char * is dangerous, as it will not hash the contents but only the pointer itself. We want to adopt std::hash in favour of folly to reduce our dependency on folly. One way to fix the issue with const char * is to use std::string_view.
Reviewed By: rshest, cipolleschi
Differential Revision: D49355536
fbshipit-source-id: fd2a7b4558461e913cdf0ec0e8fe878cae2f6015
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39511
changelog: [internal]
C++ standard library doesn't offer a way to combine hashes together. This is implementation for uses in React Native code.
Reviewed By: javache
Differential Revision: D49349539
fbshipit-source-id: 1e1f47585969181d5910f5bbc5b6ebfffa12e96b
Summary:
While merging new commits into React Native macOS, I noticed https://github.com/facebook/react-native/pull/39478/
I would like to also set `MACOS_DEPLOYMENT_TARGET` in our fork, and thought this slight rename would be something I can do upstream
## Changelog:
[Internal] - updateIphoneOSDeploymentTarget -> updateOSDeploymentTarget
Pull Request resolved: https://github.com/facebook/react-native/pull/39570
Test Plan: CI should pass
Reviewed By: NickGerleman
Differential Revision: D49514693
Pulled By: ryancat
fbshipit-source-id: b4dafb1f9736d2977510712652cb8097263c489d
Summary:
These were added quite a while ago, and the proprosed change doesn't really make sense to pursue, since FloatOptional is a C++ wrapper around a Float, and the public API is entirely C.
bypass-github-export-checks
Reviewed By: rshest
Differential Revision: D49476343
fbshipit-source-id: f83cc99adda75fc0dba96e063cca92510c3d2ef0
Summary:
There are two reasons to apply these changes:
- We don't need to re-render the `KeyboardAvoidingView` if it is disabled. It may be especially useful in combination with [react-navigation](https://reactnavigation.org/) where we could disable `KeyboardAvoidingView` for screens that are not focused
- They fix the problem with the `KeyboardAvoidingView` wrapped inside the [react-freeze](https://github.com/software-mansion/react-freeze) component. Similarly, as above, it is useful when we want to freeze screens that are not visible for the user.
## Changelog:
[GENERAL] [CHANGED] Don't use setState for disabled KeyboardAvoidingView to avoid re-renders
<!-- 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/38074
Test Plan: - Check if the KeyboardAvoidingView works as expected.
Reviewed By: sammy-SC
Differential Revision: D49148391
Pulled By: blakef
fbshipit-source-id: c4b7bde696d2249cbf4ad12c77058183b632464d