Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37368
## Changes
This diff hooks up global.nativeModuleProxy to the TurboModule interop layer.
Now, when you call NativeModules.Foo, the TurboModule system will create the Foo legacy module, and return it to JavaScript.
## Example
global.nativeModuleProxy.Foo:
- ObjC++: Use RCTTurboModuleManager to create the ObjC legacy module for Foo
- C++: Use the ObjC legacy modules to create and return a ObjCInteropTurboModule object to JavaScript.
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D45243456
fbshipit-source-id: 14748b5efd73b95bbdddf28a4f7ed2a8e80e0788
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37364
When the TurboModule interop layer is enabled, it should create modules that conform to RCTBridgeModule (i.e: legacy and turbo modules).
When the TurboModule interop layer is disabled, it should only create modules that conform to RCTTurboModule (i.e: turbo modules).
Changelog: [Internal]
Reviewed By: mdvacca
Differential Revision: D45706884
fbshipit-source-id: be6f054556d1506e2934884ab5014394f0c08e8f
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37347
This fixes the file-structure of `eslint-config-react-native-communtiy`, and `eslint-plugin-react-native-communtiy` to match the name they were renamed to as part of 0.72.
Changelog: [Internal]
Reviewed By: cortinico
Differential Revision: D45721173
fbshipit-source-id: 7ad784dbf56fb4cd05d7dba608e6d5064392e43d
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37345
This moves from `tsconfig/react-native`, a centralized repository of tsconfigs, to `react-native/typescript-config`, a package maintained as part of the RN monorepo.
We end up wanting to make changes where the versions are coupled, so this publishes them as part of the same repo, etc. It also means Meta engineers can more freely make changes to it with normal approval processes.
Changelog:
[General][Added] - Add react-native/typescript-config
Reviewed By: cortinico
Differential Revision: D45721088
fbshipit-source-id: b949bffb14014695abf3b9b359d3f5e30bfc8919
Summary:
Just a small upgrade to keep us current and remove unused suppressions
(probably fixed by some upgrade since).
- `*` is no longer allowed and has been an alias for `any` for a while
now.
DiffTrain build for commit https://github.com/facebook/react/commit/fda1f0b902b527089fe5ae7b3aa573c633166ec9.
Changelog: [Internal]
Reviewed By: tyao1
Differential Revision: D45695294
Pulled By: kassens
fbshipit-source-id: 1090328c30faf5ca8c22744f0b25ddf7fa60cd93
Summary:
Hi 👋
During the [react-native-bootsplash](https://github.com/zoontek/react-native-bootsplash) implementation of the new architecture, I noticed a few thing regarding `RCTRootView` / `RCTFabricSurfaceHostingProxyRootView` compat.
Currently `RCTRootView` inherits from `UIView`, but `RCTFabricSurfaceHostingProxyRootView` does not, which this works:
```obj-c
- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initProps:(NSDictionary *)initProps {
RCTRootView *rootView = (RCTRootView *)
[super createRootViewWithBridge:bridge moduleName:moduleName initProps:initProps];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil];
UIView *loadingView = [[storyboard instantiateInitialViewController] view];
loadingView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
loadingView.frame = rootView.bounds;
loadingView.center = (CGPoint){CGRectGetMidX(rootView.bounds), CGRectGetMidY(rootView.bounds)};
loadingView.hidden = NO;
[rootView addSubview:loadingView];
return rootView;
}
```
But this doesn't:
```obj-c
- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initProps:(NSDictionary *)initProps {
RCTFabricSurfaceHostingProxyRootView *rootView = (RCTFabricSurfaceHostingProxyRootView *)
[super createRootViewWithBridge:bridge moduleName:moduleName initProps:initProps];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil];
UIView *loadingView = [[storyboard instantiateInitialViewController] view];
loadingView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
loadingView.frame = rootView.bounds;
loadingView.center = (CGPoint){CGRectGetMidX(rootView.bounds), CGRectGetMidY(rootView.bounds)};
loadingView.hidden = NO;
[rootView addSubview:loadingView];
return rootView;
}
```
Because `RCTFabricSurfaceHostingProxyRootView` is an imperfect proxy as it doesn't give access to the underlaying `UIView *`. As a solution, I added a prop on both: `UIView *view`
PS: I'm well aware that `setLoadingView` also exists in both files, but it's currently not usable as the current `isActivityIndicatorViewVisible` / `isSurfaceViewVisible` / `_activityIndicatorViewFactory` logic in `RCTSurfaceHostingView.mm` doesn't work: a situation where `isActivityIndicatorViewVisible == true && isSurfaceViewVisible == false && _activityIndicatorViewFactory != nil` never happen:
<img width="1162" alt="Screenshot_2023-05-06_at_18 10 18" src="https://user-images.githubusercontent.com/1902323/236883439-2256ddfb-7846-482a-b957-002a7d51a148.png">
## 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
Pull Request resolved: https://github.com/facebook/react-native/pull/37310
Test Plan:
Add this block of code in `AppDelegate.mm`:
```obj-c
#import <React/RCTRootView.h>
#if __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)
#import <React/RCTFabricSurfaceHostingProxyRootView.h>
#endif
// …
- (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initProps:(NSDictionary *)initProps {
#ifdef RCT_NEW_ARCH_ENABLED
RCTFabricSurfaceHostingProxyRootView *rootView = (RCTFabricSurfaceHostingProxyRootView *)
#else
RCTRootView *rootView = (RCTRootView *)
#endif
[super createRootViewWithBridge:bridge moduleName:moduleName initProps:initProps];
// accessing the "real" root view on both arch
UIView *view = rootView.view;
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"LaunchScreen" bundle:nil];
UIView *loadingView = [[storyboard instantiateInitialViewController] view];
loadingView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
loadingView.frame = view.bounds;
loadingView.center = (CGPoint){CGRectGetMidX(view.bounds), CGRectGetMidY(view.bounds)};
loadingView.hidden = NO;
[view addSubview:loadingView];
return rootView;
}
```
It should persist the splash screen on both old and new architecture.
Reviewed By: sammy-SC
Differential Revision: D45688644
Pulled By: cipolleschi
fbshipit-source-id: b6f2fc8091a15189ea2eceb8ea426593f62674cb
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37342
Upgrades to `flow-enums-runtime@0.0.6`, which is just a `README.md` update.
Changelog:
[Internal]
Differential Revision: D45713984
fbshipit-source-id: a458ccb099df53401fa41826f3571bca7e292dbf
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37326
Changelog: [Internal]
in this change, i introduced a block type that returns a `JSEngineInstance`. a block gives a bit more flexibility in terms of lazily loading the engine + its dependencies, but i might get rid of it later and just pass down the engine itself.
Reviewed By: javache
Differential Revision: D45678969
fbshipit-source-id: 52d3ec0de77a3ab74d3cf304ea22fb5fc1315a2e
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37317
changelog: [internal]
This diff does three things:
1. Combines Android's mobile config `react_fabric:enable_text_measure_cache` with iOS mobile config `react_fabric:enable_nstextstorage_caching`. We will get into why later.
2. Fixes cache `ParagraphLayoutManager::cachedTextMeasurement_` invalidation logic for iOS and Android.
3. Fixes cache invalidation logic for `ParagraphLayoutManager::hostTextStorage_`.
Initially, Android's text measure cache (D44221170) and iOS's NSTextStorage (D43692171) were design as two separate optimisations. But they overlap and NSTextStorage actually needs some parts of text measure cache to work correctly. That's why I decided to merge them together.
Previously, `ParagraphLayoutManager::cachedTextMeasurement_` was only invalidated if maximum width for the node changed. But node can change in different ways, for example input string changes or attributes change. This diff accounts for that by computing a hash for AttributedString+ParagraphAttributes to check if anything has changed.
Previously, `ParagraphLayoutManager::hostTextStorage_` was not correctly invalidated if maximum width changed. To my surprise, this happens less frequently than one expects.
bypass-github-export-checks
Reviewed By: mdvacca
Differential Revision: D45637797
fbshipit-source-id: 1840b51cdb1423de0560a35fd17c24a71ad115e1
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37303
Intent of a change to the last diff was to make `PropsParserContext` act gracefully if it tried to parse "auto" without a `ReactNativeConfig` being set (e.g. if our tests wanted to do that).
We would actually assert if we tried to do that with what I added, since `ContextContainer::at()` acts like `at()` does in the STL containers and will expect the parameter to be in bounds/present. (`RawProps::at()` is the odd one out that will return `nullptr` instead).
This changes the usage to ContextContainer::find() which will return ` std::optional<std::shared_ptr>>`.
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D45651032
fbshipit-source-id: b1f16f9329ceb4ef7a6c469f968eae57a2fe3da5
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37337
Changelog: [Internal]
Removes usage of a local `Performance` instance, since this the global one is now safe to use.
Reviewed By: christophpurrer
Differential Revision: D45697243
fbshipit-source-id: 4f3f9798e79c15295094d5a4650af04db2856f60
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37323
ReactInstance is an internal concept and name, we should not leak ReactInstance name for client code.
bypass-github-export-checks
changelog: [internal] internal
Reviewed By: RSNara
Differential Revision: D45578268
fbshipit-source-id: c0306b89d854d7beb5fcd38ba3623099846ec932
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37333
## Changelog:
[Internal] -
Add a safeguard against accidentally removing a virtual destructor from `ShadowNode`.
Since this is something that happened before, and `ShadowNode` has a non-trivial class inheritance tree, this could be a good idea to prevent potential memory leaks.
Differential Revision: D45691614
fbshipit-source-id: 3aa7a3eecba98478d7fb9aaef62adb547b653b82
Summary:
Nightly builds of Android no longer build due to a recent version format change.
## Changelog:
[ANDROID] [FIXED] - Fixed nightly builds of Android no longer building due to a recent version format change
Pull Request resolved: https://github.com/facebook/react-native/pull/37332
Test Plan:
```
git clone https://github.com/microsoft/react-native-test-app.git
cd react-native-test-app
npm run set-react-version nightly
cd example
yarn android
```
Reviewed By: jacdebug
Differential Revision: D45690926
Pulled By: cortinico
fbshipit-source-id: dc935733607c2b33ba296b507a98f43ba483e348
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37275
When enabling `USE_FRAMEWORKS=dynamic`, we need to explicitly defines all the dependencies used by the pods.
This change add those missing dependencies.
## Changelog:
[iOS][Added] - Add explicit dependencies for 3rd parties libraries
Reviewed By: NickGerleman
Differential Revision: D45523646
fbshipit-source-id: 228a7e0ae98ea262af4d58b7dc855f944ebed463
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37276
When enabling dynamic linking, we had a circulr dependency between Fabric and the Image Manager.
Specifically, Image Manager depends on Fabric, but the Image component, in Fabric, is using some implementation specific files from the Image Manager that surface only when enabling the dynamic linking.
Xcode fails to find those symbols unless the dependencies are explicitly added to the podspec.
This change is technically breaking, but we tried to minimize the breakage by adding the new pod in all the required search paths.
## Changelog
[iOS][Breaking] - Add React-FabricImage pod.
Reviewed By: NickGerleman
Differential Revision: D45517278
fbshipit-source-id: 994aa8c40301c68bf9fecdf46de7833028f0d3c2
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37312
## Why?
Internally one of our apps is using a custom view manager that isn't respecting the `NotNull` constraint,
causing a runtime error. We have no visibility over what this manager is. The custom exception will give
us more clues to track this down.
If you look at the below stack trace, it's pretty clear the earlier approach would fail:
{F979121677}
Like a bit of a noddy, I've been waiting for days for the new exception to be hit, when it's very clear from [3 May](https://fburl.com/scuba/errorreporting_facebook_android_crashes/a63t7ilm) that this wasn't going to happen:
{F979130611}
The lesson here is to monitor 3 things:
1. the [original NullPointerExceptions](https://fburl.com/scuba/errorreporting_facebook_android_crashes/m2o0t45h),
2. the new [ReactViewReturnTypeException](https://fburl.com/scuba/errorreporting_facebook_android_crashes/2j0vtuwb), and
3. the [number of users exposed](https://fburl.com/scuba/mobile_active_users/9mbevwed) to whatever release this change goes out on.
Changelog: [Internal]
The NullPointerExceptions are hit when call the the java createView method. Previous (D45185598)
didn't capture this exception and wasn't very useful.
Reviewed By: cortinico
Differential Revision: D45660487
fbshipit-source-id: f1a7a114778a0c2eae963d64558541266ed57bda
Summary:
FlatList `viewabilityConfig` prop seems no need to be any type. So I replaced it with `ViewabilityConfig` from `VirtualizedList.d.ts`
## Changelog:
[GENERAL] [FIXED] - change FlatList `viewabilityConfig` prop type `any` to `ViewabilityConfig`
Pull Request resolved: https://github.com/facebook/react-native/pull/37299
Test Plan: Ran yarn test-typescript and yarn test-typescript-offline with no errors.
Reviewed By: jacdebug
Differential Revision: D45689033
Pulled By: cipolleschi
fbshipit-source-id: e7fd31c534c5f47321b36d0d764f466392ad897e