Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39459
## Changelog
[Android][Deprecated] - ReactModuleInfo constructor with getConstants arg is deprecated
introducing a new constructor that doesn't use getConstants and updating the internal codebase to use it. deprecated the old one since it's been copypasta'd a lot in oss.
Reviewed By: cortinico
Differential Revision: D49262824
fbshipit-source-id: 1a4d36b3153d8ce0ee869b8635c94005fe7c9594
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39479
The goal of this diff is to create a feature flag that will be used to enable/disable Stable API for Turbo Module.
This featureflag will be used to experiment with the new API in fb4a
changelog: [intenral] internal
Reviewed By: arushikesarwani94
Differential Revision: D49212022
fbshipit-source-id: 4f4830f11ba18ad849dc8b35f4e178e938b03fc9
Summary:
in this diff, we backout D49335986 to fix the issue where we are losing context from decoding an encoded string all at once via `NSURL URLWithString....`. this fixes the category of issues in https://fb.workplace.com/groups/rn.support/posts/25183724564582821.
however, this will regress the original issue that this fixed (https://fb.workplace.com/groups/rn.support/posts/25129344753354136), where encoding square brackets in the URI is causing percents to be re-encoded, resulting in a mixed uri with mixed encoding, i.e. `%2522%5B%5D`. we will be fixing this by not serving decoding brackets in our php serializer which was originally be the follow-up fix, since that does not respect the RFC.
bypass-github-export-checks
Reviewed By: fkgozali
Differential Revision: D49336101
fbshipit-source-id: 2012390b237de8a16a5e60e880905cec48584873
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39456
**Fixes new debugger launch flow on Android:**
D49158227 aimed to improve proxy-safe behaviour for remote dev servers by auto-detecting the appropriate server URL for clients using the `Host` header (etc) from the HTTP request. However, this approach broke the local case for Android emulators and externally connected devices since they would originate from a device-relative server hostname — e.g. `10.0.2.2` for the stock Android emulator.
https://pxl.cl/3mVmR
This commit reverts to an explicit approach where callers specify the base URL to the dev server that should be addressible from the development machine — now as a single `serverBaseUrl` option.
**Changes**
- Adds new `serverBaseUrl` option to `createDevMiddleware`, designed to be the base URL value for constructing dev server URLs returned in endpoints such as `/json/list`.
- This changes little for the `localhost` case (now enabling `https://` URLs), but enables remote dev server setups to specify this cleanly.
- Updates call site in `community-cli-plugin`.
Changelog: [Internal]
Reviewed By: robhogan
Differential Revision: D49276125
fbshipit-source-id: 2b6a8507073649832993971aa9d0870f54c9bd44
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39432
For the removal of JSI Module adding the `UIManagerProvider` interface as this will replace the `JSIModuleProvider`
Adding the `Deprecated` annotation since this would be deprecated later as part of Stable APIs with bridge removal and not encouraged usage.
Changelog:
[Internal] internal
Reviewed By: cortinico
Differential Revision: D49257901
fbshipit-source-id: 176ae03368309b56f7a7608419f1776baf4b512a
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39477
There is a typo inside `DefaultNewArchitectureEntryPoint` that we want to fix before this becomes part of the public API.
Changelog:
[Internal] [Changed] - Fix typo inside DefaultNewArchitectureEntryPoint
Reviewed By: sammy-SC, cipolleschi
Differential Revision: D49320026
fbshipit-source-id: 8cf4d2027860b8d2fafd2b8abc51e68392e6343e
Summary:
Update comment in RCTBundleURLProvider.h to use correct `jsBundleURLForBundleRoot` import with `fallbackExtension` instead `fallbackResource`
## Changelog:
- Update comment in `jsBundleURLForBundleRoot` definition on RCTBundleURLProvider.h file.
Pick one each for the category and type tags:
[IOS][CHANGED] - Updated comment in RCTBundleURLProvider.h to instance correct jsBundleURLForBundleRoot:fallbackExtension method.
Pull Request resolved: https://github.com/facebook/react-native/pull/39265
Test Plan: N/A
Reviewed By: cortinico
Differential Revision: D49227104
Pulled By: GijsWeterings
fbshipit-source-id: 6ccfb984ab6c1e858f1c568b2dd8f4626e133ffb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39464
We currently have 854 warnings emitted due to nested namespaces being a C++ 17 extension lol.
This sets the standard explicitly to C++ 20 in the specs emitting the warnings (mostly RCT-Text).
It is undesirable that we add hundreds of warnings to the CocoaPods build without signal. Our Buck build and OSS Android build both treat warnings as errors. But... that is for another day.
Changelog: [Intenrnal]
Reviewed By: cortinico
Differential Revision: D49303081
fbshipit-source-id: 1233e9d51426fb8dbd8ca39a771e2fef3d0df856
Summary:
This is a reopened version of https://github.com/facebook/react-native/issues/35224 by isidoro98 which was closed without explanation, updated to resolve new merge conflicts and now includes an example in the RN-Tester app. Aside from that it is unchanged. Here is isidoro98's description from their original PR:
This PR builds on top of https://github.com/facebook/react-native/issues/31402, which introduced the `automaticallyAdjustsScrollIndicatorInsets` functionality. It aims to fix one of RN's longstanding pain point regarding the keyboard.
The changes provide a better way of handling the `ScrollView` offset when a keyboard opens. Currently, when a keyboard opens we apply an **offset** to the `Scrollview` that matches the size of the keyboard. This approach is great if we are using an `InputAccessoryView` but if we have multiple `TextInputs` in a `ScrollView`; offsetting the content by the size of the keyboard doesn't yield the best user experience.
## Changelog:
[iOS] [Changed] - Scroll `ScrollView` text fields into view with `automaticallyAdjustsScrollIndicatorInsets`
Pull Request resolved: https://github.com/facebook/react-native/pull/37766
Test Plan:
The videos below compare the current and proposed behaviors for the following code:
```js
<ScrollView
automaticallyAdjustKeyboardInsets
keyboardDismissMode="interactive">
{[...Array(10).keys()].map(item => (
<CustomTextInput placeholder={item.toString()} key={item} />
))}
</ScrollView>
```
| Current behaviour | Proposal |
|-|-|
| ![https://user-images.githubusercontent.com/25139053/200194972-1ac5f1cd-2d61-4118-ad77-95c04d30c98d.mov](https://user-images.githubusercontent.com/25139053/200194972-1ac5f1cd-2d61-4118-ad77-95c04d30c98d.mov) | ![https://user-images.githubusercontent.com/25139053/200194990-53f28296-be11-4a47-be70-cec917d7deb1.mov](https://user-images.githubusercontent.com/25139053/200194990-53f28296-be11-4a47-be70-cec917d7deb1.mov) |
As can be seen in the video, the **current behavior** applies an offset to the `ScrollView` content regardless of where the `TextInput` sits on the screen.
The proposal checks if the `TextInput` will be covered by the keyboard, and only then applies an offset. The offset applied is not the full size of the keyboard but instead only the required amount so that the `TextInput` is a **specific** distance above the top of the keyboard (customizable using the new `bottomKeyboardOffset` prop). This achieves a less "jumpy" experience for the user.
The proposal doesn't change the behavior of the `ScrollView` offset when an `InputAccessory` view is used, since it checks if the `TextField` that triggered the keyboard is a **descendant** of the `ScrollView` or not.
## Why not use other existing solutions?
RN ecosystem offers other alternatives for dealing with a keyboard inside a ScrollView, such as a `KeyboardAvoidingView` or using third party libraries like `react-native-keyboard-aware-scroll-view`. But as shown in the recordings below, these solutions don't provide the smoothness or behavior that can be achieved with `automaticallyAdjustsScrollIndicatorInsets`.
| KeyboardAvoidingView | rn-keyboard-aware-scroll-view |
|-|-|
| ![https://user-images.githubusercontent.com/25139053/200195145-de742f0a-6913-4099-83c4-7693448a8933.mov](https://user-images.githubusercontent.com/25139053/200195145-de742f0a-6913-4099-83c4-7693448a8933.mov) | ![https://user-images.githubusercontent.com/25139053/200195151-80745533-16b5-4aa0-b6cd-d01041dbd001.mov](https://user-images.githubusercontent.com/25139053/200195151-80745533-16b5-4aa0-b6cd-d01041dbd001.mov) |
As shown in the videos, the `TextInput` is hidden by the keyboard for a split second before becoming visible.
Code for the videos above:
```js
// KeyboardAvoidingView
<KeyboardAvoidingView
style={{flex: 1, flexDirection: 'column', justifyContent: 'center'}}
behavior="padding"
enabled>
<ScrollView>
{[...Array(10).keys()].map(item => (
<CustomTextInput placeholder={item.toString()} key={item} />
))}
</ScrollView>
</KeyboardAvoidingView>
```
```js
// rn-keyboard-aware-scroll-view
<KeyboardAwareScrollView>
{[...Array(10).keys()].map(item => (
<CustomTextInput placeholder={item.toString()} key={item} />
))}
</KeyboardAwareScrollView>
```
Reviewed By: sammy-SC
Differential Revision: D49269426
Pulled By: javache
fbshipit-source-id: 6ec2e7b45f6854dd34b9dbb06ab77053b6419733
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39454
1. Build with C++ 20 everywhere.
2. Update folly in OSS build to avoid a warning, and let us opt out of heavy bits required for supporting coroutines (we are still more than a year behind).
3. Update the folly podspec for the new version of folly
4. Update the many, many, copy/pasted header search paths for folly dependencies to be able to resolve fmt, now exposed to folly headers
4. Replaces a deprecated atomic usage with equivalent.
5. Fixes a deprecated implicit capturing `this` by value in lambda (same behavior, added a TODO because it seems sus)
Changelog: [Internal]
Reviewed By: sammy-SC
Differential Revision: D49271685
fbshipit-source-id: 16610f7bcd1032d5796cc11f1cfa92a33d8c2593
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39462
In this diff I'm introdcuing the new UnstableAPI called LazyTurboModuleManagerDelegate.
The goal of this class is to provide a Lazy registration of TurboModules without relying on ReactModule annotations neither the TurboReactPackage#getReactModuleInfoProvider method.
This is not the final implementation, it's just a prototype that will be used to experiment and learn about perf implications.
This class will be used in the next diffs of the stack
changelog: [intenral] internal
Reviewed By: cortinico
Differential Revision: D49172555
fbshipit-source-id: 1609c523e6e72f2aa42ca7cc35e9170104a101db
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39461
In this diff I'm creating an empty constructor on ReactPackageTurboModuleManagerDelegate. This will be used in the next diffs of the stack.
I'm also resorting methods for better read of the class
changelog: [intenral] internal
Reviewed By: arushikesarwani94
Differential Revision: D49172554
fbshipit-source-id: 54073c86c87aa145b12e783d8d8f75cd1f5b228c
Summary:
X-link: https://github.com/facebook/yoga/pull/1384
Pull Request resolved: https://github.com/facebook/react-native/pull/39446
This adds logic to the enum generator to generate C++ style scoped enums.
This gives us a few nicities over C enums, even if both must exist:
1. We can add types and keep unsgined enums directly in bitfields
2. Style/readability
3. Avoiding implicit int conversion
Reviewed By: rozele
Differential Revision: D49267996
fbshipit-source-id: 1c41164c377b317c1fef97811c46cbc00b5a837e
Summary:
X-link: https://github.com/facebook/yoga/pull/1380
Pull Request resolved: https://github.com/facebook/react-native/pull/39433
Back when rolling out flex gap, we encountered a bug where gap was added to the end of the main axis when a size was not specified.
During flex line justification/sizing, we calculate the amount of space that should be in between children. We erroneously add this, even after the last child element.
For `justify-content`, this space between children is derived from free space along the axis. The only time we have free space is if we had a dimension/dimension constraint already set on the parent. In this case, the extra space added to the end of the flex line is usually never noticed, because we bound `maxLineMainDim` to container dimension constraints at the end of layout, and the error doesn't effect how any children are positioned or sized.
There was at least one screenshot test where this issue showed up though, and I was able to add a slightly different repro where we may have free space without a definite dimension by enforcing a min dimension and not stretching.
{F1091401183}
The new reference is correct, and looking back at diffs, is what this seemed to originally look like when added three years ago. Seems like there may have been a potential regression, but I didn't spot anything suspicious when I looked around the code history.
`betweenMainDim` may still be set for `gap` even if we don't have a sized parent, which makes the extra space propagated to `maxLineMainDim` effect parent size.
Because we were in a code freeze, I opted to have us go with a solution just effecting flex gap, instead of the right one, in case there were any side effects. This cleans up the code to use the right calculation everywhere, and fixes a separate bug, where `endOfLineIndex` and `startOfLineIndex` may not be the last/first in the line if they are out of the layout flow (absolutely positioned, or display: none_
See the original conversation on https://github.com/facebook/yoga/pull/1188
Reviewed By: javache
Differential Revision: D49260049
fbshipit-source-id: 218552c5ff938668b9f257df7a1493e13ded4d0d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39458
## Changelog
[Android][Deprecated] - hasConstants in ReactModuleInfo is marked as deprecated
getting rid of `mHasConstants` ivar here and marking the getter as deprecated
Reviewed By: cortinico
Differential Revision: D49262577
fbshipit-source-id: 5394281bdc4a315ffc0d1debfaef1808dc6f4299
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39457
## Changelog
[Android][General] - hasConstants in ReactModuleInfo does nothing now
we can get rid of this. currently, the default value of hasConstants true, and the only library setting this value to false is `WebSocketModule`. this value is only read in bridge mode - it is an optimization that will not initialize the constants dictionary for native modules in bridge.
however, we have plenty of native modules that don't provide constants that have not set this flag, so this is only turned on for `WebSocketModule`, which is probably not moving anything significant.
i would recommend we get rid of this to simplify the ReactModuleInfo deprecation plan.
Reviewed By: cortinico
Differential Revision: D49210251
fbshipit-source-id: c82c997e01cd8012b2c1a5c3c36061f81799eb04
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39431
Changelog: [Android][Breaking] - Do not enable `excludeYogaFromRawProps` feature flag, if you need to pass layout props to Java view managers when using new architecture
[Internal]
Reviewed By: NickGerleman
Differential Revision: D49114771
fbshipit-source-id: 171dfceef61d9851094465be8ff4eb9a87a3ab8f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39342
Annotate HybridData with DoNotStrip
The stack of diffs aims to introduce new features and deprecate old ones in the React Native Android architecture. The main goal is to make the architecture more stable and easier to use for developers. The changes include marking ReactPackage as NullSafe, introducing the new getModule method, introducing the WillBeDeprecatedInNewArchitecture annotation, deprecating createNativeModules and marking getModule as UnstableReactNativeAPI, and fixing a lint warning in MainReactPackage.
# This diff
This diff is adding the annotation `DoNotStrip` to the `HybridData` field in the `NativeMethodCallInvokerHolderImpl` and `CallInvokerHolderImpl` classes. This is to prevent the Android ProGuard optimizer from stripping the `HybridData` field, which is necessary for the proper functioning of the TurboModule system in React Native. Additionally, the `BUCK` file for the `core` module is updated to include the `androidx:annotation` and `com.facebook.proguard.annotations:annotations` dependencies.
changelog: [intenral] internal# Context
Reviewed By: cortinico
Differential Revision: D49077065
fbshipit-source-id: cb36c0a11bdb8f5f0f4eaa7db1f0c9dcb3be2341
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39339
Deprecating createNativeModules method from ReactPackage interface recommending using getModule instead in the new architecture of React Native
changelog: [Android][Changed] Deprecating createNativeModules method from ReactPackage interface recommending using getModule instead in the new architecture of React Native
Reviewed By: cortinico
Differential Revision: D48992719
fbshipit-source-id: b20de9274ed4bd35a239c672b52bfac529a79bc2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39351
In this diff I'm introducing the new WillBeDeprecatedInNewArchitecture annotation, the goal of this annotation is to describe that a class or method will be deprecated when the new architecture of react native is fully rolled out in
OSS.
changelog: [Android] Introduce WillBeDeprecatedInNewArchitecture annotation
Reviewed By: cortinico
Differential Revision: D49068234
fbshipit-source-id: 4c5ce25b3fbcc2d7545f2000d931be893a661332
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39336
We are introducing the new getModule method into the ReactPackage interface following the "Registration of Native Modules" design
This method defaults to true with the goal to avoid compatibility breakage
changelog: [Android][Changed] Introducing getModule method into ReactPackage interface, defaulting to null. This method will be used in the Stable API of React Native
Reviewed By: cortinico
Differential Revision: D48992720
fbshipit-source-id: 4ecc93bc84daa8903a4d9a1cf6ced60adb78f153
Summary:
X-link: https://github.com/facebook/metro/pull/1078
Pull Request resolved: https://github.com/facebook/react-native/pull/39159
Source is not required for `getPreset` of `react-native/babel-preset`. There is a codition that adds `react-native/babel-plugin-codegen` to the preset only if source is passing certain regex. This condition fails if source is null, but that's wrong because the plugin may still be requred for this transformation even though source is not provided.
This diff changes the condition so the regexp tests source only if it is not null, and `react-native/babel-plugin-codegen` automatically added to the preset otherwise.
Changelog: [Internal]
Reviewed By: robhogan
Differential Revision: D48684443
fbshipit-source-id: 7cea69c91c0175ac0374d72e91f58e20fe75fd53
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39407
changelog: [internal]
CoreFeatures::enableMapBuffer is not used and always set to false, let's delete it.
Reviewed By: christophpurrer
Differential Revision: D49144919
fbshipit-source-id: 7d6a2a96ade13f7cedc2d12f7672c9df9d247e0d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39418
Changelog: [Internal]
Adds the `enableOpenDebuggerRedirect` experiment flag. The flag enables the handling of GET requests in the `/open-debugger` endpoint, in addition to POST requests. GET requests respond by redirecting to the debugger frontend, instead of opening it using the `BrowserLauncher` interface.
This can be useful when integrating `dev-middleware` in highly customised environments (e.g. VS Code remoting) where things like automatic port forwarding interact poorly with the `BrowserLauncher` abstraction.
WARNING: As this is gated by an experiment flag, the functionality may change or go away unannounced. In separate work, we will look into a stable solution for this use case.
Reviewed By: huntie
Differential Revision: D49144733
fbshipit-source-id: 5af6c8b2ddaa7b6e7d14c792e49fe3d0849c7a25
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39423
D49158227 made the CDP WebSocket URLs returned from `/json` proxy-safe by using the Host header (etc) from the HTTP request. This did *not* fully fix the related `/open-debugger` endpoint, because the original headers were being lost in the internal `fetch('/json')` call.
Here, we eliminate that `fetch` call, and instead give the `/open-debugger` handler direct access to the method on `InspectorProxy` that backs the `/json` endpoint. This allows us to pass in an appropriate base URL derived from the headers seen by `/open-debugger`.
Changelog: [Internal]
Reviewed By: huntie
Differential Revision: D49229545
fbshipit-source-id: 9036ab295721e0d1fd3cdb608d0a7cc07b8f2eeb
Summary:
Right now we're fetching latests versions of drivers which isn't the best, we should always download the same versions.
## 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] - Add versions when installing Appium drivers.
Pull Request resolved: https://github.com/facebook/react-native/pull/39275
Test Plan: CI Green - (side note: if jobs `test_e2e_ios` and `test_e2e_android` are green it doesn't mean that they passed.)
Reviewed By: cipolleschi
Differential Revision: D49248778
Pulled By: NickGerleman
fbshipit-source-id: 5b114b7dc1172993afc4b02e9d3380afa9f03c40
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39367
Updates React Native to use the new CDP handler provided by the Hermes engine instead of the legacy one (`Connection.cpp`) built into React Native. The new Hermes CDP handler has a simpler & safer design, new features (e.g. `console.log` buffering) and is under active development by the Hermes team.
NOTE: Both the legacy and modern handlers are Hermes-specific. In future work, React Native will *wrap* the modern Hermes handler in an engine-agnostic CDP layer implementing additional functionality and managing the lifecycle of debugging sessions more correctly. This diff is the first step of this larger migration.
Changelog: [General][Changed] Use new Hermes CDP handler implementation for debugging
Reviewed By: cipolleschi
Differential Revision: D48783980
fbshipit-source-id: 4d2ca3fa04e96e92a38d82c90737cb660ba56655
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39426
When opening the react-native repo in Android Studio the first time, users is missing 3rd party native dependencies,
which gets downloaded during the first build.
Here I'm hooking the Gradle sync step to the `preBuild` task that takes care of preparing the repo so that the whole build can succeeds (i.e. downloading and unzipping native deps, running codegen, preparing hermes/hermesc, etc.).
Changelog:
[Internal] [Changed] - Make sure first Gradle Sync is downloading 3rd party deps
Reviewed By: cipolleschi
Differential Revision: D49231058
fbshipit-source-id: 11a3d436550581f8a67a582f9fd325ad39486ddc
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/39429
Using `require` after `const registerFn = require('babel/register')` but before `registerFn(config)` causes Babel to transform required code with the default configuration (ie, using a nearby `babel.config.js`, if available).
This was causing the Babel plugins loaded by `metro-babel-register` to be (unnecessarily) transformed according to `babel.config.js`, which actually fails if the plugins/presets referenced in `babel.config.js` themselves require transformation.
This ensures no code is loaded in between registering Babel as a side effect of requiring Babel register, and replacing that hook with something explicitly configured.
## React Native
Changelog: [Internal]
## Metro
```
* **[Fix]:** `metro-babel-register` prevent arbitrary transformation of Babel plugins during registration setup
```
Reviewed By: dmytrorykun
Differential Revision: D49238671
fbshipit-source-id: 52a55b1b5dbd127171558c056f16ab04e8fa8232
Summary:
This mirrors the clang-format config used by fbsource to Yoga.
They are pretty similar, except for an annoying habit where Yoga's previous forced small functions in headers to be a a single line, so you would get a combination of multiline and single line functions next to each other which are hard to read. That is what motivated this change.
It also enforces header ordering (yay). I don't think we have any side-effect causing headers, so this should be safe.
Reviewed By: yungsters
Differential Revision: D49248994
fbshipit-source-id: 66998395e7c0158ff9d9fb1bee44e8401bdd8f21