react-native-tvos 0.64.2-0 → 0.64.2-4
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/Components/AppleTV/TVFocusGuideView.js +24 -1
- package/Libraries/Components/AppleTV/TVFocusGuideView.js.orig +61 -0
- package/Libraries/Components/Pressable/Pressable.js +4 -4
- package/Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js +14 -8
- package/Libraries/Components/Touchable/Touchable.js +1 -0
- package/Libraries/NewAppScreen/components/HermesBadge.js +39 -12
- package/README.md +8 -2
- package/React/Base/RCTRootView.m +5 -35
- package/React/Base/RCTTVRemoteHandler.h +5 -2
- package/React/Base/RCTTVRemoteHandler.m +173 -70
- package/React/Modules/RCTTVMenuBridge.m +3 -0
- package/React/Views/RCTFont.mm +4 -0
- package/React/Views/RCTModalHostView.m +6 -9
- package/React/Views/RCTTVFocusGuideView.m +1 -1
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/androidTest/assets/AndroidTestBundle.js +47 -24
- package/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java +10 -9
- package/ReactAndroid/src/main/java/com/facebook/react/{ReactAndroidHWInputDeviceHelper.java → modules/core/ReactAndroidHWInputDeviceHelper.java} +27 -20
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/BUCK +1 -0
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java +21 -0
- package/ReactCommon/hermes/inspector/tools/msggen/yarn.lock +92 -97
- package/android/com/facebook/react/react-native/{0.64.2-0/react-native-0.64.2-0-sources.jar → 0.64.2-4/react-native-0.64.2-4-sources.jar} +0 -0
- package/android/com/facebook/react/react-native/0.64.2-4/react-native-0.64.2-4-sources.jar.md5 +1 -0
- package/android/com/facebook/react/react-native/0.64.2-4/react-native-0.64.2-4-sources.jar.sha1 +1 -0
- package/android/com/facebook/react/react-native/{0.64.2-0/react-native-0.64.2-0.aar → 0.64.2-4/react-native-0.64.2-4.aar} +0 -0
- package/android/com/facebook/react/react-native/0.64.2-4/react-native-0.64.2-4.aar.md5 +1 -0
- package/android/com/facebook/react/react-native/0.64.2-4/react-native-0.64.2-4.aar.sha1 +1 -0
- package/android/com/facebook/react/react-native/{0.64.2-0/react-native-0.64.2-0.pom → 0.64.2-4/react-native-0.64.2-4.pom} +1 -1
- package/android/com/facebook/react/react-native/0.64.2-4/react-native-0.64.2-4.pom.md5 +1 -0
- package/android/com/facebook/react/react-native/0.64.2-4/react-native-0.64.2-4.pom.sha1 +1 -0
- package/android/com/facebook/react/react-native/maven-metadata.xml +3 -3
- package/android/com/facebook/react/react-native/maven-metadata.xml.md5 +1 -1
- package/android/com/facebook/react/react-native/maven-metadata.xml.sha1 +1 -1
- package/package.json +1 -1
- package/template/App.js +1 -2
- package/template/package.json +1 -1
- package/tvos-types.d.ts +1 -1
- package/ReactAndroid/build.gradle.orig +0 -479
- package/android/com/facebook/react/react-native/0.64.2-0/react-native-0.64.2-0-sources.jar.md5 +0 -1
- package/android/com/facebook/react/react-native/0.64.2-0/react-native-0.64.2-0-sources.jar.sha1 +0 -1
- package/android/com/facebook/react/react-native/0.64.2-0/react-native-0.64.2-0.aar.md5 +0 -1
- package/android/com/facebook/react/react-native/0.64.2-0/react-native-0.64.2-0.aar.sha1 +0 -1
- package/android/com/facebook/react/react-native/0.64.2-0/react-native-0.64.2-0.pom.md5 +0 -1
- package/android/com/facebook/react/react-native/0.64.2-0/react-native-0.64.2-0.pom.sha1 +0 -1
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
#import "RCTTVMenuBridge.h"
|
|
8
8
|
#import <React/RCTRootView.h>
|
|
9
|
+
#import <React/RCTTVRemoteHandler.h>
|
|
9
10
|
|
|
10
11
|
@implementation RCTTVMenuBridge
|
|
11
12
|
|
|
@@ -13,11 +14,13 @@ RCT_EXPORT_MODULE();
|
|
|
13
14
|
|
|
14
15
|
RCT_EXPORT_METHOD(enableTVMenuKey)
|
|
15
16
|
{
|
|
17
|
+
[RCTTVRemoteHandler setUseMenuKey:YES];
|
|
16
18
|
[[NSNotificationCenter defaultCenter] postNotificationName:RCTTVEnableMenuKeyNotification object:nil];
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
RCT_EXPORT_METHOD(disableTVMenuKey)
|
|
20
22
|
{
|
|
23
|
+
[RCTTVRemoteHandler setUseMenuKey:NO];
|
|
21
24
|
[[NSNotificationCenter defaultCenter] postNotificationName:RCTTVDisableMenuKeyNotification object:nil];
|
|
22
25
|
}
|
|
23
26
|
|
package/React/Views/RCTFont.mm
CHANGED
|
@@ -326,7 +326,11 @@ RCT_ARRAY_CONVERTER(RCTFontVariantDescriptor)
|
|
|
326
326
|
isCondensed = isCondensedFont(font);
|
|
327
327
|
} else {
|
|
328
328
|
// Not a valid font or family
|
|
329
|
+
#if TARGET_OS_TV
|
|
330
|
+
RCTLogInfo(@"Unrecognized font family '%@'", familyName);
|
|
331
|
+
#else
|
|
329
332
|
RCTLogError(@"Unrecognized font family '%@'", familyName);
|
|
333
|
+
#endif
|
|
330
334
|
if ([UIFont respondsToSelector:@selector(systemFontOfSize:weight:)]) {
|
|
331
335
|
font = [UIFont systemFontOfSize:fontSize weight:fontWeight];
|
|
332
336
|
} else if (fontWeight > UIFontWeightRegular) {
|
|
@@ -49,7 +49,7 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : coder)
|
|
|
49
49
|
_menuButtonGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
|
|
50
50
|
action:@selector(menuButtonPressed:)];
|
|
51
51
|
_menuButtonGestureRecognizer.allowedPressTypes = @[ @(UIPressTypeMenu) ];
|
|
52
|
-
self.tvRemoteHandler = [RCTTVRemoteHandler
|
|
52
|
+
self.tvRemoteHandler = [[RCTTVRemoteHandler alloc] initWithView:self];
|
|
53
53
|
#endif
|
|
54
54
|
_isPresented = NO;
|
|
55
55
|
|
|
@@ -63,6 +63,11 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : coder)
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
#if TARGET_OS_TV
|
|
66
|
+
- (void)dealloc
|
|
67
|
+
{
|
|
68
|
+
self.tvRemoteHandler = nil;
|
|
69
|
+
}
|
|
70
|
+
|
|
66
71
|
- (void)menuButtonPressed:(__unused UIGestureRecognizer *)gestureRecognizer
|
|
67
72
|
{
|
|
68
73
|
if (_onRequestClose) {
|
|
@@ -119,11 +124,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : coder)
|
|
|
119
124
|
[super insertReactSubview:subview atIndex:atIndex];
|
|
120
125
|
[_touchHandler attachToView:subview];
|
|
121
126
|
#if TARGET_OS_TV
|
|
122
|
-
for (NSString *key in [self.tvRemoteHandler.tvRemoteGestureRecognizers allKeys]) {
|
|
123
|
-
if (![key isEqualToString:RCTTVRemoteEventMenu]) {
|
|
124
|
-
[subview addGestureRecognizer:self.tvRemoteHandler.tvRemoteGestureRecognizers[key]];
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
127
|
if (_onRequestClose) {
|
|
128
128
|
[subview addGestureRecognizer:_menuButtonGestureRecognizer];
|
|
129
129
|
}
|
|
@@ -143,9 +143,6 @@ RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : coder)
|
|
|
143
143
|
if (_menuButtonGestureRecognizer) {
|
|
144
144
|
[subview removeGestureRecognizer:_menuButtonGestureRecognizer];
|
|
145
145
|
}
|
|
146
|
-
for (UIGestureRecognizer *gr in self.tvRemoteHandler.tvRemoteGestureRecognizers) {
|
|
147
|
-
[subview removeGestureRecognizer:gr];
|
|
148
|
-
}
|
|
149
146
|
#endif
|
|
150
147
|
_reactSubview = nil;
|
|
151
148
|
}
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
- (void)addFocusGuide:(NSArray*)destinations {
|
|
45
45
|
|
|
46
46
|
UIView *origin = [self reactSuperview];
|
|
47
|
-
if (self.focusGuide == nil) {
|
|
47
|
+
if (self.focusGuide == nil && origin != nil) {
|
|
48
48
|
self.focusGuide = [UIFocusGuide new];
|
|
49
49
|
[self addLayoutGuide:self.focusGuide];
|
|
50
50
|
|
|
@@ -54733,17 +54733,19 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
|
|
|
54733
54733
|
|
|
54734
54734
|
var React = _$$_REQUIRE(_dependencyMap[5], "react");
|
|
54735
54735
|
|
|
54736
|
-
var
|
|
54736
|
+
var ReactNative = _$$_REQUIRE(_dependencyMap[6], "../../Renderer/shims/ReactNative");
|
|
54737
54737
|
|
|
54738
|
-
var
|
|
54738
|
+
var StyleSheet = _$$_REQUIRE(_dependencyMap[7], "../../StyleSheet/StyleSheet");
|
|
54739
54739
|
|
|
54740
|
-
var
|
|
54740
|
+
var TVEventHandler = _$$_REQUIRE(_dependencyMap[8], "../AppleTV/TVEventHandler");
|
|
54741
54741
|
|
|
54742
|
-
var
|
|
54742
|
+
var UIManager = _$$_REQUIRE(_dependencyMap[9], "../../ReactNative/UIManager");
|
|
54743
54743
|
|
|
54744
|
-
var
|
|
54744
|
+
var View = _$$_REQUIRE(_dependencyMap[10], "../View/View");
|
|
54745
54745
|
|
|
54746
|
-
var
|
|
54746
|
+
var SoundManager = _$$_REQUIRE(_dependencyMap[11], "../Sound/SoundManager");
|
|
54747
|
+
|
|
54748
|
+
var normalizeColor = _$$_REQUIRE(_dependencyMap[12], "../../StyleSheet/normalizeColor");
|
|
54747
54749
|
|
|
54748
54750
|
var extractSingleTouch = function extractSingleTouch(nativeEvent) {
|
|
54749
54751
|
var touches = nativeEvent.touches;
|
|
@@ -55227,7 +55229,7 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
|
|
|
55227
55229
|
__self: _this2,
|
|
55228
55230
|
__source: {
|
|
55229
55231
|
fileName: _jsxFileName,
|
|
55230
|
-
lineNumber:
|
|
55232
|
+
lineNumber: 957,
|
|
55231
55233
|
columnNumber: 7
|
|
55232
55234
|
}
|
|
55233
55235
|
});
|
|
@@ -55241,7 +55243,7 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
|
|
|
55241
55243
|
}
|
|
55242
55244
|
});
|
|
55243
55245
|
module.exports = Touchable;
|
|
55244
|
-
},266,[52,10,267,3,269,54,58,270,45,88,272,65],"Libraries/Components/Touchable/Touchable.js");
|
|
55246
|
+
},266,[52,10,267,3,269,54,91,58,270,45,88,272,65],"Libraries/Components/Touchable/Touchable.js");
|
|
55245
55247
|
__d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
|
|
55246
55248
|
'use strict';
|
|
55247
55249
|
|
|
@@ -68340,38 +68342,45 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
|
|
|
68340
68342
|
|
|
68341
68343
|
var TurboModuleRegistry = _interopRequireWildcard(_$$_REQUIRE(_dependencyMap[1], "../../TurboModule/TurboModuleRegistry"));
|
|
68342
68344
|
|
|
68343
|
-
var
|
|
68345
|
+
var Platform = _$$_REQUIRE(_dependencyMap[2], "../../Utilities/Platform");
|
|
68346
|
+
|
|
68347
|
+
var NativeModule = Platform.isTVOS ? null : TurboModuleRegistry.getEnforcing('StatusBarManager');
|
|
68344
68348
|
var constants = null;
|
|
68345
68349
|
var NativeStatusBarManager = {
|
|
68346
68350
|
getConstants: function getConstants() {
|
|
68347
68351
|
if (constants == null) {
|
|
68348
|
-
constants = NativeModule.getConstants()
|
|
68352
|
+
constants = NativeModule ? NativeModule.getConstants() : {
|
|
68353
|
+
HEIGHT: 0,
|
|
68354
|
+
DEFAULT_BACKGROUND_COLOR: 0
|
|
68355
|
+
};
|
|
68349
68356
|
}
|
|
68350
68357
|
|
|
68351
68358
|
return constants;
|
|
68352
68359
|
},
|
|
68353
68360
|
getHeight: function getHeight(callback) {
|
|
68354
|
-
NativeModule.getHeight(callback)
|
|
68361
|
+
NativeModule ? NativeModule.getHeight(callback) : callback({
|
|
68362
|
+
height: 0
|
|
68363
|
+
});
|
|
68355
68364
|
},
|
|
68356
68365
|
setNetworkActivityIndicatorVisible: function setNetworkActivityIndicatorVisible(visible) {
|
|
68357
|
-
NativeModule.setNetworkActivityIndicatorVisible(visible);
|
|
68366
|
+
NativeModule && NativeModule.setNetworkActivityIndicatorVisible(visible);
|
|
68358
68367
|
},
|
|
68359
68368
|
addListener: function addListener(eventType) {
|
|
68360
|
-
NativeModule.addListener(eventType);
|
|
68369
|
+
NativeModule && NativeModule.addListener(eventType);
|
|
68361
68370
|
},
|
|
68362
68371
|
removeListeners: function removeListeners(count) {
|
|
68363
|
-
NativeModule.removeListeners(count);
|
|
68372
|
+
NativeModule && NativeModule.removeListeners(count);
|
|
68364
68373
|
},
|
|
68365
68374
|
setStyle: function setStyle(statusBarStyle, animated) {
|
|
68366
|
-
NativeModule.setStyle(statusBarStyle, animated);
|
|
68375
|
+
NativeModule && NativeModule.setStyle(statusBarStyle, animated);
|
|
68367
68376
|
},
|
|
68368
68377
|
setHidden: function setHidden(hidden, withAnimation) {
|
|
68369
|
-
NativeModule.setHidden(hidden, withAnimation);
|
|
68378
|
+
NativeModule && NativeModule.setHidden(hidden, withAnimation);
|
|
68370
68379
|
}
|
|
68371
68380
|
};
|
|
68372
68381
|
var _default = NativeStatusBarManager;
|
|
68373
68382
|
exports.default = _default;
|
|
68374
|
-
},364,[5,7],"Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js");
|
|
68383
|
+
},364,[5,7,3],"Libraries/Components/StatusBar/NativeStatusBarManagerIOS.js");
|
|
68375
68384
|
__d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, exports, _dependencyMap) {
|
|
68376
68385
|
'use strict';
|
|
68377
68386
|
|
|
@@ -74134,6 +74143,7 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
|
|
|
74134
74143
|
var restPropsWithDefaults = (0, _extends2.default)({}, restProps, android_rippleConfig == null ? void 0 : android_rippleConfig.viewProps, {
|
|
74135
74144
|
accessible: accessible !== false,
|
|
74136
74145
|
focusable: focusable !== false,
|
|
74146
|
+
isTVSelectable: isTVSelectable !== false && accessible !== false,
|
|
74137
74147
|
hitSlop: hitSlop
|
|
74138
74148
|
});
|
|
74139
74149
|
var config = (0, React.useMemo)(function () {
|
|
@@ -74177,7 +74187,7 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
|
|
|
74177
74187
|
|
|
74178
74188
|
var pressableTVEventHandler = function pressableTVEventHandler(evt) {
|
|
74179
74189
|
if (props.isTVSelectable !== false || props.focusable !== false) {
|
|
74180
|
-
if (viewRef.current._nativeTag === evt.target) {
|
|
74190
|
+
if (viewRef.current && viewRef.current._nativeTag === evt.target) {
|
|
74181
74191
|
if ((evt == null ? void 0 : evt.eventType) === 'focus') {
|
|
74182
74192
|
setFocused(true);
|
|
74183
74193
|
onFocus && onFocus(evt);
|
|
@@ -74202,19 +74212,20 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
|
|
|
74202
74212
|
(0, _useTVEventHandler.default)(pressableTVEventHandler);
|
|
74203
74213
|
return React.createElement(_View.default, (0, _extends2.default)({}, restPropsWithDefaults, eventHandlers, {
|
|
74204
74214
|
ref: viewRef,
|
|
74205
|
-
isTVSelectable: isTVSelectable !== false && accessible !== false,
|
|
74206
74215
|
style: typeof style === 'function' ? style({
|
|
74207
|
-
pressed: pressed
|
|
74216
|
+
pressed: pressed,
|
|
74217
|
+
focused: focused
|
|
74208
74218
|
}) : style,
|
|
74209
74219
|
collapsable: false,
|
|
74210
74220
|
__self: this,
|
|
74211
74221
|
__source: {
|
|
74212
74222
|
fileName: _jsxFileName,
|
|
74213
|
-
lineNumber:
|
|
74223
|
+
lineNumber: 285,
|
|
74214
74224
|
columnNumber: 5
|
|
74215
74225
|
}
|
|
74216
74226
|
}), typeof children === 'function' ? children({
|
|
74217
|
-
pressed: pressed
|
|
74227
|
+
pressed: pressed,
|
|
74228
|
+
focused: focused
|
|
74218
74229
|
}) : children, __DEV__ ? React.createElement(_PressabilityDebug.PressabilityDebugView, {
|
|
74219
74230
|
color: "red",
|
|
74220
74231
|
hitSlop: hitSlop,
|
|
@@ -101565,7 +101576,7 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
|
|
|
101565
101576
|
columnNumber: 7
|
|
101566
101577
|
}
|
|
101567
101578
|
}, Platform.isTVOS ? React.createElement(RNFocusGuide, {
|
|
101568
|
-
style: this.props.style,
|
|
101579
|
+
style: [this.props.style, styles.focusGuideLayout],
|
|
101569
101580
|
ref: function ref(_ref) {
|
|
101570
101581
|
return _this._focusGuideRef = _ref;
|
|
101571
101582
|
},
|
|
@@ -101573,7 +101584,7 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
|
|
|
101573
101584
|
__self: this,
|
|
101574
101585
|
__source: {
|
|
101575
101586
|
fileName: _jsxFileName,
|
|
101576
|
-
lineNumber:
|
|
101587
|
+
lineNumber: 56,
|
|
101577
101588
|
columnNumber: 11
|
|
101578
101589
|
}
|
|
101579
101590
|
}, this.props.children) : this.props.children);
|
|
@@ -101583,6 +101594,18 @@ __d(function (global, _$$_REQUIRE, _$$_IMPORT_DEFAULT, _$$_IMPORT_ALL, module, e
|
|
|
101583
101594
|
return TVFocusGuideView;
|
|
101584
101595
|
}(React.Component);
|
|
101585
101596
|
|
|
101597
|
+
var styles = ReactNative.StyleSheet.create({
|
|
101598
|
+
focusGuideLayout: {
|
|
101599
|
+
left: 0,
|
|
101600
|
+
top: 0,
|
|
101601
|
+
right: 0,
|
|
101602
|
+
bottom: 0,
|
|
101603
|
+
marginLeft: 0,
|
|
101604
|
+
marginTop: 0,
|
|
101605
|
+
marginRight: 0,
|
|
101606
|
+
marginBottom: 0
|
|
101607
|
+
}
|
|
101608
|
+
});
|
|
101586
101609
|
var RNFocusGuide = requireNativeComponent('RCTTVFocusGuideView');
|
|
101587
101610
|
module.exports = TVFocusGuideView;
|
|
101588
101611
|
},487,[23,24,36,38,35,229,54,1,3],"Libraries/Components/AppleTV/TVFocusGuideView.js");
|
|
@@ -43,7 +43,6 @@ import com.facebook.react.bridge.WritableNativeMap;
|
|
|
43
43
|
import com.facebook.react.common.annotations.VisibleForTesting;
|
|
44
44
|
import com.facebook.react.config.ReactFeatureFlags;
|
|
45
45
|
import com.facebook.react.modules.appregistry.AppRegistry;
|
|
46
|
-
import com.facebook.react.modules.core.DeviceEventManagerModule;
|
|
47
46
|
import com.facebook.react.modules.deviceinfo.DeviceInfoModule;
|
|
48
47
|
import com.facebook.react.surface.ReactStage;
|
|
49
48
|
import com.facebook.react.uimanager.DisplayMetricsHolder;
|
|
@@ -56,6 +55,7 @@ import com.facebook.react.uimanager.UIManagerHelper;
|
|
|
56
55
|
import com.facebook.react.uimanager.UIManagerModule;
|
|
57
56
|
import com.facebook.react.uimanager.common.UIManagerType;
|
|
58
57
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
58
|
+
import com.facebook.react.modules.core.ReactAndroidHWInputDeviceHelper;
|
|
59
59
|
import com.facebook.systrace.Systrace;
|
|
60
60
|
|
|
61
61
|
/**
|
|
@@ -90,7 +90,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
|
|
90
90
|
private boolean mShouldLogContentAppeared;
|
|
91
91
|
private @Nullable JSTouchDispatcher mJSTouchDispatcher;
|
|
92
92
|
private final ReactAndroidHWInputDeviceHelper mAndroidHWInputDeviceHelper =
|
|
93
|
-
new ReactAndroidHWInputDeviceHelper(
|
|
93
|
+
new ReactAndroidHWInputDeviceHelper();
|
|
94
94
|
private boolean mWasMeasured = false;
|
|
95
95
|
private int mWidthMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
|
|
96
96
|
private int mHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED);
|
|
@@ -230,7 +230,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
|
|
230
230
|
FLog.w(TAG, "Unable to handle key event as the catalyst instance has not been attached");
|
|
231
231
|
return super.dispatchKeyEvent(ev);
|
|
232
232
|
}
|
|
233
|
-
mAndroidHWInputDeviceHelper.handleKeyEvent(ev);
|
|
233
|
+
mAndroidHWInputDeviceHelper.handleKeyEvent(ev, mReactInstanceManager.getCurrentReactContext());
|
|
234
234
|
return super.dispatchKeyEvent(ev);
|
|
235
235
|
}
|
|
236
236
|
|
|
@@ -245,7 +245,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
|
|
245
245
|
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
|
-
mAndroidHWInputDeviceHelper.clearFocus();
|
|
248
|
+
mAndroidHWInputDeviceHelper.clearFocus(mReactInstanceManager.getCurrentReactContext());
|
|
249
249
|
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
|
|
250
250
|
}
|
|
251
251
|
|
|
@@ -260,7 +260,7 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
|
|
260
260
|
super.requestChildFocus(child, focused);
|
|
261
261
|
return;
|
|
262
262
|
}
|
|
263
|
-
mAndroidHWInputDeviceHelper.onFocusChanged(focused);
|
|
263
|
+
mAndroidHWInputDeviceHelper.onFocusChanged(focused, mReactInstanceManager.getCurrentReactContext());
|
|
264
264
|
super.requestChildFocus(child, focused);
|
|
265
265
|
}
|
|
266
266
|
|
|
@@ -683,10 +683,11 @@ public class ReactRootView extends FrameLayout implements RootView, ReactRoot {
|
|
|
683
683
|
|
|
684
684
|
/* package */ void sendEvent(String eventName, @Nullable WritableMap params) {
|
|
685
685
|
if (mReactInstanceManager != null) {
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
686
|
+
mAndroidHWInputDeviceHelper.emitNamedEvent(
|
|
687
|
+
eventName,
|
|
688
|
+
params,
|
|
689
|
+
mReactInstanceManager.getCurrentReactContext()
|
|
690
|
+
);
|
|
690
691
|
}
|
|
691
692
|
}
|
|
692
693
|
|
|
@@ -5,13 +5,16 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
package com.facebook.react;
|
|
8
|
+
package com.facebook.react.modules.core;
|
|
9
9
|
|
|
10
10
|
import android.view.KeyEvent;
|
|
11
11
|
import android.view.View;
|
|
12
|
+
|
|
13
|
+
import com.facebook.react.bridge.ReactContext;
|
|
12
14
|
import com.facebook.react.bridge.WritableMap;
|
|
13
15
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
14
16
|
import com.facebook.react.common.MapBuilder;
|
|
17
|
+
|
|
15
18
|
import java.util.Map;
|
|
16
19
|
|
|
17
20
|
/** Responsible for dispatching events specific for hardware inputs. */
|
|
@@ -45,47 +48,43 @@ public class ReactAndroidHWInputDeviceHelper {
|
|
|
45
48
|
*/
|
|
46
49
|
private int mLastFocusedViewId = View.NO_ID;
|
|
47
50
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
ReactAndroidHWInputDeviceHelper(ReactRootView mReactRootView) {
|
|
51
|
-
this.mReactRootView = mReactRootView;
|
|
52
|
-
}
|
|
51
|
+
public ReactAndroidHWInputDeviceHelper() {}
|
|
53
52
|
|
|
54
|
-
/** Called from {@link ReactRootView}. This is the main place the key events are handled. */
|
|
55
|
-
public void handleKeyEvent(KeyEvent ev) {
|
|
53
|
+
/** Called from {@link com.facebook.react.ReactRootView}. This is the main place the key events are handled. */
|
|
54
|
+
public void handleKeyEvent(KeyEvent ev, ReactContext context) {
|
|
56
55
|
int eventKeyCode = ev.getKeyCode();
|
|
57
56
|
int eventKeyAction = ev.getAction();
|
|
58
57
|
if ((eventKeyAction == KeyEvent.ACTION_UP || eventKeyAction == KeyEvent.ACTION_DOWN)
|
|
59
58
|
&& KEY_EVENTS_ACTIONS.containsKey(eventKeyCode)) {
|
|
60
|
-
dispatchEvent(KEY_EVENTS_ACTIONS.get(eventKeyCode), mLastFocusedViewId, eventKeyAction);
|
|
59
|
+
dispatchEvent(KEY_EVENTS_ACTIONS.get(eventKeyCode), mLastFocusedViewId, eventKeyAction, context);
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
|
|
64
|
-
/** Called from {@link ReactRootView} when focused view changes. */
|
|
65
|
-
public void onFocusChanged(View newFocusedView) {
|
|
63
|
+
/** Called from {@link com.facebook.react.ReactRootView} when focused view changes. */
|
|
64
|
+
public void onFocusChanged(View newFocusedView, ReactContext context) {
|
|
66
65
|
if (mLastFocusedViewId == newFocusedView.getId()) {
|
|
67
66
|
return;
|
|
68
67
|
}
|
|
69
68
|
if (mLastFocusedViewId != View.NO_ID) {
|
|
70
|
-
dispatchEvent("blur", mLastFocusedViewId);
|
|
69
|
+
dispatchEvent("blur", mLastFocusedViewId, context);
|
|
71
70
|
}
|
|
72
71
|
mLastFocusedViewId = newFocusedView.getId();
|
|
73
|
-
dispatchEvent("focus", newFocusedView.getId());
|
|
72
|
+
dispatchEvent("focus", newFocusedView.getId(), context);
|
|
74
73
|
}
|
|
75
74
|
|
|
76
|
-
/** Called from {@link ReactRootView} when the whole view hierarchy looses focus. */
|
|
77
|
-
public void clearFocus() {
|
|
75
|
+
/** Called from {@link com.facebook.react.ReactRootView} when the whole view hierarchy looses focus. */
|
|
76
|
+
public void clearFocus(ReactContext context) {
|
|
78
77
|
if (mLastFocusedViewId != View.NO_ID) {
|
|
79
|
-
dispatchEvent("blur", mLastFocusedViewId);
|
|
78
|
+
dispatchEvent("blur", mLastFocusedViewId, context);
|
|
80
79
|
}
|
|
81
80
|
mLastFocusedViewId = View.NO_ID;
|
|
82
81
|
}
|
|
83
82
|
|
|
84
|
-
private void dispatchEvent(String eventType, int targetViewId) {
|
|
85
|
-
dispatchEvent(eventType, targetViewId, -1);
|
|
83
|
+
private void dispatchEvent(String eventType, int targetViewId, ReactContext context) {
|
|
84
|
+
dispatchEvent(eventType, targetViewId, -1, context);
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
private void dispatchEvent(String eventType, int targetViewId, int eventKeyAction) {
|
|
87
|
+
private void dispatchEvent(String eventType, int targetViewId, int eventKeyAction, ReactContext context) {
|
|
89
88
|
WritableMap event = new WritableNativeMap();
|
|
90
89
|
event.putString("eventType", eventType);
|
|
91
90
|
event.putInt("eventKeyAction", eventKeyAction);
|
|
@@ -93,6 +92,14 @@ public class ReactAndroidHWInputDeviceHelper {
|
|
|
93
92
|
event.putInt("tag", targetViewId);
|
|
94
93
|
event.putInt("target", targetViewId);
|
|
95
94
|
}
|
|
96
|
-
|
|
95
|
+
emitNamedEvent("onHWKeyEvent", event, context);
|
|
97
96
|
}
|
|
97
|
+
|
|
98
|
+
public void emitNamedEvent(String eventName, WritableMap event, ReactContext context) {
|
|
99
|
+
if (context != null) {
|
|
100
|
+
context.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
|
|
101
|
+
.emit(eventName, event);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
98
105
|
}
|
|
@@ -19,6 +19,7 @@ rn_android_library(
|
|
|
19
19
|
react_native_target("java/com/facebook/react/bridge:bridge"),
|
|
20
20
|
react_native_target("java/com/facebook/react/common:common"),
|
|
21
21
|
react_native_target("java/com/facebook/react/module/annotations:annotations"),
|
|
22
|
+
react_native_target("java/com/facebook/react/modules/core:core"),
|
|
22
23
|
react_native_target("java/com/facebook/react/touch:touch"),
|
|
23
24
|
react_native_target("java/com/facebook/react/uimanager:uimanager"),
|
|
24
25
|
react_native_target("java/com/facebook/react/uimanager/annotations:annotations"),
|
|
@@ -12,6 +12,7 @@ import android.app.Activity;
|
|
|
12
12
|
import android.app.Dialog;
|
|
13
13
|
import android.content.Context;
|
|
14
14
|
import android.content.DialogInterface;
|
|
15
|
+
import android.graphics.Rect;
|
|
15
16
|
import android.view.KeyEvent;
|
|
16
17
|
import android.view.MotionEvent;
|
|
17
18
|
import android.view.View;
|
|
@@ -23,8 +24,10 @@ import android.view.accessibility.AccessibilityEvent;
|
|
|
23
24
|
import android.widget.FrameLayout;
|
|
24
25
|
import androidx.annotation.Nullable;
|
|
25
26
|
import androidx.annotation.UiThread;
|
|
27
|
+
|
|
26
28
|
import com.facebook.infer.annotation.Assertions;
|
|
27
29
|
import com.facebook.react.R;
|
|
30
|
+
import com.facebook.react.modules.core.ReactAndroidHWInputDeviceHelper;
|
|
28
31
|
import com.facebook.react.bridge.GuardedRunnable;
|
|
29
32
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
30
33
|
import com.facebook.react.bridge.ReactContext;
|
|
@@ -398,8 +401,14 @@ public class ReactModalHostView extends ViewGroup
|
|
|
398
401
|
|
|
399
402
|
private final JSTouchDispatcher mJSTouchDispatcher = new JSTouchDispatcher(this);
|
|
400
403
|
|
|
404
|
+
private final ReactAndroidHWInputDeviceHelper mAndroidHWInputDeviceHelper;
|
|
405
|
+
|
|
406
|
+
private final ReactContext mReactContext;
|
|
407
|
+
|
|
401
408
|
public DialogRootViewGroup(Context context) {
|
|
402
409
|
super(context);
|
|
410
|
+
mReactContext = (ReactContext)context;
|
|
411
|
+
mAndroidHWInputDeviceHelper = new ReactAndroidHWInputDeviceHelper();
|
|
403
412
|
}
|
|
404
413
|
|
|
405
414
|
@Override
|
|
@@ -410,6 +419,18 @@ public class ReactModalHostView extends ViewGroup
|
|
|
410
419
|
updateFirstChildView();
|
|
411
420
|
}
|
|
412
421
|
|
|
422
|
+
@Override
|
|
423
|
+
protected void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect) {
|
|
424
|
+
mAndroidHWInputDeviceHelper.clearFocus(mReactContext);
|
|
425
|
+
super.onFocusChanged(gainFocus, direction, previouslyFocusedRect);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
@Override
|
|
429
|
+
public void requestChildFocus(View child, View focused) {
|
|
430
|
+
mAndroidHWInputDeviceHelper.onFocusChanged(focused, mReactContext);
|
|
431
|
+
super.requestChildFocus(child, focused);
|
|
432
|
+
}
|
|
433
|
+
|
|
413
434
|
private void updateFirstChildView() {
|
|
414
435
|
if (getChildCount() > 0) {
|
|
415
436
|
hasAdjustedSize = false;
|