react-native-tvos 0.74.0-0rc0 → 0.74.0-0rc2
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/ReactNative/AppContainer-dev.js +21 -2
- package/React/Base/RCTBridge+Inspector.h +30 -0
- package/React/Base/RCTBridge+Private.h +0 -20
- package/React/Base/RCTBridge.mm +1 -0
- 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/RCTDevSettings.mm +1 -0
- package/React/CoreModules/RCTDeviceInfo.mm +15 -16
- package/React/CoreModules/RCTTVNavigationEventEmitter.mm +2 -1
- package/React/CxxBridge/RCTCxxBridge.mm +1 -0
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +11 -12
- package/React/Fabric/Mounting/ComponentViews/View/RCTViewComponentView.mm +6 -17
- package/React/Fabric/RCTSurfacePointerHandler.mm +1 -0
- package/React/Modules/RCTUIManager.m +10 -0
- package/React/Views/RCTTVView.m +6 -17
- package/React/Views/ScrollView/RCTScrollView.m +11 -12
- package/ReactAndroid/api/ReactAndroid.api +25 -1
- package/ReactAndroid/build.gradle.kts +18 -6
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/hermes-engine/build.gradle.kts +2 -0
- package/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +4 -0
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +14 -36
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +106 -9
- package/ReactAndroid/src/main/java/com/facebook/react/ReactHost.kt +8 -0
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +2 -1
- package/ReactAndroid/src/main/java/com/facebook/react/fabric/internal/interop/InteropUiBlockListener.kt +8 -2
- 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/ReactHostImpl.java +64 -0
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactInstance.java +4 -0
- 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/ReactAndroid/src/main/java/com/facebook/react/uimanager/ViewManagerRegistry.java +17 -1
- package/ReactAndroid/src/main/java/com/facebook/react/views/scroll/ReactHorizontalScrollView.java +1 -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/hermes/HermesInstance.cpp +0 -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 +6 -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 +22 -14
- package/scripts/cocoapods/helpers.rb +4 -0
- package/scripts/cocoapods/utils.rb +27 -7
- package/scripts/react_native_pods.rb +2 -0
- package/scripts/xcode/ccache-clang++.sh +14 -0
- package/scripts/xcode/ccache-clang.sh +14 -0
- package/scripts/xcode/ccache.conf +11 -0
- package/sdks/hermes-engine/utils/build-ios-framework.sh +5 -0
- package/sdks/hermes-engine/utils/build-mac-framework.sh +5 -0
- 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
- package/ReactAndroid/src/main/java/com/facebook/react/common/build/ReactBuildConfig.java +0 -23
|
@@ -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);
|
|
@@ -21,7 +21,6 @@ import Platform from '../Utilities/Platform';
|
|
|
21
21
|
import DebuggingOverlay from '../Debugging/DebuggingOverlay';
|
|
22
22
|
import useSubscribeToDebuggingOverlayRegistry from '../Debugging/useSubscribeToDebuggingOverlayRegistry';
|
|
23
23
|
import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
|
|
24
|
-
import ReactDevToolsOverlay from '../Inspector/ReactDevToolsOverlay';
|
|
25
24
|
import LogBoxNotificationContainer from '../LogBox/LogBoxNotificationContainer';
|
|
26
25
|
import StyleSheet from '../StyleSheet/StyleSheet';
|
|
27
26
|
import {RootTagContext, createRootTag} from './RootTag';
|
|
@@ -65,6 +64,26 @@ const InspectorDeferred = ({
|
|
|
65
64
|
);
|
|
66
65
|
};
|
|
67
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
|
+
|
|
68
87
|
const AppContainer = ({
|
|
69
88
|
children,
|
|
70
89
|
fabric,
|
|
@@ -156,7 +175,7 @@ const AppContainer = ({
|
|
|
156
175
|
{!Platform.isTV ? <DebuggingOverlay ref={debuggingOverlayRef} /> : null}
|
|
157
176
|
|
|
158
177
|
{reactDevToolsAgent != null && (
|
|
159
|
-
<
|
|
178
|
+
<ReactDevToolsOverlayDeferred
|
|
160
179
|
inspectedViewRef={innerViewRef}
|
|
161
180
|
reactDevToolsAgent={reactDevToolsAgent}
|
|
162
181
|
/>
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
|
|
8
|
+
#import <React/RCTBridge.h>
|
|
9
|
+
|
|
10
|
+
#ifdef __cplusplus
|
|
11
|
+
#import <jsinspector-modern/ReactCdp.h>
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
@interface RCTBridge (Inspector)
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The HostTarget for this bridge, if one has been created. Exposed for RCTCxxBridge only.
|
|
18
|
+
*/
|
|
19
|
+
@property (nonatomic, assign, readonly)
|
|
20
|
+
#ifdef __cplusplus
|
|
21
|
+
facebook::react::jsinspector_modern::PageTarget *
|
|
22
|
+
#else
|
|
23
|
+
// The inspector infrastructure cannot be used in C or Swift code.
|
|
24
|
+
void *
|
|
25
|
+
#endif
|
|
26
|
+
inspectorTarget;
|
|
27
|
+
|
|
28
|
+
@property (nonatomic, readonly, getter=isInspectable) BOOL inspectable;
|
|
29
|
+
|
|
30
|
+
@end
|
|
@@ -6,9 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
#import <React/RCTBridge.h>
|
|
9
|
-
#ifdef __cplusplus
|
|
10
|
-
#import <jsinspector-modern/ReactCdp.h>
|
|
11
|
-
#endif
|
|
12
9
|
|
|
13
10
|
@class RCTModuleRegistry;
|
|
14
11
|
@class RCTModuleData;
|
|
@@ -73,17 +70,6 @@ RCT_EXTERN void RCTRegisterModule(Class);
|
|
|
73
70
|
*/
|
|
74
71
|
@property (nonatomic, strong, readonly) RCTModuleRegistry *moduleRegistry;
|
|
75
72
|
|
|
76
|
-
/**
|
|
77
|
-
* The page target for this bridge, if one has been created. Exposed for RCTCxxBridge only.
|
|
78
|
-
*/
|
|
79
|
-
@property (nonatomic, assign, readonly)
|
|
80
|
-
#ifdef __cplusplus
|
|
81
|
-
facebook::react::jsinspector_modern::PageTarget *
|
|
82
|
-
#else
|
|
83
|
-
// The inspector infrastructure cannot be used in C code.
|
|
84
|
-
void *
|
|
85
|
-
#endif
|
|
86
|
-
inspectorTarget;
|
|
87
73
|
@end
|
|
88
74
|
|
|
89
75
|
@interface RCTBridge (RCTCxxBridge)
|
|
@@ -155,12 +141,6 @@ RCT_EXTERN void RCTRegisterModule(Class);
|
|
|
155
141
|
|
|
156
142
|
@end
|
|
157
143
|
|
|
158
|
-
@interface RCTBridge (Inspector)
|
|
159
|
-
|
|
160
|
-
@property (nonatomic, readonly, getter=isInspectable) BOOL inspectable;
|
|
161
|
-
|
|
162
|
-
@end
|
|
163
|
-
|
|
164
144
|
@interface RCTCxxBridge : RCTBridge
|
|
165
145
|
|
|
166
146
|
// TODO(cjhopman): this seems unsafe unless we require that it is only called on the main js queue.
|
package/React/Base/RCTBridge.mm
CHANGED
|
@@ -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 */
|
|
@@ -0,0 +1,106 @@
|
|
|
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
|
+
#import "RCTTVNavigationEventNotification.h"
|
|
7
|
+
#import "RCTTVNavigationEventNotificationConstants.h"
|
|
8
|
+
|
|
9
|
+
@implementation NSNotificationCenter (RCTTVNavigationEventNotification)
|
|
10
|
+
- (void)postNavigationFocusEventWithTag:(NSNumber * _Nullable)eventTag
|
|
11
|
+
target:(NSNumber * _Nullable)eventTarget {
|
|
12
|
+
[self postNavigationEventWithtEventType:@"focus" keyAction:RCTTVRemoteEventKeyActionUnknown tag:eventTag target:eventTarget body:nil];
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
- (void)postNavigationBlurEventWithTag:(NSNumber * _Nullable)eventTag
|
|
16
|
+
target:(NSNumber * _Nullable)eventTarget {
|
|
17
|
+
[self postNavigationEventWithtEventType:@"blur" keyAction:RCTTVRemoteEventKeyActionUnknown tag:eventTag target:eventTarget body:nil];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
- (void)postNavigationPressEventWithType:(RCTTVRemoteEvent _Nonnull)eventType
|
|
21
|
+
keyAction:(RCTTVRemoteEventKeyAction _Nullable)eventKeyAction
|
|
22
|
+
tag:(NSNumber * _Nullable)eventTag
|
|
23
|
+
target:(NSNumber * _Nullable)eventTarget {
|
|
24
|
+
|
|
25
|
+
[self postNavigationEventWithtEventType:eventType keyAction:eventKeyAction tag:eventTag target:eventTarget body:nil];
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
- (void)postNavigationTouchEventWithType:(RCTTVRemoteEvent _Nonnull)eventType
|
|
30
|
+
body:(NSDictionary * _Nullable)eventBody {
|
|
31
|
+
[self postNavigationEventWithtEventType:eventType keyAction:nil tag:nil target:nil body:eventBody];
|
|
32
|
+
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#pragma mark - Private
|
|
36
|
+
|
|
37
|
+
- (void)postNavigationEventWithtEventType:(NSString *)eventType
|
|
38
|
+
keyAction:(RCTTVRemoteEventKeyAction _Nullable)eventKeyAction
|
|
39
|
+
tag:(NSNumber * _Nullable)eventTag
|
|
40
|
+
target:(NSNumber * _Nullable)eventTarget
|
|
41
|
+
body:(NSDictionary * _Nullable)eventBody
|
|
42
|
+
|
|
43
|
+
{
|
|
44
|
+
NSMutableDictionary *payload = [@{RCTTVNavigationEventNotificationKeyEventType : eventType} mutableCopy];
|
|
45
|
+
|
|
46
|
+
if (eventKeyAction != nil) {
|
|
47
|
+
payload[RCTTVNavigationEventNotificationKeyEventKeyAction] = eventKeyAction;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (eventTag != nil) {
|
|
51
|
+
payload[RCTTVNavigationEventNotificationKeyTag] = eventTag;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (eventTarget != nil) {
|
|
55
|
+
payload[RCTTVNavigationEventNotificationKeyTarget] = eventTarget;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (eventBody != nil && eventBody.count > 0) {
|
|
59
|
+
payload[RCTTVNavigationEventNotificationKeyBody] = eventBody;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
[self postNotificationName:RCTTVNavigationEventNotificationName object:[payload copy]];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@end
|
|
66
|
+
|
|
67
|
+
@implementation UIGestureRecognizer (RCTTVNavigationEventNotification)
|
|
68
|
+
|
|
69
|
+
- (RCTTVRemoteEventKeyAction _Nullable)eventKeyAction
|
|
70
|
+
{
|
|
71
|
+
switch (self.state) {
|
|
72
|
+
case UIGestureRecognizerStateBegan:
|
|
73
|
+
return RCTTVRemoteEventKeyActionDown;
|
|
74
|
+
case UIGestureRecognizerStateEnded:
|
|
75
|
+
return RCTTVRemoteEventKeyActionUp;
|
|
76
|
+
default:
|
|
77
|
+
return nil;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
- (NSDictionary * _Nonnull)eventState {
|
|
82
|
+
NSString *eventBodyState = self.eventBodyState;
|
|
83
|
+
if (eventBodyState) {
|
|
84
|
+
return @{@"state": eventBodyState};
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
return @{};
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
#pragma mark - Private
|
|
92
|
+
|
|
93
|
+
- (NSString * _Nullable)eventBodyState {
|
|
94
|
+
switch (self.state) {
|
|
95
|
+
case UIGestureRecognizerStateBegan:
|
|
96
|
+
return @"Began";
|
|
97
|
+
case UIGestureRecognizerStateChanged:
|
|
98
|
+
return @"Changed";
|
|
99
|
+
case UIGestureRecognizerStateEnded:
|
|
100
|
+
return @"Ended";
|
|
101
|
+
default:
|
|
102
|
+
return nil;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@end
|
|
@@ -0,0 +1,25 @@
|
|
|
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 RCTTVNavigationEventNotificationConstants_h
|
|
7
|
+
#define RCTTVNavigationEventNotificationConstants_h
|
|
8
|
+
|
|
9
|
+
#import <Foundation/Foundation.h>
|
|
10
|
+
|
|
11
|
+
extern NSString * _Nonnull const RCTTVNavigationEventNotificationName;
|
|
12
|
+
|
|
13
|
+
typedef NSString *RCTTVNavigationEventNotificationKey NS_TYPED_ENUM;
|
|
14
|
+
extern RCTTVNavigationEventNotificationKey _Nonnull const RCTTVNavigationEventNotificationKeyEventType;
|
|
15
|
+
extern RCTTVNavigationEventNotificationKey _Nonnull const RCTTVNavigationEventNotificationKeyEventKeyAction;
|
|
16
|
+
extern RCTTVNavigationEventNotificationKey _Nonnull const RCTTVNavigationEventNotificationKeyTag;
|
|
17
|
+
extern RCTTVNavigationEventNotificationKey _Nonnull const RCTTVNavigationEventNotificationKeyTarget;
|
|
18
|
+
extern RCTTVNavigationEventNotificationKey _Nonnull const RCTTVNavigationEventNotificationKeyBody;
|
|
19
|
+
|
|
20
|
+
typedef NSNumber *RCTTVRemoteEventKeyAction NS_TYPED_ENUM;
|
|
21
|
+
extern RCTTVRemoteEventKeyAction _Nonnull const RCTTVRemoteEventKeyActionUnknown;
|
|
22
|
+
extern RCTTVRemoteEventKeyAction _Nonnull const RCTTVRemoteEventKeyActionDown;
|
|
23
|
+
extern RCTTVRemoteEventKeyAction _Nonnull const RCTTVRemoteEventKeyActionUp;
|
|
24
|
+
|
|
25
|
+
#endif /* RCTTVNavigationEventNotificationConstants_h */
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
#import "RCTTVNavigationEventNotificationConstants.h"
|
|
7
|
+
|
|
8
|
+
NSString *const RCTTVNavigationEventNotificationName = @"RCTTVNavigationEventNotification";
|
|
9
|
+
|
|
10
|
+
RCTTVNavigationEventNotificationKey _Nonnull const RCTTVNavigationEventNotificationKeyEventType = @"eventType";
|
|
11
|
+
RCTTVNavigationEventNotificationKey _Nonnull const RCTTVNavigationEventNotificationKeyEventKeyAction = @"eventKeyAction";
|
|
12
|
+
RCTTVNavigationEventNotificationKey _Nonnull const RCTTVNavigationEventNotificationKeyTag = @"tag";
|
|
13
|
+
RCTTVNavigationEventNotificationKey _Nonnull const RCTTVNavigationEventNotificationKeyTarget = @"target";
|
|
14
|
+
RCTTVNavigationEventNotificationKey _Nonnull const RCTTVNavigationEventNotificationKeyBody = @"body";
|
|
15
|
+
|
|
16
|
+
RCTTVRemoteEventKeyAction _Nonnull const RCTTVRemoteEventKeyActionUnknown = @(-1);
|
|
17
|
+
RCTTVRemoteEventKeyAction _Nonnull const RCTTVRemoteEventKeyActionDown = @(0);
|
|
18
|
+
RCTTVRemoteEventKeyAction _Nonnull const RCTTVRemoteEventKeyActionUp = @(1);
|
|
@@ -16,32 +16,6 @@ extern NSString * _Nonnull const RCTTVDisablePanGestureNotification;
|
|
|
16
16
|
extern NSString * _Nonnull const RCTTVEnableGestureHandlersCancelTouchesNotification;
|
|
17
17
|
extern NSString * _Nonnull const RCTTVDisableGestureHandlersCancelTouchesNotification;
|
|
18
18
|
|
|
19
|
-
extern NSString * _Nonnull const RCTTVRemoteEventMenu;
|
|
20
|
-
extern NSString * _Nonnull const RCTTVRemoteEventPlayPause;
|
|
21
|
-
extern NSString * _Nonnull const RCTTVRemoteEventSelect;
|
|
22
|
-
|
|
23
|
-
extern NSString * _Nonnull const RCTTVRemoteEventLongPlayPause;
|
|
24
|
-
extern NSString * _Nonnull const RCTTVRemoteEventLongSelect;
|
|
25
|
-
extern NSString * _Nonnull const RCTTVRemoteEventLongUp;
|
|
26
|
-
extern NSString * _Nonnull const RCTTVRemoteEventLongDown;
|
|
27
|
-
extern NSString * _Nonnull const RCTTVRemoteEventLongLeft;
|
|
28
|
-
extern NSString * _Nonnull const RCTTVRemoteEventLongRight;
|
|
29
|
-
|
|
30
|
-
extern NSString * _Nonnull const RCTTVRemoteEventLeft;
|
|
31
|
-
extern NSString * _Nonnull const RCTTVRemoteEventRight;
|
|
32
|
-
extern NSString * _Nonnull const RCTTVRemoteEventUp;
|
|
33
|
-
extern NSString * _Nonnull const RCTTVRemoteEventDown;
|
|
34
|
-
|
|
35
|
-
extern NSString * _Nonnull const RCTTVRemoteEventPageUp;
|
|
36
|
-
extern NSString * _Nonnull const RCTTVRemoteEventPageDown;
|
|
37
|
-
|
|
38
|
-
extern NSString * _Nonnull const RCTTVRemoteEventSwipeLeft;
|
|
39
|
-
extern NSString * _Nonnull const RCTTVRemoteEventSwipeRight;
|
|
40
|
-
extern NSString * _Nonnull const RCTTVRemoteEventSwipeUp;
|
|
41
|
-
extern NSString * _Nonnull const RCTTVRemoteEventSwipeDown;
|
|
42
|
-
|
|
43
|
-
extern NSString * _Nonnull const RCTTVRemoteEventPan;
|
|
44
|
-
|
|
45
19
|
@interface RCTTVRemoteHandler : NSObject
|
|
46
20
|
|
|
47
21
|
- (instancetype _Nonnull )initWithView:(UIView * _Nonnull)view;
|