Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42230
While developing Xcode 15, Apple reimplemented the linker.
In Xcode 15.0, the linker was making old iOS (< 15) crash when they were built using Xcode 15.
To fix that, we make Apple create new compiler flags (`-ld_classic`) to have a backward compatible linker.
In Xcode 15.1, Apple fixed that behavior, so the flags should not be required anymore.
But now, if we pass `-ld_classic` to the linker and we have an app that is using `use_framworks!`, that app crashes at startup.
This change remove the flags if the Xcode that is used is 15.1 or greater.
*Note:* The previous change added the flags to Hermes as well. I tested this fix in a configuration where Hermes has the flags and React Native does not, and it works. So we are removing the flags only from React Native.
This Fixes https://github.com/facebook/react-native/issues/39945
## Changelog:
[Internal] - Do not add the `-ld_classic` flag if the app is built with Xcode 15.1 or greater.
Reviewed By: cortinico
Differential Revision: D52658197
fbshipit-source-id: 37d6bc895921c0fc3661f301870477191e7e42b3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42185
We've rolled out some changes to the behavior here, mainly that throttling no longer happens by default on iOS.
This updates the documentation, in concert with https://github.com/facebook/react-native-website/pull/3971
Changelog:
[General][Changed] - Update API docs for scrollEventThrottle
Reviewed By: javache
Differential Revision: D52516092
fbshipit-source-id: 7be1d6e1bc62f38c795b64ad4be5d5c1b23bb742
Summary:
## Stack
These can suss out some real bugs, and helps further avoid mismatch with downstream MSVC on /W4 as used by MSFT.
I enabled the families of warnings, but suppressed some major individual warnings that weren't clean. But I did clean some up, notably, missing initializer, and shortening 64 bit to 32 bit. We can do some of the rest incrementally (e.g. `-Wunused-parameter` has a fixit).
This change illuminates that MapBuffer is missing 64 bit integer support, but we often pass 64 bit counters to it, which is a bug. For now I just left TODOs around those.
`rn_xplat_cxx_library` is used for external libraries interfacing with RN, which we probably don't want to police, so I structured these stricter warnings as an opt-in flag, only enabled for our own rules.
## Diff
This fixes up source code to avoid emitting the extra warnings now enforced. Of what is enabled, this is mostly shortening 64 to 32, or missing field in initializer.
Changelog: [Internal]
Reviewed By: christophpurrer
Differential Revision: D52589303
fbshipit-source-id: 11cb778d065799fd0ead3ae706934146d13500bb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42214
These methods are only used in the legacy React renderer. The Fabric renderer calls into different methods. So, let's just leave these unimplemented.
NOTE: I introduced the warning back into clearJSResponder, because I couldn't find the internal call-site to it.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D52449787
fbshipit-source-id: bd001c0ca4a3e64aaaf6328b3322025b09ee6da9
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42218
## Changes
This diff makes the native view config interop layer on Android lazy.
As in: ViewManagers that were registered lazily with React Native will no longer be eagerly initialized by the nvc interop layer.
Changes to UIManager apis:
- UIManager.getConstants() now **only** contains the view configs for the eager view managers.
- UIManager.getConstantsForViewManager(name): lazily load view configs for lazy components
- UIManager.getDefaultEventTypes(): load default event types
- UIManager.getConstants().LazyViewManagersEnabled: true, if there are lazy view managers
- UIManager.getConstants().ViewManagerNames: a list of the lazy view managers
Changelog: [Internal]
Reviewed By: dmytrorykun
Differential Revision: D52399280
fbshipit-source-id: d9cd46de0507ecfe6cca5595a237e1063f60fa62
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42213
This improves resiliency of the native view config interop layer.
In open source, some packages might provide ViewManagers eagerly, while others might them lazily.
This also fixes another problem: Prior, eager view managers would be created **then destroyed *wastefully*** by the native view config interop layer.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D52399003
fbshipit-source-id: 3345c82789f1ed8e613139a8323dac4b4a01d173
Summary:
This diff should not change any behaviour.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D52399000
fbshipit-source-id: 976f5740c53d58ceead7d2bc4c9e0eb3f97ebb4e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42215
This diff should not change any behaviour.
**Why:** This logic is only used once from the UIConstantsProviderManager. So, let's just inline it. Inlining this method will make ReactInstance.java have fewer private methods, which'll make ReactInstance.java easier to read.
**Concern:** Inlining this method into ReactInstance's constructor will make the constructor too hard to read.
- I think it'll be fine: we will simplify this method significantly in D52399003.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D52399002
fbshipit-source-id: 8c0dc69af86109da8144546347eecd2e01c0e0be
Summary:
When a FlatList is in side a scroll view (think Netflix style navigation), the DPAD up/down fires on the scroll view, despite scrollEnabled={false} being set. This additiontially conflicts with any custom scroll event that has been created.
## Changelog:
[Android] [Fixed] - fix: prevent scroll event in nested scroll when scrollEnabled={false}
Pull Request resolved: https://github.com/facebook/react-native/pull/42219
Test Plan:
I tested this by making a ScrollView with FlatList of opposite scrolling direction inside with basic card layouts.
Both had scrollEnabled={false}
I scrolled the ScrollView myself as it has multiple rows using:
```
const scrollToItem = React.useCallback(
(itemIndex: number): void => {
const targetScrollY = itemIndex * height
scrollViewRef.current?.scrollTo({ y: targetScrollY, animated: true })
},
[height]
)
React.useEffect(() => {
// Row 0, is global nav, but it's also the first row of cards
// when we scroll to "1" what we mean is global nav is hidden
// we should still be showing the first row of items.
scrollToItem(rowIndex <= 1 ? 0 : rowIndex - 1)
}, [rowIndex, scrollToItem])
```
Reviewed By: NickGerleman
Differential Revision: D52642168
Pulled By: mdvacca
fbshipit-source-id: 9305bc56ba6b03b04b9f69a14d433593cab2025e
Summary:
`compose-source-maps.js` fails if `-o` is not specified when it should output the composed source map.
## Changelog:
[GENERAL] [FIXED] - Fix `compose-source-maps.js` failing if `-o` is not specified when it should output the composed source map
Pull Request resolved: https://github.com/facebook/react-native/pull/42203
Test Plan:
Tested this in an internal repo. This was the output before this fix:
```
% node node_modules/react-native/scripts/compose-source-maps.js dist/main.jsbundle.map dist/main.jsbundle.hbc.map
node:internal/streams/writable:472
throw new ERR_INVALID_ARG_TYPE(
^
TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received undefined
at _write (node:internal/streams/writable:472:13)
at Writable.write (node:internal/streams/writable:494:10)
at Object.<anonymous> (/~/node_modules/.store/react-native-virtual-c8e66dddc1/node_modules/react-native/scripts/compose-source-maps.js:64:20)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
at node:internal/main/run_main_module:28:49 {
code: 'ERR_INVALID_ARG_TYPE'
}
Node.js v20.10.0
```
Reviewed By: christophpurrer
Differential Revision: D52650438
Pulled By: arushikesarwani94
fbshipit-source-id: b8f8f01fb6d843887d874a7283a1a6807c7762e7
Summary:
Dependency on `chalk` was introduced in https://github.com/facebook/react-native/pull/37510, but was never declared. In pnpm setups, the CLI fails to run because of this.
This needs to be picked to 0.73.
## Changelog:
[GENERAL] [FIXED] - Declare missing dependency `chalk`
Pull Request resolved: https://github.com/facebook/react-native/pull/42235
Test Plan: n/a
Reviewed By: huntie
Differential Revision: D52660337
Pulled By: cortinico
fbshipit-source-id: 1cd45fcff72045c127773566a27103f1b38262b3
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42233
This diff removes the need for providing the `ios_folder` argument to `use_react_native`. We no longer do any manual path tranformations to get the iOS project root.
Instead we use `Pod::Config.instance.installation_root` which always points to the correct directory.
Changelog: [iOS][Breaking] - CocoaPods: remove the `ios_folder` argument from the `use_react_native` function.
Reviewed By: cipolleschi
Differential Revision: D52659429
fbshipit-source-id: 67c79cd9d74a0351ad2c242b74cbd48b6bd2dc94
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42207
In open source, with the new architecture, layout animations are **always** enabled.
They cannot be disabled.
Therefore, when this UIManagerModule method is called with false, just report an error. That way, if layout animations were explicitly disabled on Android, the developer will know, when they try to enable the new architecture.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D52349297
fbshipit-source-id: 7969bd7294ce7369643004e5ff7e0c1ed4a59cd6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41998
Now the error message propts people to turn on the interop layer.
And, it adds more details to the suggestion to use hasViewManager(viewManagerName).
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D52002909
fbshipit-source-id: 80ea60b4f6a5fe15d773bb1f3f41de5ce43d6652
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42067
These methods should not be implemented in the new architecture.
The **only** code that called these UIManagerModule methods was the paper renderer. And the New Architecture should instead use the Fabric renderer.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D52345416
fbshipit-source-id: 76511aa97e5dfa938aca658af03fb43122547df1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/41997
Many methods on PaperUIMangaer are iOS only.
Many methods on PaperUIManager are Android only.
This diff makes sure that BridgelessUIManager only exports Android methods on Android, and iOS methods on iOS.
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D52012876
fbshipit-source-id: 6527048083eae93577a58d4b77f0645fab84217f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42200
Changelog: [Internal]
Quick hack to make it easy to determine whether a given build of React Native is using the C++ implementation of InspectorPackagerConnection or the legacy platform-specific implementation.
For now, we just append this information to the `title` field. Ultimately, rather than polluting the title, this should be an inert capability flag that gets reported via `inspector-proxy`. I'm not doing that yet since we have work in the pipeline to set up a proper capability flag system soon.
Reviewed By: huntie
Differential Revision: D52629415
fbshipit-source-id: a4e873f4be78ae49b35b94fd5d41d0e2efc02dbe
Summary:
PR https://github.com/facebook/react-native/pull/42159 was working but it was the wrong fix.
The right fix is to use the `"PUBLIC_HEADERS_FOLDER_PATH"` Xcode build setting instead.
bypass-github-export-checks
## Changelog:
[iOS][Changed] - Revert "Update Yoga.podspec: fixes archiving for macos catalyst on react-native 0.73.1 in xcode"
## Facebook:
Original commit changeset: 21b9b3568986
Original Phabricator Diff: D52624342
Reviewed By: arushikesarwani94
Differential Revision: D52656133
fbshipit-source-id: 84a37fe3fca57d5e34139c17c6c1957fe8d40aaf
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42165
This will help avoid a name collision when we remove the new suffix from newGetOrCreateReactInstanceTask.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D52495532
fbshipit-source-id: 79a04cff51eef07b91876a1351b8444654a79274
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42187
Updates the docblocks for `Pressability` and `usePressability`, as suggested in the code review for {D52388699}.
Changelog:
[General][Changed] Updated Pressability/usePressability Docblocks
Reviewed By: sammy-SC
Differential Revision: D52604388
fbshipit-source-id: e82dd6caa46fe69281e996cbdb8b8e5105b46955
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42194
Apps that have multiple concurrently running React instances may suffer from issues where tearing down one instance affects the bindings / LongLivedObjectCollection instance of another due to the use of static getter for LongLivedObjectCollection. This should allow host platforms, e.g., react-native-windows (which still forks the TurboModuleBinding C++ files [here](https://github.com/microsoft/react-native-windows/tree/main/vnext/ReactCommon/TEMP_UntilReactCommonUpdate/react/nativemodule/core/ReactCommon) for the reasons already mentioned) to manage per instance LongLivedObjectCollections.
## Changelog
[Internal]
Reviewed By: christophpurrer
Differential Revision: D52581170
fbshipit-source-id: 791e3baeefaf23f544eeddd5a216735535523a9d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42037
Creates an Objective-C wrapper around the C++ version of `InspectorPackagerConnection` (introduced in D52134592), and uses it in React Native iOS apps (behind an internal flag that is off by default).
In future work, the flag will be turned on by default, then deleted, and eventually the legacy `RCTInspectorPackagerConnection` code will be deleted from React Native.
Changelog: [Internal]
Reviewed By: huntie
Differential Revision: D52225495
fbshipit-source-id: f1b9657ef0d665cf7892c15c34c5104e2777ec43
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42018
Creates an JNI wrapper around the C++ version of `InspectorPackagerConnection` (introduced in D52134592), and uses it in React Native Android apps (behind an internal flag that is off by default).
In future work, the flag will be turned on by default, then deleted, and eventually the legacy `InspectorPackagerConnection.java` code will be deleted from React Native.
Changelog: [Internal]
Reviewed By: huntie
Differential Revision: D52231237
fbshipit-source-id: 5a0e3bd8b2b711c1c592db15c51df4c3cc89aaad
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42197
Some std::ranges functions don't work well (or at all) when using
clang, eg see
https://fb.workplace.com/groups/474291069286180/posts/9724112847637243
This works in clang 16, but not clang 15 which fbcode is on. Note that more complicated parts of ranges work, but not these simpler helpers, funnily enough :).
As I'm trying to make RN compile in fbcode, I need clang to work.
Moving them back to iterators, but using rbegin/rend making it fairly readable still.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D52481786
fbshipit-source-id: f37d4e1912b33eee392061dc787afaacd9554409
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42153
This non functional change unifies Folly version and compiler flag in a single function, so that it would be easier to update it in the future.
## Changelog:
[Internal] - Unify folly version and compiler flags
Reviewed By: cortinico
Differential Revision: D52564771
fbshipit-source-id: 9b4b50560ddee05ce50465b6854666572148cb25
Summary:
This PR tries to fix a build error when `import <React/RCTAppSetupUtils.h>` from *.m files. Since the `[[deprecated("")]]` syntax is a C++14 feature and it was placed inside the `RCT_EXTERN_C_BEGIN` block. If the file in imported from Objective-C *.m files or Swift files, it will have a syntax error. Instead of using the C++ syntax, this PR uses the `__deprecated_msg()` statement that is also used in other code in react-native and that is C supported syntax.
bypass-github-export-checks
## Changelog:
[IOS] [FIXED] - Fix RCTAppSetupPrepareApp.h import error from Objective-C *.m files
Pull Request resolved: https://github.com/facebook/react-native/pull/42172
Test Plan:
- test building and importing **RCTAppSetupPrepareApp.h** from a *.m file
- test `RCTAppSetupPrepareApp(application, turboModuleEnabled)` will show a compile warning
Reviewed By: arushikesarwani94
Differential Revision: D52603421
Pulled By: cipolleschi
fbshipit-source-id: bfec8d0ba6378a265ad30dd8ca1d3ab15cff96ed
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42191
X-link: https://github.com/facebook/yoga/pull/1539
React native supports transforms and if a node has a transform it will [form a containing block for absolute descendants regardless of position type](https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block). So we need to pass that information into Yoga to ensure this happens.
The verbiage for the field "alwaysFormsContainingBlock" is very specific. In a vacuum a node cannot simply "form a containing block". It only forms a containing block in reference to a different node. This can be illustrated in a scenario where we have a static node that is a flex container which has 1 absolute child and 1 relative child. This static node will form a containing block for the relative child but not the absolute one. We could just pass the information on rather something has a transform or not but Yoga is not supposed to know about transforms in general. As a result we have a notion of "always" forming a containing block. Since Yoga is a flexbox spec, non-absolute nodes' containing blocks will ways be their parent. If we add something like a transform to a node then that will also apply to absolute nodes - hence we can say the node will **always** form a CB, no matter who is the descendant.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D52521160
fbshipit-source-id: bab9319ffddec617f5281823930f2a00cc2967f2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42190
Essentially undoing D51182861 that was put in place to support adding a default position type to Fabric. Previously I had already removed the code that set the default to something other than Yoga default, but I did not remove all this extra code that allows you to do that. Since we no longer need this we should remove it so as not to encourage messing with the defaults in such a way that they differ from Yoga defaults.
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D52515993
fbshipit-source-id: fb4ab726cf73bf08fd6aa44b99196962a9839694
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/42189
tsia, we had the equality op defaulted so might as well do this for inequality
Changelog: [Internal]
Reviewed By: NickGerleman
Differential Revision: D52515802
fbshipit-source-id: ce31a00eddda991221c91364508fed6df78fd5b4
Summary:
In my mac, I use a case-sensitive volume and when I build a react-native 0.73 project it failed with an error that can't find the hermes release tarball to extract:
```
Node found at: /usr/local/bin/node
Preparing the final location
Extracting the tarball
tar: Error opening archive: Failed to open '/Volumes/Workspace/meet-art-link/ios/Pods/hermes-engine-artifacts/hermes-ios-0.73.1-Release.tar.gz'
```
Note the `...-Release.tar.gz` in the error. In the disk it's `...-release.tar.gz`.
The build fails in after download the release tarball in release mode because the hermes tarball name in the `replace_hermes_version.js` build script is capitalized, while the file is lowercase on disk.
The fix is to ensure the hermes tarball name's "build type" is lowercase just like the function that creates the tarballs in react-native release located in `hermes_utils.js` in `getHermesPrebuiltArtifactsTarballName()`.
Perhaps it's better to retrieve the tarball name from the same method it's generated? E.g.:
```js
const { getHermesPrebuiltArtifactsTarballName } = require('react-native/scripts/hermes/hermes-utils');
const tarballName = getHermesPrebuiltArtifactsTarballName(`${version}-${configuration}`);
const tarballURLPath = `${podsRoot}/hermes-engine-artifacts/${tarballName}`;
```
If yes, let me know to update the PR.
## 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
-->
[iOS][Fixed] - Fix release build error due to a casing issue in hermes tarball path after download prebuilt tarball
Pull Request resolved: https://github.com/facebook/react-native/pull/42160
Test Plan: Use a case sensitive volume or system and build react-native 0.73 in release mode, it will fail. Apply the patch in this PR and it will work fine.
Reviewed By: cortinico
Differential Revision: D52603439
Pulled By: cipolleschi
fbshipit-source-id: 41ed8d8202874f338e4aa3af88d9d28ec1b8b3d5