react-native-macos/Libraries
Xin Chen 89ef5bd6f9 Add TraceUpdateOverlay to RN AppContainer
Summary:
This diff adds `TraceUpdateOverlay` native component to RN `AppContainer.js`. This will enable the overlay when the build is in DEV environment and the DevTools global hook exists. It also closed gap between the JS dev mode and native dev support flag, so that the native component will be available when used by JS.

## Update (2/13/2023)
Instead of the original approach where I put a default value to the devsupport manager flag, I did ui manager check from JS and make sure the native component exists before using it. This is cleaner.

## Problem
Since the `AppContainer` is being used by all RN apps, we need to make sure the native component is registered in UI Manager of the RN app when it's used. Currently, the native component lives in the `DebugCorePackage.java`, which is added to the RN app [when the `DevSupportManager` is used](https://fburl.com/code/muqmqbsa). However, there's no way to tell if an app is using dev support manager in JS, hence there are gaps when the JS code uses `TraceUpdateOverlay`, vs when the native code registered the native component. This issue caused test error in [ReactNativePerfTest](https://fburl.com/testinfra/j24wzh46) from the [previous diff](https://fburl.com/diff/bv9ckhm7), and it actually prevents Flipper from running this properly as shown in this video:

https://pxl.cl/2sqKf

The errors shown in Flipper indicates the RN surface from the plugin is also missing `TraceUpdateOverlay` in its UI Manager:

{F869168865}

## Solution
To fix this issue, we should find a way to expose if the app is using dev support manager in JS. Or we should set to use DevSupportManager whenever it's a dev build as claimed in JS. I will try to find some way to achieve either one of this. I am open to suggestions here for where I should add the native component to. Given that it's used in the AppContainer, and any app could be built in development mode, I don't want to make people to manually add this native component themselves.

## Alternatives
There are some other approaches that could mitigate the issue, but less ideal:

For the test issue
1) Add `setUseDeveloperSupport(true)` to [ReactNativeTestRule.java](https://fburl.com/code/7jaoamdp). That will make the related test pass by using the DevSupportPackages, which has the native component. However, it only fixes tests using that class.

2) Override the package for [ReactNativeTestRule.java](https://fburl.com/code/b4em32fa), or `addPackage` with more packages including the native component. Again this only fixes this test.

3) Add the native component to the [`MainReactPackage`](https://fburl.com/code/nlayho86), which is what I did here in this diff. This would fix more cases as this package is [recommended to be used](https://fburl.com/code/53eweuoh) for all RN app. However, it may not fix all the cases if the RN app didn't manually use it.

4) Add the native component in the [`CoreModulesPackage`](https://fburl.com/code/lfeklztl), which will make all RN apps work, but at the cost of increase package size when this feature is not needed. Or, we could argue that we want to have highlights on trace updates for production build as well?

Changelog:
[Internal] - Enable TraceUpdateOverlay to RN AppContainer

Reviewed By: rubennorte

Differential Revision: D43180893

fbshipit-source-id: a1530cc6e2a9d8c905bdfe5d622d85c4712266f8
2023-02-14 22:32:55 -08:00
..
ActionSheetIOS ESM processColor 2023-01-03 18:09:06 -08:00
Alert Adding AlertOptions to ts Alert.prompt function (#35957) 2023-01-25 02:14:45 -08:00
Animated Upgrade to Flow 0.198.1 2023-01-23 07:38:48 -08:00
AppDelegate Hardcode concurrentRootEnabled to true when Fabric is enabled (#36106) 2023-02-09 07:02:32 -08:00
AppState RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
BatchedBridge Upgrade to Flow 0.198.1 2023-01-23 07:38:48 -08:00
Blob Restore Dynamic framework with Hermes in the Old Architecture 2023-01-30 04:25:26 -08:00
BugReporting Codemod cycle annotations for xplat/js 2022-11-01 17:13:27 -07:00
Components Add TraceUpdateOverlay to RN AppContainer 2023-02-14 22:32:55 -08:00
Core Implement DOMRect and DOMRectReadOnly matching Web 2023-02-09 09:36:08 -08:00
DOM/Geometry Implement DOMRect and DOMRectReadOnly matching Web 2023-02-09 09:36:08 -08:00
DevToolsSettings Add iOS + Android support for getting/setting reload-and-profile-related settings 2022-12-05 22:07:30 -08:00
EventEmitter RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
Events remove return type from constructor (#35466) 2022-11-24 18:26:36 -08:00
FBLazyVector Remove fb_apple_library export from rn_defs 2022-11-17 09:56:30 -08:00
HeapCapture RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
Image remove unused type imports 1/1 2023-01-18 08:21:49 -08:00
Inspector Reconnect VirtualizedList Source History 2/2 (Apply D41745930 + history, D42805202, D43063551) 2023-02-06 20:00:19 -08:00
Interaction Remove unused modules from react-native 2023-02-09 06:29:14 -08:00
JSInspector RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
LayoutAnimation RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
Linking Do not use InteractionManager to wait for Activity (#35289) 2022-11-14 03:38:52 -08:00
LinkingIOS Update .podspec license information (#35245) 2022-11-07 09:52:52 -08:00
Lists Reconnect VirtualizedList Source History 2/2 (Apply D41745930 + history, D42805202, D43063551) 2023-02-06 20:00:19 -08:00
LogBox ESM LogBox 2023-01-03 18:09:06 -08:00
Modal Reconnect VirtualizedList Source History 2/2 (Apply D41745930 + history, D42805202, D43063551) 2023-02-06 20:00:19 -08:00
NativeAnimation Support colors for AnimatedInterpolation on iOS 2022-12-05 08:24:54 -08:00
NativeComponent feat: Add logical border radius implementation (#35572) 2023-01-06 06:00:03 -08:00
NativeModules/specs Scaffolding for the PerformanceObserver TurboModule (C++ side) (#35226) 2022-11-08 10:01:21 -08:00
Network ESM RCTNetworking 2023-01-03 18:09:06 -08:00
NewAppScreen RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
Performance Remove unused modules from react-native 2023-02-09 06:29:14 -08:00
PermissionsAndroid Rename `POST_NOTIFICATION` to `POST_NOTIFICATIONS` (#35533) 2022-12-09 12:56:07 -08:00
Pressability Disable a /Libraries/Pressability test on Windows only 2023-02-09 08:52:57 -08:00
PushNotificationIOS Add missing types to PushNotificationIOS 2022-12-15 09:54:03 -08:00
RCTRequired fix missing imports and set disable_infer_precompiled_header] 2022-12-04 13:30:16 -08:00
ReactNative Add TraceUpdateOverlay to RN AppContainer 2023-02-14 22:32:55 -08:00
ReactPrivate Enable LTI in react-native 2022-12-06 19:34:14 -08:00
Renderer React Native sync for revisions 17f6912...48b687f 2023-01-31 09:17:55 -08:00
Settings Update .podspec license information (#35245) 2022-11-07 09:52:52 -08:00
Share ESM processColor 2023-01-03 18:09:06 -08:00
StyleSheet Add `borderCurve` and `pointerEvents` to `ViewStyle` (#35998) 2023-02-01 12:20:40 -08:00
SurfaceBackedComponent Remove clang-format opt-out for Libraries 2022-10-13 02:23:13 -07:00
SurfaceHostingComponent Remove clang-format opt-out for Libraries 2022-10-13 02:23:13 -07:00
Text Fix typo in Dynamic Type docs (#36113) 2023-02-10 06:05:50 -08:00
TurboModule Add enum example to Android/iOS rn-tester TurboModule (#35133) 2023-02-08 22:49:30 -08:00
TypeSafety chore: RCTConvert - allocate array with capacity (#35490) 2022-11-28 07:29:04 -08:00
Types Fixup TS Organization (#35169) 2022-11-02 14:58:37 -07:00
Utilities Remove unused buildStyleInterpolator module from react-native 2023-02-09 06:29:14 -08:00
Vibration Fix Vibration.vibrate() allowing null params 2022-12-14 15:23:12 -08:00
WebPerformance API symmetry when passing PerformanceEntryType to/from native module 2023-02-13 10:44:06 -08:00
WebSocket Log Abnormal Closes to Metro Websocket 2022-10-26 20:09:32 -07:00
Wrapper Remove clang-format opt-out for Libraries 2022-10-13 02:23:13 -07:00
YellowBox ESM LogBox 2023-01-03 18:09:06 -08:00
__flowtests__ RN: Sort Imports via ESLint 2022-09-30 14:28:48 -07:00
vendor refactor(react-native/polyfills): rename package to @react-native/js-polyfills and align version 2022-12-05 18:34:33 -08:00
.npmignore npmignore: ignore tests and fixtures 2018-02-27 08:42:14 -08:00
Promise.js Remove nonstandard Promise.prototype.done implementation 2022-05-05 03:55:10 -07:00
UTFSequence.js Add newline to UTFSequence 2023-01-19 14:04:23 -08:00
promiseRejectionTrackingOptions.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00