Commit Graph
29104 Commits
Author SHA1 Message Date
Dmitry Rykun 4fbe05577b Enable native view configs in bridgeless mode in OSS (#39476)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39476

This diff enables native view config interop layer in bridgeless mode by default for OSS.
It also removes redundant `enableNativeViewConfigsInBridgelessMode` JS feature flag.
Changelog: [General][Added] - Native view config interop layer enabled in bridgeless mode.

Reviewed By: luluwu2032

Differential Revision: D49318325

fbshipit-source-id: ea2e38b2ea10637b578d98e38d97eed923498fb3
2023-09-26 09:59:16 -07:00
Dmitry Rykun 3eb8e4d482 Make hermesc build script to run in a clean build environment (#39662)
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
2023-09-26 09:58:00 -07:00
Arushi Kesarwani 35a66302d0 Reduce visibility of functions in ReactHostImpl (#39640)
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
2023-09-26 07:30:41 -07:00
Cookiezby 8c779cd630 fix: typo at utils.rb (#39572)
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
2023-09-26 06:57:52 -07:00
Nicola Corti 63ca55bdcc Unblock build-from-source on nightlies (#39634)
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
2023-09-26 06:26:55 -07:00
lizhiqiang05 babbc3e43c fix: Text cut off issues when adjusting text size and font weight in system settings (#39581)
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
2023-09-25 20:07:06 -07:00
Alan Hughes 6118aff69d fix: over reporting trait changes (#39439)
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
2023-09-25 20:00:41 -07:00
David Vacca 27b631e5b0 reactHostInterface -> reactHost (#39636)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39636

rename ReactApplication.reactHostInterface -> ReactApplication.reactHost

changelog: [internal] internal

Reviewed By: cortinico, arushikesarwani94

Differential Revision: D49610674

fbshipit-source-id: 24ddf410cf6aae176f673dc574216a3a12f25767
2023-09-25 18:09:13 -07:00
Saad Najmi c62d174989 Remove undefined references to OCMock from RNTesters' pbxproj (#39616)
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
2023-09-25 16:28:11 -07:00
Saad Najmi 036d5072b1 Don't load RCTRootViewIntegrationTestsApp.bundle in objc-test.sh (#39615)
Summary:
https://github.com/facebook/react-native/pull/38871/ removed all the RCTRootViewIntegrationTest stuff. Looks like we missed a line so I'm removing now.

## Changelog:

[INTERNAL] [FIXED] - Don't load RCTRootViewIntegrationTestsApp.bundle in objc-test.sh

Pull Request resolved: https://github.com/facebook/react-native/pull/39615

Test Plan: CI should pass

Reviewed By: cipolleschi

Differential Revision: D49612227

Pulled By: ryancat

fbshipit-source-id: c16dcf7bec0bdfa839d250cfa6eadf83d792ae0d
2023-09-25 16:28:11 -07:00
Lulu Wu a07c31bb4b Add DefaultReactHost for Template (#39585)
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
2023-09-25 14:54:04 -07:00
Dmitry Rykun 3f1ee478bb Native view configs in bridgeless mode: constantsToExport support (#39519)
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
2023-09-25 14:23:56 -07:00
Dmitry Rykun 2de964cfd2 Set runtime config provider for the Template (#39633)
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
2023-09-25 13:03:57 -07:00
Sunbreak af7bf9371c Fix typo of JSI module Cpp codegen (#39604)
Summary:
Fix code generatetion comment from `GenerateModuleH.js` to `GenerateModuleCpp.js`

## Changelog:

[GENERAL] [FIXED] - Fix typo of JSI module Cpp codegen

Pull Request resolved: https://github.com/facebook/react-native/pull/39604

Test Plan: None

Reviewed By: christophpurrer

Differential Revision: D49558245

Pulled By: cortinico

fbshipit-source-id: 28b6a6f4da0f5f973717f785fe21db86179f1996
2023-09-25 12:30:34 -07:00
Thibault Malbranche 87d2ea9c36 Add 0.72.5 changelog (#39628)
Summary:
Adds changelog for the 0.72.5 patch.

Changelog:
[Internal] [Changed] - Add 0.72.5 changelog

Pull Request resolved: https://github.com/facebook/react-native/pull/39628

Reviewed By: cipolleschi

Differential Revision: D49594657

Pulled By: huntie

fbshipit-source-id: 275092c73bc786a5ec2c1a6a736b2f991fd8ae86
2023-09-25 10:55:26 -07:00
Lulu Wu cee5dceac7 Fix instacrash with RNTester (#39631)
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
2023-09-25 10:51:24 -07:00
Lulu Wu 188eceec98 Fix crash "lateinit property initialProps has not been initialized" (#39632)
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
2023-09-25 10:36:04 -07:00
evanbacon 030663bb06 bump react-refresh to latest (#39486)
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
2023-09-24 07:16:28 -07:00
Rob Hogan 0d23ef5bde Gradle distribution type bin -> all (#39619)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39619

https://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
2023-09-24 06:09:53 -07:00
Pieter Vanderwerff 29f62a41b4 Deploy 0.217.0 to fbsource (#39610)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/39610

Reviewed By: SamChou19815

Differential Revision: D49522399

fbshipit-source-id: 98dc8ce53a4dea2b68909fda5f92251c6cc91717
2023-09-22 17:29:26 -07:00
Bogusz Kaszowski 0f2ecd3254 migrate RNTesterActivity to Kotlin (#39584)
Summary:
PR converts RNTesterActivity to Kotlin as requested in https://github.com/facebook/react-native/issues/38825 .

## Changelog:

[INTERNAL] [CHANGED] - Migrate RNTesterActivity to Kotlin

Pull Request resolved: https://github.com/facebook/react-native/pull/39584

Test Plan:
1. run `yarn android`
2. Check whether RN Tester runs as expected

Reviewed By: cortinico

Differential Revision: D49506304

Pulled By: ryancat

fbshipit-source-id: 7675b43e6ef1d09f9a6e09e5a70526fc59f07bbf
2023-09-22 15:45:30 -07:00
Willa Kong 2fb4547aa0 Revert D49355595: remove uses of folly::hash::fnv32_buf
Differential Revision:
D49355595

Original commit changeset: a75fb91655a7

Original Phabricator Diff: D49355595

fbshipit-source-id: a1a32b869e1539ce931a6b9957e3697e7db72d2a
2023-09-22 11:19:56 -07:00
Willa Kong 0d63a15857 Revert D49358327: introduce fnv1a hashing function
Differential Revision:
D49358327

Original commit changeset: b211da89ca7b

Original Phabricator Diff: D49358327

fbshipit-source-id: b0ae2b9fdddae9616e5ae67f1bbc000ca8b3f52c
2023-09-22 11:19:56 -07:00
Riccardo Cipolleschi 4dd6820aa5 Make template pods resilient to changes to internal podspec (#39601)
Summary:
With this small change, we are binding the cache for the template to the cache of RNTester.
This is helpful because, by default, templates don't have a Podfile.lock of their own. It is normal, as they are app created from the template and we don't enforce the initial
lock of those dependencies.

However, this can cause some hassle when we bump some internal podspec as the cache that is restored in CI will be outdated.
With this change, the podfile.lock for RNTester is different --  we push it when we change the internal podspecs -- so the cache for the template will be invalidated too.

## Changelog:
[Internal] - Invalidate Template caches when we bump internal podspecs

Pull Request resolved: https://github.com/facebook/react-native/pull/39601

Test Plan: CircleCI is green

Reviewed By: christophpurrer

Differential Revision: D49536315

Pulled By: cipolleschi

fbshipit-source-id: 04f1952f029ea643f2d82d2d690fad147faace05
2023-09-22 10:16:18 -07:00
Rob Hogan 2613e8d9db Bump Gradle to 8.3 (#39603)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39603

Bump Gradle to latest stable: 8.3.

Changelog:
[Internal] [Changed] - Gradle to 8.3

Reviewed By: christophpurrer

Differential Revision: D49537003

fbshipit-source-id: 75297f9108cd325a6118a2d416401e306cadd1b8
2023-09-22 09:19:05 -07:00
Samuel Susla 353b31c7da introduce fnv1a hashing function (#39515)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39515

changelog: [internal]

Implements FNV hashing algorithm: http://www.isthe.com/chongo/tech/comp/fnv/

Reviewed By: javache

Differential Revision: D49358327

fbshipit-source-id: b211da89ca7b6bea6ed1b0732e639bbc2de210f7
2023-09-22 05:53:13 -07:00
Samuel Susla e5b62b5ecd remove uses of folly::hash::fnv32_buf (#39509)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39509

changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D49355595

fbshipit-source-id: a75fb91655a7252c4208415940cf9766f750a8ab
2023-09-22 05:53:13 -07:00
Samuel Susla aa03cc0b75 use string_view instead of const char* in PerformanceObserver APIs (#39513)
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
2023-09-22 05:53:13 -07:00
Samuel Susla 4221cba12d remove folly::hash from textlayoutmanager module (#39514)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39514

changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D49350125

fbshipit-source-id: 694533fbc4fb26cce8a1c8b8507d403f28c7840e
2023-09-22 05:53:13 -07:00
Samuel Susla acea828e7a remove folly::hash from mounting module (#39510)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39510

changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D49350102

fbshipit-source-id: 0abfa7a9cf3d91b9913c5fb8602df08a043f30bf
2023-09-22 05:53:13 -07:00
Samuel Susla d51621cc18 remove use of folly::hash from core module (#39508)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39508

changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D49350077

fbshipit-source-id: d698e53e389acd5c77aa4100a846d762be96aea4
2023-09-22 05:53:13 -07:00
Samuel Susla 351b1a20d7 remove folly::hash from graphics module (#39507)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39507

changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D49349976

fbshipit-source-id: 5762b56b853640c21a13167b4ae2b8f966273fce
2023-09-22 05:53:13 -07:00
Samuel Susla 43eb18b1ae remove use of folly::hash from attributedstring module (#39512)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39512

changelog: [internal]

Reviewed By: cipolleschi

Differential Revision: D49349658

fbshipit-source-id: 2b1e3ce2051e995fe5a29a8021c221c69df28ce2
2023-09-22 05:53:13 -07:00
Samuel Susla bf186471d3 introduce hash_combine (#39511)
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
2023-09-22 05:53:13 -07:00
Samuel Susla d6c9a488b2 missing #pragma once (#39506)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39506

changelog: [internal]

for correctness.

Reviewed By: mdvacca

Differential Revision: D49349252

fbshipit-source-id: 9144c5890c2905b3ebabca4cd53ee1c46f9711f1
2023-09-22 05:53:13 -07:00
Riccardo Cipolleschi 52104c6ee3 Update nightlies to bump all the packages in the monorepo and transitive dependencies (#39600)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39600

This change will publish all the packages in the monorepo that are not private as during the nightlies, taking also care of keeping the transitive dependencies aligned.

## Changelog:
[Internal] - Bump packages and transitive dependencies when doing nightlies.

Reviewed By: huntie

Differential Revision: D49502330

fbshipit-source-id: 85e2bde13ed2b5dfe33072c9f99f5aaa2c5063ca
2023-09-22 05:02:43 -07:00
Alex Hunt 3ef7de848d Improve remote debugging LogBox message, cleanup unused openURL method (#39582)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39582

Some tidying up around remote JS debugging while testing. See also https://github.com/react-native-community/cli/pull/2083.

## Changelog:
[iOS][Breaking] - Remove `openURL` method from `RCTInspectorDevServerHelper`

Reviewed By: cipolleschi

Differential Revision: D49499068

fbshipit-source-id: 843ef6cf1af658756466854fc1a0b3edd91c1f37
2023-09-22 04:43:11 -07:00
Willa Kong 8c5340fd96 Revert D49413562: Static view configs take precedence over native view configs
Differential Revision:
D49413562

Original commit changeset: d65776cd43ea

Original Phabricator Diff: D49413562

fbshipit-source-id: e0f8670f0725412740142fd2c41e1eaeb9ca4c8a
2023-09-21 19:20:42 -07:00
Saad Najmi 8fa1127c35 updateIphoneOSDeploymentTarget -> updateOSDeploymentTarget (#39570)
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
2023-09-21 19:14:34 -07:00
Nick Gerleman 7a8251ec7d Remove FloatOptional related TODOs
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
2023-09-21 18:14:46 -07:00
David Vacca f39952ba78 Update UnsupportedOperationException message in TurboReactPackage (#39564)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39564

Update UnsupportedOperationException message in TurboReactPackage

changelog: [internal] internal

Reviewed By: christophpurrer

Differential Revision: D49440132

fbshipit-source-id: 09ee013fcad8d18259f35b57564ea9a382907841
2023-09-21 12:22:02 -07:00
Adam Grzybowski 783150f37b Don't use setState for disabled KeyboardAvoidingView to avoid re-renders (#38074)
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
2023-09-21 11:43:41 -07:00
Alex Hunt 1e44a5f518 Bump CLI to 12.0.0-alpha.15 (#39576)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39576

Changelog: [Internal]

Reviewed By: cipolleschi

Differential Revision: D49496981

fbshipit-source-id: bae2a5fed9d795afcd58e8e24c3ff47c01707d4e
2023-09-21 10:18:51 -07:00
Elmer Banda 1bda78f2fa Add mock removeEventListener and currentState method for AppState (#39578)
Summary:
Add mock removeEventListener and currentState method for AppState

When testing the React Native page by Jest, the error TypeError: import_react_native.AppState.removeEventListener is not a function will be reported.

## Changelog:

[General] [ Changed ] - Add mock removeEventListener and currentState method for ```AppState```

Pull Request resolved: https://github.com/facebook/react-native/pull/39578

Test Plan:
Print AppState module output
```
AppState: {
      addEventListener: [Function: mockConstructor] {
        _isMockFunction: true,
        getMockImplementation: [Function (anonymous)],
        mock: [Getter/Setter],
        mockClear: [Function (anonymous)],
        mockReset: [Function (anonymous)],
        mockRestore: [Function (anonymous)],
        mockReturnValueOnce: [Function (anonymous)],
        mockResolvedValueOnce: [Function (anonymous)],
        mockRejectedValueOnce: [Function (anonymous)],
        mockReturnValue: [Function (anonymous)],
        mockResolvedValue: [Function (anonymous)],
        mockRejectedValue: [Function (anonymous)],
        mockImplementationOnce: [Function (anonymous)],
        mockImplementation: [Function (anonymous)],
        mockReturnThis: [Function (anonymous)],
        mockName: [Function (anonymous)],
        getMockName: [Function (anonymous)]
      },
      removeEventListener: [Function: mockConstructor] {
        _isMockFunction: true,
        getMockImplementation: [Function (anonymous)],
        mock: [Getter/Setter],
        mockClear: [Function (anonymous)],
        mockReset: [Function (anonymous)],
        mockRestore: [Function (anonymous)],
        mockReturnValueOnce: [Function (anonymous)],
        mockResolvedValueOnce: [Function (anonymous)],
        mockRejectedValueOnce: [Function (anonymous)],
        mockReturnValue: [Function (anonymous)],
        mockResolvedValue: [Function (anonymous)],
        mockRejectedValue: [Function (anonymous)],
        mockImplementationOnce: [Function (anonymous)],
        mockImplementation: [Function (anonymous)],
        mockReturnThis: [Function (anonymous)],
        mockName: [Function (anonymous)],
        getMockName: [Function (anonymous)]
      },
      currentState: [Function: mockConstructor] {
        _isMockFunction: true,
        getMockImplementation: [Function (anonymous)],
        mock: [Getter/Setter],
        mockClear: [Function (anonymous)],
        mockReset: [Function (anonymous)],
        mockRestore: [Function (anonymous)],
        mockReturnValueOnce: [Function (anonymous)],
        mockResolvedValueOnce: [Function (anonymous)],
        mockRejectedValueOnce: [Function (anonymous)],
        mockReturnValue: [Function (anonymous)],
        mockResolvedValue: [Function (anonymous)],
        mockRejectedValue: [Function (anonymous)],
        mockImplementationOnce: [Function (anonymous)],
        mockImplementation: [Function (anonymous)],
        mockReturnThis: [Function (anonymous)],
        mockName: [Function (anonymous)],
        getMockName: [Function (anonymous)]
      }
    }
```

Reviewed By: yungsters

Differential Revision: D49504249

Pulled By: robhogan

fbshipit-source-id: c0528ca9da4711f4c39bd2db29bcd34e77c6d4d2
2023-09-21 10:05:13 -07:00
Riccardo Cipolleschi 42d090c94c Fix local e2e script by copying the hermes' ruby files to the right folder (#39580)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39580

While testing other features, I realized that the script to generate a project locally, starting from the template, has a bug for which we were using the outdated `hermes-engine.podspec` coming from the Hermes repo to build hermes.

This change fixes this by moving our files to the right folder.

## Changelog:
[Internal] - Fix local e2e test script copying hermes rubyscript over

Reviewed By: dmytrorykun

Differential Revision: D49497716

fbshipit-source-id: f1d582ec9d9c8007cbd2f9c876c061af12735f83
2023-09-21 07:36:28 -07:00
Dmitry Rykun 1c1652d5a9 Static view configs take precedence over native view configs (#39534)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39534

Fetching native view configs is computationally intensive work, so if some component has both native and static VCs, we should try static first.
This diff changes the `NativeComponentRegistry` so it tries to get static view config first, and then native view config as a fallback.
This diff also removes setting `RuntimeConfigProvider` from RNTester. As it was there for the same purpose of inverting that precedence.
Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D49413562

fbshipit-source-id: d65776cd43eaa97d880b76385423c65e4e8744ba
2023-09-21 07:22:05 -07:00
Lulu Wu 72bf2e87e2 Enable Bridgeless for template (#39527)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39527

So that Templace is able to switch to Bridgeless

Reviewed By: fkgozali

Differential Revision: D49150891

fbshipit-source-id: 782a6ffc4f8b21c0106458f6f16043df65ccd183
2023-09-21 06:56:19 -07:00
Riccardo Cipolleschi 780567c727 Refactor publish-npm args to be more safe (#39532)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39532

This change refactors how we handle the parameters of publish-npm so we can only accept the build types we actually support.

## Changelog:
[Internal] - Make publish-npm args stricter

Reviewed By: cortinico

Differential Revision: D49374263

fbshipit-source-id: a17ddecc0ddcb30858dd0baaab8990ae765d304f
2023-09-21 04:35:41 -07:00
Alex Hunt eaec4f7fda Fix Codegen build script on EdenFS (#39566)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39566

Fixes running the `build.sh` script for `react-native-codegen` when on [EdenFS](https://github.com/facebook/sapling). This would previously fail due a filesystem "unable to copy extended attributes" error.

This only affects development within the React Native monorepo. Practically, this equates to a workflow improvement for Meta engineers when creating `RNTester` builds.

NOTE: **This is temporary**. The change from `mv` to `cp -R` makes this script more expensive, which will make Android builds via Gradle take slightly longer. I have a WIP cleanup planned which will 1/ move `react-native-codegen` to the [shared monorepo build setup](https://github.com/facebook/react-native/pull/38718), and 2/ drop this step entirely from the Android Gradle build.

Changelog: [Internal]

Reviewed By: christophpurrer

Differential Revision: D49468891

fbshipit-source-id: 25d5db81798cf8ab150a135174a45f4d4c2cb5a2
2023-09-21 04:09:43 -07:00
Nick Gerleman ea85b31354 Remove usage of Dimension arrays and YGDimension as index (#39567)
Summary:
X-link: https://github.com/facebook/yoga/pull/1402

Pull Request resolved: https://github.com/facebook/react-native/pull/39567

This change hides away most usages of YGDimension as an index. We do this for a couple reasons:

1. Right now the style interface may return a full array of resolved edge or dimension values, as a CompactValue. As we abstract away from CompactValue, and move towards ValuePool, this will no longer be the internal interface, and cheap to return. We instead change the interface to return a single value at once, which lets us resolve values lazily.

2. As we move internal usage to scoped enums, enums are not implicitly convertible to intergers (broadly a good thing). Hiding the enum as index prevents the need for callers to cast or convert to underlying.

Instead of making a new version of `IdxRef` for this, I converted to a more traditional setter. I will be making similar changes later for other styles, when I hide CompactValue from the public interface.

To review I would recommend filtering to changes in `xplat`, or viewing this in a single one of the OSS PRs exported. Everything apart from the below 20 files is a mirror.

{F1096792573}

Changelog: [Internal]

Reviewed By: javache

Differential Revision: D49362819

fbshipit-source-id: 30d730d78e62f36597d43f477120f65694e51ea3
2023-09-20 16:19:59 -07:00