react-native-tvos 0.74.0-0rc1 → 0.74.0-0rc3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Libraries/AppDelegate/RCTAppDelegate.mm +10 -5
- package/Libraries/AppDelegate/RCTRootViewFactory.h +13 -3
- package/Libraries/AppDelegate/RCTRootViewFactory.mm +25 -10
- package/Libraries/Components/Pressable/Pressable.js +9 -13
- package/Libraries/Components/Touchable/TVTouchable.js +1 -1
- package/Libraries/Components/Touchable/TouchableHighlight.js +2 -2
- package/Libraries/Components/Touchable/TouchableNativeFeedback.js +2 -2
- package/Libraries/Components/Touchable/TouchableOpacity.js +2 -2
- package/Libraries/Core/ReactNativeVersion.js +1 -1
- package/Libraries/Pressability/Pressability.js +5 -0
- package/Libraries/React-Native +214 -0
- package/Libraries/ReactNative/AppContainer-dev.js +6 -1
- package/React/Base/RCTBridgeProxy.h +6 -1
- package/React/Base/RCTBridgeProxy.mm +4 -2
- package/React/Base/RCTTVNavigationEventNotification.h +37 -0
- package/React/Base/RCTTVNavigationEventNotification.mm +106 -0
- package/React/Base/RCTTVNavigationEventNotificationConstants.h +25 -0
- package/React/Base/RCTTVNavigationEventNotificationConstants.mm +18 -0
- package/React/Base/RCTTVRemoteHandler.h +0 -26
- package/React/Base/RCTTVRemoteHandler.m +34 -90
- package/React/Base/RCTTVRemoteHandlerConstants.h +37 -0
- package/React/Base/RCTTVRemoteHandlerConstants.mm +32 -0
- package/React/Base/RCTVersion.m +1 -1
- package/React/CoreModules/RCTDevMenu.mm +1 -1
- package/React/CoreModules/RCTDevSettings.mm +9 -4
- package/React/CoreModules/RCTDeviceInfo.mm +15 -16
- package/React/CoreModules/RCTTVNavigationEventEmitter.mm +6 -1
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.h +4 -0
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm +16 -6
- package/React/Fabric/Mounting/ComponentViews/Modal/RCTModalHostViewComponentView.mm +45 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +12 -13
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +8 -17
- package/React/Fabric/RCTSurfacePointerHandler.mm +1 -0
- package/React/Modules/RCTUIManager.m +10 -0
- package/React/Views/RCTModalHostViewController.m +26 -0
- package/React/Views/RCTTVView.m +6 -17
- package/React/Views/ScrollView/RCTScrollView.m +11 -12
- package/ReactAndroid/api/ReactAndroid.api +1 -0
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +5 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +9 -0
- package/ReactAndroid/src/main/java/com/facebook/react/modules/core/ReactAndroidHWInputDeviceHelper.java +12 -7
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +4 -4
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIImplementation.java +1 -7
- package/ReactAndroid/src/main/java/com/facebook/react/uimanager/UIManagerModule.java +6 -1
- package/ReactCommon/cxxreact/ReactNativeVersion.h +1 -1
- package/ReactCommon/jserrorhandler/React-jserrorhandler.podspec +1 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModule.mm +4 -1
- package/ReactCommon/react/nativemodule/core/platform/ios/ReactCommon/RCTTurboModuleManager.mm +1 -1
- package/ReactCommon/react/runtime/React-RuntimeCore.podspec +1 -1
- package/ReactCommon/react/runtime/iostests/RCTHostTests.mm +2 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost+Internal.h +0 -2
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.h +10 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTHost.mm +32 -9
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.h +2 -1
- package/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +5 -12
- package/ReactCommon/react/test_utils/ios/Shims/ShimRCTInstance.h +1 -1
- package/ReactCommon/react/test_utils/ios/Shims/ShimRCTInstance.mm +3 -2
- package/ReactCommon/yoga/Yoga.podspec +4 -1
- package/package.json +9 -9
- package/scripts/cocoapods/utils.rb +57 -4
- package/scripts/react_native_pods.rb +1 -0
- package/sdks/.hermesversion +1 -1
- package/sdks/hermes-engine/utils/build-apple-framework.sh +0 -2
- package/sdks/hermes-engine/utils/build-ios-framework.sh +4 -1
- package/sdks/hermes-engine/utils/build-mac-framework.sh +4 -1
- package/sdks/hermesc/osx-bin/hermes +0 -0
- package/sdks/hermesc/osx-bin/hermesc +0 -0
- package/sdks/hermesc/win64-bin/hermesc.exe +0 -0
- package/template/ios/HelloWorld/PrivacyInfo.xcprivacy +38 -0
- package/template/package.json +6 -6
- package/third-party-podspecs/RCT-Folly.podspec +2 -2
|
@@ -243,13 +243,18 @@
|
|
|
243
243
|
|
|
244
244
|
- (RCTRootViewFactory *)createRCTRootViewFactory
|
|
245
245
|
{
|
|
246
|
+
__weak __typeof(self) weakSelf = self;
|
|
247
|
+
RCTBundleURLBlock bundleUrlBlock = ^{
|
|
248
|
+
RCTAppDelegate *strongSelf = weakSelf;
|
|
249
|
+
return strongSelf.bundleURL;
|
|
250
|
+
};
|
|
251
|
+
|
|
246
252
|
RCTRootViewFactoryConfiguration *configuration =
|
|
247
|
-
[[RCTRootViewFactoryConfiguration alloc]
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
253
|
+
[[RCTRootViewFactoryConfiguration alloc] initWithBundleURLBlock:bundleUrlBlock
|
|
254
|
+
newArchEnabled:self.fabricEnabled
|
|
255
|
+
turboModuleEnabled:self.turboModuleEnabled
|
|
256
|
+
bridgelessEnabled:self.bridgelessEnabled];
|
|
251
257
|
|
|
252
|
-
__weak __typeof(self) weakSelf = self;
|
|
253
258
|
configuration.createRootViewWithBridge = ^UIView *(RCTBridge *bridge, NSString *moduleName, NSDictionary *initProps)
|
|
254
259
|
{
|
|
255
260
|
return [weakSelf createRootViewWithBridge:bridge moduleName:moduleName initProps:initProps];
|
|
@@ -23,6 +23,11 @@ typedef UIView *_Nonnull (
|
|
|
23
23
|
^RCTCreateRootViewWithBridgeBlock)(RCTBridge *bridge, NSString *moduleName, NSDictionary *initProps);
|
|
24
24
|
typedef RCTBridge *_Nonnull (
|
|
25
25
|
^RCTCreateBridgeWithDelegateBlock)(id<RCTBridgeDelegate> delegate, NSDictionary *launchOptions);
|
|
26
|
+
typedef NSURL *_Nullable (^RCTSourceURLForBridgeBlock)(RCTBridge *bridge);
|
|
27
|
+
typedef NSURL *_Nullable (^RCTBundleURLBlock)(void);
|
|
28
|
+
typedef NSArray<id<RCTBridgeModule>> *_Nonnull (^RCTExtraModulesForBridgeBlock)(RCTBridge *bridge);
|
|
29
|
+
typedef NSDictionary<NSString *, Class> *_Nonnull (^RCTExtraLazyModuleClassesForBridge)(RCTBridge *bridge);
|
|
30
|
+
typedef BOOL (^RCTBridgeDidNotFindModuleBlock)(RCTBridge *bridge, NSString *moduleName);
|
|
26
31
|
|
|
27
32
|
#pragma mark - RCTRootViewFactory Configuration
|
|
28
33
|
@interface RCTRootViewFactoryConfiguration : NSObject
|
|
@@ -37,7 +42,7 @@ typedef RCTBridge *_Nonnull (
|
|
|
37
42
|
@property (nonatomic, assign, readonly) BOOL turboModuleEnabled;
|
|
38
43
|
|
|
39
44
|
/// Return the bundle URL for the main bundle.
|
|
40
|
-
@property (nonatomic)
|
|
45
|
+
@property (nonatomic, nonnull) RCTBundleURLBlock bundleURLBlock;
|
|
41
46
|
|
|
42
47
|
/**
|
|
43
48
|
* Use this method to initialize a new instance of `RCTRootViewFactoryConfiguration` by passing a `bundleURL`
|
|
@@ -48,10 +53,15 @@ typedef RCTBridge *_Nonnull (
|
|
|
48
53
|
* pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`.
|
|
49
54
|
*
|
|
50
55
|
*/
|
|
56
|
+
- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock
|
|
57
|
+
newArchEnabled:(BOOL)newArchEnabled
|
|
58
|
+
turboModuleEnabled:(BOOL)turboModuleEnabled
|
|
59
|
+
bridgelessEnabled:(BOOL)bridgelessEnabled NS_DESIGNATED_INITIALIZER;
|
|
60
|
+
|
|
51
61
|
- (instancetype)initWithBundleURL:(NSURL *)bundleURL
|
|
52
62
|
newArchEnabled:(BOOL)newArchEnabled
|
|
53
63
|
turboModuleEnabled:(BOOL)turboModuleEnabled
|
|
54
|
-
bridgelessEnabled:(BOOL)bridgelessEnabled;
|
|
64
|
+
bridgelessEnabled:(BOOL)bridgelessEnabled __deprecated;
|
|
55
65
|
|
|
56
66
|
/**
|
|
57
67
|
* Block that allows to override logic of creating root view instance.
|
|
@@ -107,7 +117,7 @@ typedef RCTBridge *_Nonnull (
|
|
|
107
117
|
*
|
|
108
118
|
* @parameter: moduleName - the name of the app, used by Metro to resolve the module.
|
|
109
119
|
* @parameter: initialProperties - a set of initial properties.
|
|
110
|
-
* @parameter:
|
|
120
|
+
* @parameter: launchOptions - a dictionary with a set of options.
|
|
111
121
|
*/
|
|
112
122
|
- (UIView *_Nonnull)viewWithModuleName:(NSString *)moduleName
|
|
113
123
|
initialProperties:(NSDictionary *__nullable)initialProperties
|
|
@@ -57,9 +57,23 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
|
|
|
57
57
|
newArchEnabled:(BOOL)newArchEnabled
|
|
58
58
|
turboModuleEnabled:(BOOL)turboModuleEnabled
|
|
59
59
|
bridgelessEnabled:(BOOL)bridgelessEnabled
|
|
60
|
+
{
|
|
61
|
+
return [self
|
|
62
|
+
initWithBundleURLBlock:^{
|
|
63
|
+
return bundleURL;
|
|
64
|
+
}
|
|
65
|
+
newArchEnabled:newArchEnabled
|
|
66
|
+
turboModuleEnabled:turboModuleEnabled
|
|
67
|
+
bridgelessEnabled:bridgelessEnabled];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
- (instancetype)initWithBundleURLBlock:(RCTBundleURLBlock)bundleURLBlock
|
|
71
|
+
newArchEnabled:(BOOL)newArchEnabled
|
|
72
|
+
turboModuleEnabled:(BOOL)turboModuleEnabled
|
|
73
|
+
bridgelessEnabled:(BOOL)bridgelessEnabled
|
|
60
74
|
{
|
|
61
75
|
if (self = [super init]) {
|
|
62
|
-
|
|
76
|
+
_bundleURLBlock = bundleURLBlock;
|
|
63
77
|
_fabricEnabled = newArchEnabled;
|
|
64
78
|
_turboModuleEnabled = turboModuleEnabled;
|
|
65
79
|
_bridgelessEnabled = bridgelessEnabled;
|
|
@@ -123,7 +137,7 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
|
|
|
123
137
|
RCTEnableTurboModuleInterop(YES);
|
|
124
138
|
RCTEnableTurboModuleInteropBridgeProxy(YES);
|
|
125
139
|
|
|
126
|
-
[self createReactHostIfNeeded];
|
|
140
|
+
[self createReactHostIfNeeded:launchOptions];
|
|
127
141
|
|
|
128
142
|
RCTFabricSurface *surface = [_reactHost createSurfaceWithModuleName:moduleName initialProperties:initProps];
|
|
129
143
|
|
|
@@ -208,19 +222,20 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
|
|
|
208
222
|
|
|
209
223
|
#pragma mark - New Arch Utilities
|
|
210
224
|
|
|
211
|
-
- (void)createReactHostIfNeeded
|
|
225
|
+
- (void)createReactHostIfNeeded:(NSDictionary *)launchOptions
|
|
212
226
|
{
|
|
213
227
|
if (_reactHost) {
|
|
214
228
|
return;
|
|
215
229
|
}
|
|
216
230
|
|
|
217
231
|
__weak __typeof(self) weakSelf = self;
|
|
218
|
-
_reactHost = [[RCTHost alloc]
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
232
|
+
_reactHost = [[RCTHost alloc] initWithBundleURLProvider:self->_configuration.bundleURLBlock
|
|
233
|
+
hostDelegate:nil
|
|
234
|
+
turboModuleManagerDelegate:_turboModuleManagerDelegate
|
|
235
|
+
jsEngineProvider:^std::shared_ptr<facebook::react::JSRuntimeFactory>() {
|
|
236
|
+
return [weakSelf createJSRuntimeFactory];
|
|
237
|
+
}
|
|
238
|
+
launchOptions:launchOptions];
|
|
224
239
|
[_reactHost setBundleURLProvider:^NSURL *() {
|
|
225
240
|
return [weakSelf bundleURL];
|
|
226
241
|
}];
|
|
@@ -249,7 +264,7 @@ static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabri
|
|
|
249
264
|
|
|
250
265
|
- (NSURL *)bundleURL
|
|
251
266
|
{
|
|
252
|
-
return self->_configuration.
|
|
267
|
+
return self->_configuration.bundleURLBlock();
|
|
253
268
|
}
|
|
254
269
|
|
|
255
270
|
@end
|
|
@@ -388,19 +388,15 @@ function Pressable(props: Props, forwardedRef): React.Node {
|
|
|
388
388
|
setFocused(false);
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
|
-
//
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
if (focused && evt.eventType === 'longSelect') {
|
|
401
|
-
// $FlowFixMe[incompatible-exact]
|
|
402
|
-
onLongPress && onLongPress(evt);
|
|
403
|
-
}
|
|
391
|
+
// $FlowFixMe[prop-missing]
|
|
392
|
+
if (focused && evt.eventType === 'select') {
|
|
393
|
+
// $FlowFixMe[incompatible-exact]
|
|
394
|
+
onPress && onPress(evt);
|
|
395
|
+
}
|
|
396
|
+
// $FlowFixMe[prop-missing]
|
|
397
|
+
if (focused && evt.eventType === 'longSelect') {
|
|
398
|
+
// $FlowFixMe[incompatible-exact]
|
|
399
|
+
onLongPress && onLongPress(evt);
|
|
404
400
|
}
|
|
405
401
|
},
|
|
406
402
|
[focused, onBlur, onFocus, onLongPress, onPress, focusable, isTVSelectable],
|
|
@@ -399,12 +399,12 @@ class TouchableHighlight extends React.Component<Props, State> {
|
|
|
399
399
|
}
|
|
400
400
|
},
|
|
401
401
|
onPress: event => {
|
|
402
|
-
if (this.props.onPress != null
|
|
402
|
+
if (this.props.onPress != null) {
|
|
403
403
|
this.props.onPress(event);
|
|
404
404
|
}
|
|
405
405
|
},
|
|
406
406
|
onLongPress: event => {
|
|
407
|
-
if (this.props.onLongPress != null
|
|
407
|
+
if (this.props.onLongPress != null) {
|
|
408
408
|
this.props.onLongPress(event);
|
|
409
409
|
}
|
|
410
410
|
},
|
|
@@ -356,12 +356,12 @@ class TouchableNativeFeedback extends React.Component<Props, State> {
|
|
|
356
356
|
}
|
|
357
357
|
},
|
|
358
358
|
onPress: event => {
|
|
359
|
-
if (this.props.onPress != null
|
|
359
|
+
if (this.props.onPress != null) {
|
|
360
360
|
this.props.onPress(event);
|
|
361
361
|
}
|
|
362
362
|
},
|
|
363
363
|
onLongPress: event => {
|
|
364
|
-
if (this.props.onLongPress != null
|
|
364
|
+
if (this.props.onLongPress != null) {
|
|
365
365
|
this.props.onLongPress(event);
|
|
366
366
|
}
|
|
367
367
|
},
|
|
@@ -328,12 +328,12 @@ class TouchableOpacity extends React.Component<Props, State> {
|
|
|
328
328
|
}
|
|
329
329
|
},
|
|
330
330
|
onPress: event => {
|
|
331
|
-
if (this.props.onPress != null
|
|
331
|
+
if (this.props.onPress != null) {
|
|
332
332
|
this.props.onPress(event);
|
|
333
333
|
}
|
|
334
334
|
},
|
|
335
335
|
onLongPress: event => {
|
|
336
|
-
if (this.props.onLongPress != null
|
|
336
|
+
if (this.props.onLongPress != null) {
|
|
337
337
|
this.props.onLongPress(event);
|
|
338
338
|
}
|
|
339
339
|
},
|
|
@@ -582,6 +582,11 @@ export default class Pressability {
|
|
|
582
582
|
return;
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
+
// Remove spurious onClick events with empty event object generated on Android TV
|
|
586
|
+
if (Platform.isTV && !event?.eventType) {
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
|
|
585
590
|
const {onPress, disabled} = this._config;
|
|
586
591
|
if (onPress != null && disabled !== true) {
|
|
587
592
|
onPress(event);
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
* @oncall react_native
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type {
|
|
13
|
+
ReactDevToolsAgent,
|
|
14
|
+
ReactDevToolsGlobalHook,
|
|
15
|
+
} from '../Types/ReactDevToolsTypes';
|
|
16
|
+
import type {Props} from './AppContainer';
|
|
17
|
+
|
|
18
|
+
import ReactNativeStyleAttributes from '../Components/View/ReactNativeStyleAttributes';
|
|
19
|
+
import View from '../Components/View/View';
|
|
20
|
+
import Platform from '../Utilities/Platform';
|
|
21
|
+
// import DebuggingOverlay from '../Debugging/DebuggingOverlay';
|
|
22
|
+
// import useSubscribeToDebuggingOverlayRegistry from '../Debugging/useSubscribeToDebuggingOverlayRegistry';
|
|
23
|
+
import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
|
|
24
|
+
import LogBoxNotificationContainer from '../LogBox/LogBoxNotificationContainer';
|
|
25
|
+
import StyleSheet from '../StyleSheet/StyleSheet';
|
|
26
|
+
import {RootTagContext, createRootTag} from './RootTag';
|
|
27
|
+
import * as React from 'react';
|
|
28
|
+
|
|
29
|
+
const {useEffect, useState, useCallback} = React;
|
|
30
|
+
|
|
31
|
+
const reactDevToolsHook: ReactDevToolsGlobalHook =
|
|
32
|
+
window.__REACT_DEVTOOLS_GLOBAL_HOOK__;
|
|
33
|
+
|
|
34
|
+
// Required for React DevTools to view / edit React Native styles in Flipper.
|
|
35
|
+
// Flipper doesn't inject these values when initializing DevTools.
|
|
36
|
+
if (reactDevToolsHook) {
|
|
37
|
+
reactDevToolsHook.resolveRNStyle = require('../StyleSheet/flattenStyle');
|
|
38
|
+
reactDevToolsHook.nativeStyleEditorValidAttributes = Object.keys(
|
|
39
|
+
ReactNativeStyleAttributes,
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
type InspectorDeferredProps = {
|
|
44
|
+
inspectedViewRef: InspectedViewRef,
|
|
45
|
+
onInspectedViewRerenderRequest: () => void,
|
|
46
|
+
reactDevToolsAgent?: ReactDevToolsAgent,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const InspectorDeferred = ({
|
|
50
|
+
inspectedViewRef,
|
|
51
|
+
onInspectedViewRerenderRequest,
|
|
52
|
+
reactDevToolsAgent,
|
|
53
|
+
}: InspectorDeferredProps) => {
|
|
54
|
+
// D39382967 adds a require cycle: InitializeCore -> AppContainer -> Inspector -> InspectorPanel -> ScrollView -> InitializeCore
|
|
55
|
+
// We can't remove it yet, fallback to dynamic require for now. This is the only reason why this logic is in a separate function.
|
|
56
|
+
const Inspector = require('../Inspector/Inspector');
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Inspector
|
|
60
|
+
inspectedViewRef={inspectedViewRef}
|
|
61
|
+
onRequestRerenderApp={onInspectedViewRerenderRequest}
|
|
62
|
+
reactDevToolsAgent={reactDevToolsAgent}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type ReactDevToolsOverlayDeferredProps = {
|
|
68
|
+
inspectedViewRef: InspectedViewRef,
|
|
69
|
+
reactDevToolsAgent: ReactDevToolsAgent,
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const ReactDevToolsOverlayDeferred = ({
|
|
73
|
+
inspectedViewRef,
|
|
74
|
+
reactDevToolsAgent,
|
|
75
|
+
}: ReactDevToolsOverlayDeferredProps) => {
|
|
76
|
+
const ReactDevToolsOverlay =
|
|
77
|
+
require('../Inspector/ReactDevToolsOverlay').default;
|
|
78
|
+
|
|
79
|
+
return (
|
|
80
|
+
<ReactDevToolsOverlay
|
|
81
|
+
inspectedViewRef={inspectedViewRef}
|
|
82
|
+
reactDevToolsAgent={reactDevToolsAgent}
|
|
83
|
+
/>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const AppContainer = ({
|
|
88
|
+
children,
|
|
89
|
+
fabric,
|
|
90
|
+
initialProps,
|
|
91
|
+
internal_excludeInspector = false,
|
|
92
|
+
internal_excludeLogBox = false,
|
|
93
|
+
rootTag,
|
|
94
|
+
showArchitectureIndicator,
|
|
95
|
+
WrapperComponent,
|
|
96
|
+
}: Props): React.Node => {
|
|
97
|
+
const appContainerRootViewRef: AppContainerRootViewRef = React.useRef(null);
|
|
98
|
+
const innerViewRef: InspectedViewRef = React.useRef(null);
|
|
99
|
+
const debuggingOverlayRef: DebuggingOverlayRef = React.useRef(null);
|
|
100
|
+
|
|
101
|
+
/*
|
|
102
|
+
useSubscribeToDebuggingOverlayRegistry(
|
|
103
|
+
appContainerRootViewRef,
|
|
104
|
+
debuggingOverlayRef,
|
|
105
|
+
);
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
const [key, setKey] = useState(0);
|
|
109
|
+
const [shouldRenderInspector, setShouldRenderInspector] = useState(false);
|
|
110
|
+
const [reactDevToolsAgent, setReactDevToolsAgent] =
|
|
111
|
+
useState<ReactDevToolsAgent | void>(reactDevToolsHook?.reactDevtoolsAgent);
|
|
112
|
+
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
let inspectorSubscription = null;
|
|
115
|
+
if (!internal_excludeInspector) {
|
|
116
|
+
inspectorSubscription = RCTDeviceEventEmitter.addListener(
|
|
117
|
+
'toggleElementInspector',
|
|
118
|
+
() => setShouldRenderInspector(value => !value),
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
let reactDevToolsAgentListener = null;
|
|
123
|
+
// If this is first render, subscribe to the event from React DevTools hook
|
|
124
|
+
if (reactDevToolsHook != null && reactDevToolsAgent == null) {
|
|
125
|
+
reactDevToolsAgentListener = setReactDevToolsAgent;
|
|
126
|
+
reactDevToolsHook.on?.('react-devtools', reactDevToolsAgentListener);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
return () => {
|
|
130
|
+
inspectorSubscription?.remove();
|
|
131
|
+
|
|
132
|
+
if (
|
|
133
|
+
reactDevToolsHook?.off != null &&
|
|
134
|
+
reactDevToolsAgentListener != null
|
|
135
|
+
) {
|
|
136
|
+
reactDevToolsHook.off('react-devtools', reactDevToolsAgentListener);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
140
|
+
}, []);
|
|
141
|
+
|
|
142
|
+
let innerView: React.Node = (
|
|
143
|
+
<View
|
|
144
|
+
collapsable={reactDevToolsAgent == null && !shouldRenderInspector}
|
|
145
|
+
pointerEvents="box-none"
|
|
146
|
+
key={key}
|
|
147
|
+
style={styles.container}
|
|
148
|
+
ref={innerViewRef}>
|
|
149
|
+
{children}
|
|
150
|
+
</View>
|
|
151
|
+
);
|
|
152
|
+
|
|
153
|
+
if (WrapperComponent != null) {
|
|
154
|
+
innerView = (
|
|
155
|
+
<WrapperComponent
|
|
156
|
+
initialProps={initialProps}
|
|
157
|
+
fabric={fabric === true}
|
|
158
|
+
showArchitectureIndicator={showArchitectureIndicator === true}>
|
|
159
|
+
{innerView}
|
|
160
|
+
</WrapperComponent>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const onInspectedViewRerenderRequest = useCallback(
|
|
165
|
+
() => setKey(k => k + 1),
|
|
166
|
+
[],
|
|
167
|
+
);
|
|
168
|
+
|
|
169
|
+
return (
|
|
170
|
+
<RootTagContext.Provider value={createRootTag(rootTag)}>
|
|
171
|
+
<View
|
|
172
|
+
ref={appContainerRootViewRef}
|
|
173
|
+
style={styles.container}
|
|
174
|
+
pointerEvents="box-none">
|
|
175
|
+
{innerView}
|
|
176
|
+
|
|
177
|
+
{/* <DebuggingOverlay ref={debuggingOverlayRef} /> */}
|
|
178
|
+
|
|
179
|
+
{reactDevToolsAgent != null && (
|
|
180
|
+
<ReactDevToolsOverlayDeferred
|
|
181
|
+
inspectedViewRef={innerViewRef}
|
|
182
|
+
reactDevToolsAgent={reactDevToolsAgent}
|
|
183
|
+
/>
|
|
184
|
+
)}
|
|
185
|
+
|
|
186
|
+
{shouldRenderInspector && (
|
|
187
|
+
<InspectorDeferred
|
|
188
|
+
inspectedViewRef={innerViewRef}
|
|
189
|
+
onInspectedViewRerenderRequest={onInspectedViewRerenderRequest}
|
|
190
|
+
reactDevToolsAgent={reactDevToolsAgent}
|
|
191
|
+
/>
|
|
192
|
+
)}
|
|
193
|
+
|
|
194
|
+
{!internal_excludeLogBox && <LogBoxNotificationContainer />}
|
|
195
|
+
</View>
|
|
196
|
+
</RootTagContext.Provider>
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const styles = StyleSheet.create({
|
|
201
|
+
container: {flex: 1},
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
export type AppContainerRootViewRef = React.RefObject<React.ElementRef<
|
|
205
|
+
typeof View,
|
|
206
|
+
> | null>;
|
|
207
|
+
export type InspectedViewRef = React.RefObject<React.ElementRef<
|
|
208
|
+
typeof View,
|
|
209
|
+
> | null>;
|
|
210
|
+
export type DebuggingOverlayRef = React.RefObject<React.ElementRef<
|
|
211
|
+
typeof DebuggingOverlay,
|
|
212
|
+
> | null>;
|
|
213
|
+
|
|
214
|
+
export default AppContainer;
|
|
@@ -18,8 +18,11 @@ import type {Props} from './AppContainer';
|
|
|
18
18
|
import ReactNativeStyleAttributes from '../Components/View/ReactNativeStyleAttributes';
|
|
19
19
|
import View from '../Components/View/View';
|
|
20
20
|
import Platform from '../Utilities/Platform';
|
|
21
|
+
/*
|
|
22
|
+
// Stub out DebuggingOverlay from TV for now
|
|
21
23
|
import DebuggingOverlay from '../Debugging/DebuggingOverlay';
|
|
22
24
|
import useSubscribeToDebuggingOverlayRegistry from '../Debugging/useSubscribeToDebuggingOverlayRegistry';
|
|
25
|
+
*/
|
|
23
26
|
import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
|
|
24
27
|
import LogBoxNotificationContainer from '../LogBox/LogBoxNotificationContainer';
|
|
25
28
|
import StyleSheet from '../StyleSheet/StyleSheet';
|
|
@@ -96,12 +99,14 @@ const AppContainer = ({
|
|
|
96
99
|
}: Props): React.Node => {
|
|
97
100
|
const appContainerRootViewRef: AppContainerRootViewRef = React.useRef(null);
|
|
98
101
|
const innerViewRef: InspectedViewRef = React.useRef(null);
|
|
102
|
+
/*
|
|
99
103
|
const debuggingOverlayRef: DebuggingOverlayRef = React.useRef(null);
|
|
100
104
|
|
|
101
105
|
useSubscribeToDebuggingOverlayRegistry(
|
|
102
106
|
appContainerRootViewRef,
|
|
103
107
|
debuggingOverlayRef,
|
|
104
108
|
);
|
|
109
|
+
*/
|
|
105
110
|
|
|
106
111
|
const [key, setKey] = useState(0);
|
|
107
112
|
const [shouldRenderInspector, setShouldRenderInspector] = useState(false);
|
|
@@ -172,7 +177,7 @@ const AppContainer = ({
|
|
|
172
177
|
pointerEvents="box-none">
|
|
173
178
|
{innerView}
|
|
174
179
|
|
|
175
|
-
{
|
|
180
|
+
{/* <DebuggingOverlay ref={debuggingOverlayRef} /> */}
|
|
176
181
|
|
|
177
182
|
{reactDevToolsAgent != null && (
|
|
178
183
|
<ReactDevToolsOverlayDeferred
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
|
|
10
10
|
#import "RCTBridgeModule.h"
|
|
11
11
|
|
|
12
|
+
NS_ASSUME_NONNULL_BEGIN
|
|
13
|
+
|
|
12
14
|
@class RCTBundleManager;
|
|
13
15
|
@class RCTCallableJSModules;
|
|
14
16
|
@class RCTModuleRegistry;
|
|
@@ -22,7 +24,8 @@
|
|
|
22
24
|
callableJSModules:(RCTCallableJSModules *)callableJSModules
|
|
23
25
|
dispatchToJSThread:(void (^)(dispatch_block_t))dispatchToJSThread
|
|
24
26
|
registerSegmentWithId:(void (^)(NSNumber *, NSString *))registerSegmentWithId
|
|
25
|
-
runtime:(void *)runtime
|
|
27
|
+
runtime:(void *)runtime
|
|
28
|
+
launchOptions:(nullable NSDictionary *)launchOptions NS_DESIGNATED_INITIALIZER;
|
|
26
29
|
|
|
27
30
|
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel;
|
|
28
31
|
- (void)forwardInvocation:(NSInvocation *)invocation;
|
|
@@ -37,3 +40,5 @@
|
|
|
37
40
|
- (id)moduleForName:(NSString *)moduleName lazilyLoadIfNecessary:(BOOL)lazilyLoad;
|
|
38
41
|
|
|
39
42
|
@end
|
|
43
|
+
|
|
44
|
+
NS_ASSUME_NONNULL_END
|
|
@@ -35,6 +35,7 @@ using namespace facebook;
|
|
|
35
35
|
RCTModuleRegistry *_moduleRegistry;
|
|
36
36
|
RCTBundleManager *_bundleManager;
|
|
37
37
|
RCTCallableJSModules *_callableJSModules;
|
|
38
|
+
NSDictionary *_launchOptions;
|
|
38
39
|
void (^_dispatchToJSThread)(dispatch_block_t);
|
|
39
40
|
void (^_registerSegmentWithId)(NSNumber *, NSString *);
|
|
40
41
|
void *_runtime;
|
|
@@ -47,6 +48,7 @@ using namespace facebook;
|
|
|
47
48
|
dispatchToJSThread:(void (^)(dispatch_block_t))dispatchToJSThread
|
|
48
49
|
registerSegmentWithId:(void (^)(NSNumber *, NSString *))registerSegmentWithId
|
|
49
50
|
runtime:(void *)runtime
|
|
51
|
+
launchOptions:(nullable NSDictionary *)launchOptions
|
|
50
52
|
{
|
|
51
53
|
self = [super self];
|
|
52
54
|
if (self) {
|
|
@@ -57,6 +59,7 @@ using namespace facebook;
|
|
|
57
59
|
_dispatchToJSThread = dispatchToJSThread;
|
|
58
60
|
_registerSegmentWithId = registerSegmentWithId;
|
|
59
61
|
_runtime = runtime;
|
|
62
|
+
_launchOptions = [launchOptions copy];
|
|
60
63
|
}
|
|
61
64
|
return self;
|
|
62
65
|
}
|
|
@@ -191,8 +194,7 @@ using namespace facebook;
|
|
|
191
194
|
|
|
192
195
|
- (NSDictionary *)launchOptions
|
|
193
196
|
{
|
|
194
|
-
|
|
195
|
-
return nil;
|
|
197
|
+
return _launchOptions;
|
|
196
198
|
}
|
|
197
199
|
|
|
198
200
|
- (BOOL)loading
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This source code is licensed under the MIT license found in the
|
|
3
|
+
* LICENSE file in the root directory of this source tree.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#ifndef RCTTVNavigationEventNotification_h
|
|
7
|
+
#define RCTTVNavigationEventNotification_h
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
#import "RCTTVNavigationEventNotificationConstants.h"
|
|
11
|
+
#import "RCTTVRemoteHandlerConstants.h"
|
|
12
|
+
|
|
13
|
+
@interface NSNotificationCenter (RCTTVNavigationEventNotification)
|
|
14
|
+
|
|
15
|
+
- (void)postNavigationFocusEventWithTag:(NSNumber * _Nullable)eventTag
|
|
16
|
+
target:(NSNumber * _Nullable)eventTarget;
|
|
17
|
+
|
|
18
|
+
- (void)postNavigationBlurEventWithTag:(NSNumber * _Nullable)eventTag
|
|
19
|
+
target:(NSNumber * _Nullable)eventTarget;
|
|
20
|
+
|
|
21
|
+
- (void)postNavigationPressEventWithType:(RCTTVRemoteEvent _Nonnull)eventType
|
|
22
|
+
keyAction:(RCTTVRemoteEventKeyAction _Nullable)eventKeyAction
|
|
23
|
+
tag:(NSNumber * _Nullable)eventTag
|
|
24
|
+
target:(NSNumber * _Nullable)eventTarget;
|
|
25
|
+
|
|
26
|
+
- (void)postNavigationTouchEventWithType:(RCTTVRemoteEvent _Nonnull)eventType
|
|
27
|
+
body:(NSDictionary * _Nullable)eventBody;
|
|
28
|
+
@end
|
|
29
|
+
|
|
30
|
+
@interface UIGestureRecognizer (RCTTVNavigationEventNotification)
|
|
31
|
+
|
|
32
|
+
@property (readonly, nullable) RCTTVRemoteEventKeyAction eventKeyAction;
|
|
33
|
+
@property (readonly, nonnull) NSDictionary *eventState;
|
|
34
|
+
|
|
35
|
+
@end
|
|
36
|
+
|
|
37
|
+
#endif /* RCTTVNavigationEventNotification_h */
|