Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37344
Changelog: [Internal]
in this diff we do the following:
- pass an error handler that's responsible for bubbling up the error metadata from the react instance obj-c wrapper (RCTInstance) to the actual react instance (ReactInstance)
- parse the error metadata in RCTHost and pass it up to its delegate
Reviewed By: cipolleschi
Differential Revision: D45720132
fbshipit-source-id: 996c7c43ed6feb72596296eedac18e204b960426
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37343
Changelog: [Internal]
in this stack i address the `jsErrorHandlingFunc` argument in the constructor of `RCTHost`.
currently in userland, the delegate of `RCTHost` is responsible for the following if they want to handle the errors fired in C++ land:
- importing the C++ class MapBuffer
- creating a C++ lambda method
- parsing the MapBuffer
in this diff stack i simplify this so we only need to implement a delegate method where userland only receives Foundation types. yay!
bypass-github-export-checks
Reviewed By: RSNara
Differential Revision: D45720131
fbshipit-source-id: b5541abe505140b4b85cbec1a8acecc1a3df7a72
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37398
Changelog: [Internal]
in this diff, i introduce an internal category and header for RCTHost for functionality that needs to be accessible for our purposes, but not an official part of our stable API.
after this change, we can remove `ReactInstanceForwarding`.
Reviewed By: cipolleschi
Differential Revision: D45760091
fbshipit-source-id: 88a82fc70a20934f5d8989041c3eb2ffe2d27b20
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37399
Changelog: [Internal]
in this stack, i remove the `ReactInstanceForwarding` protocol. it is super lean and is only used by two classes, and the polymorphic behavior never comes into play because we never have a pointer to `id<ReactInstanceForwarding>` in our codebase.
being able to call into JS from native is tablestakes behavior in userland, so i'm moving that to the public API. i also renamed it to be more clear that it's calling from native into JS, not the other way around.
Reviewed By: cipolleschi
Differential Revision: D45760090
fbshipit-source-id: 8ac99723796cb65891076e8e7d69aeefe3e94213
Summary:
X-link: https://github.com/facebook/yoga/pull/1294
Pull Request resolved: https://github.com/facebook/react-native/pull/37383
Add -Wextra to the build, and fixup some more instances of -Wunused-parameter that it sufaces which were not automatically fixable.
Reviewed By: javache
Differential Revision: D45772846
fbshipit-source-id: 29bf71006f63161521fe5869c3a7d8bf7aae9c81
Summary:
X-link: https://github.com/facebook/yoga/pull/1291
Pull Request resolved: https://github.com/facebook/react-native/pull/37371
This makes React Native use `libyogacore` as provided by Yoga's reference CMake build. This in turn matches Yoga in the OSS RN build to the same compilation settings we use internally. It also means less differences between all the builds (maintainability win).
This does not yet do the same for the Yoga JNI bindings.
Changelog:
[Android][Changed] - Use reference Yoga CMake Build
Reviewed By: cortinico
Differential Revision: D45764537
fbshipit-source-id: 1aafd221d2afa994b6efae3c267ee7ffbdf0faad
Summary:
> The `buildPropSchema` function in `parsers/typescript/components/props.js` and `parsers/flow/components/props.js` is the same. move it to `parser-commons` and use it in the original files.
part of https://github.com/facebook/react-native/issues/34872
- [x] Make the getTypeAnnotation signature from the Flow package to be equal to the typescript one. Specifically, the Typescript one needs an additional parameter withNullDefault that we can safely ignore in the implementation.
- [x] buildPropSchema signature can be updated to accept those two functions in input as callbacks. Then, the getProps function can feed the right functions based on the language to the shared build prop schema.
ref: https://github.com/facebook/react-native/issues/34872#issuecomment-1517519254
bypass-github-export-checks
## 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] [Changed] - Use `buildPropSchema` from parser-commons
Pull Request resolved: https://github.com/facebook/react-native/pull/37043
Test Plan: - [ ] `yarn jest react-native-codegen` pass
Reviewed By: rshest
Differential Revision: D45209982
Pulled By: cipolleschi
fbshipit-source-id: c241bc0542ba662c965d70d1dc283f48541e14ea
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37375
Adds internal helpers to YGConfig to make bit manipulation more readable. We also expose `hasErrata()` to YGNode beacuse checking that will be a common pattern. We intentionally don't add mutating functions to the node, since current model is to inval a node on commiting whole config.
This is not exposed via the C ABI.
Reviewed By: yungsters
Differential Revision: D45765971
fbshipit-source-id: eadaee4b9cf5204ac4984ecc52cc08650d144a30
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37372
For usage in shelling into the reference build. I separately looked at moving `cmake` to be inline inside of `yoga`, but this ends up having a worse structure than being at the top level.
I also cleaned up the dirsync naming to be more easy to understand.
Changelog: [Internal]
Reviewed By: yungsters
Differential Revision: D45764337
fbshipit-source-id: f810db5d6acc7c4c92003beb2ac3399bd78b9886
Summary:
This adds script to better work with RN Tester from the root of the repo.
- `yarn start` is broken as of today
- `yarn android` is not working fine and I've adapter it here.
This should make easier to work with RN Tester from within the Repo.
Changelog:
[Internal] [Changed] - Add scripts to `yarn start` and `yarn android` from root
Reviewed By: mdvacca, cipolleschi
Differential Revision: D45735926
fbshipit-source-id: eaebf80b8819ee42ccb9c14b67f8945167bf05e6
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/37243
X-link: https://github.com/facebook/litho/pull/944
X-link: https://github.com/facebook/yoga/pull/1279
Java bindings for Yoga rely solely on garbage collection for memory management. Each Java `YogaNode` has references to its children and parent Java Nodes. This means, for a node to be garbage collected, it cannot be reachable from any user accessible node. Each node then has single ownership of a `YGNodeRef`. When the `YogaNode` is garbage collected, a finalizer is run to call `YGNodeFree` and free the underlying native Yoga Node.
This may cause a use-after-free if finalizers are run from multiple threads. This is because `YGNodeFree` does more than just freeing, but instead also interacts with its parent and children nodes to detach itself, and remove any dangling pointers. If multiple threads run finalizers at once, one may traverse and try to mutate a node which another is freeing.
Because we know the entire connected tree is dead, there is no need to remove dangling pointers, so I want to expose a way to just free a Yoga Node, without it mutating the tree as a side effect.
This adds a currently private `YGNodeDeallocate` that frees without traversal. Ideally from naming this is what `YGNodeFree` would do, but we think changing the behavior of that might be too disruptive to OSS. At the same time there may be other memory safety related API changes we would like to eventually make, so this isn't made public beyond the JNI bindings to prevent needing to transition more APIs.
Changelog: [Internal]
Reviewed By: rshest
Differential Revision: D45556206
fbshipit-source-id: 62a1394c6f6bdc2b437b388098ea362a0fbcd0f7
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:
Adds changelog for new patch.
## Changelog:
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->
[Internal] [Changed] - add changelog entry for 0.71.8
Pull Request resolved: https://github.com/facebook/react-native/pull/37354
Test Plan: N/A
Reviewed By: lunaleaps
Differential Revision: D45733332
Pulled By: cipolleschi
fbshipit-source-id: 0505378aef165f66361f6fc21128fa85f0ef5e32
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