react-native-tvos 0.74.0-0rc3 → 0.74.2-0
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+Protected.h +16 -0
- package/Libraries/AppDelegate/RCTAppDelegate.mm +32 -1
- package/Libraries/AppDelegate/React-RCTAppDelegate.podspec +1 -0
- package/Libraries/Components/Pressable/Pressable.js +9 -5
- package/Libraries/Components/TextInput/TextInput.js +6 -3
- package/Libraries/Components/Touchable/TouchableBounce.js +1 -0
- package/Libraries/Components/Touchable/TouchableOpacity.js +1 -0
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/ReactNative/RendererImplementation.js +2 -0
- package/README.md +29 -9
- package/React/Base/RCTUtils.m +28 -8
- package/React/Base/RCTVersion.m +2 -2
- package/React/Base/Surface/SurfaceHostingView/RCTSurfaceHostingProxyRootView.mm +2 -4
- package/React/Fabric/Mounting/ComponentViews/Root/RCTRootComponentView.mm +22 -2
- package/React/Fabric/Mounting/ComponentViews/ScrollView/RCTScrollViewComponentView.mm +5 -1
- package/React/Fabric/RCTScheduler.h +2 -0
- package/React/Fabric/RCTScheduler.mm +6 -0
- package/React/Fabric/RCTSurfacePresenter.mm +5 -0
- package/React/Modules/RCTUIManager.m +8 -9
- package/React/Views/RCTComponentData.m +14 -1
- package/React/Views/ScrollView/RCTScrollView.m +30 -14
- package/ReactAndroid/api/ReactAndroid.api +1 -2
- package/ReactAndroid/gradle.properties +1 -1
- package/ReactAndroid/src/main/java/com/facebook/react/ReactActivity.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +24 -9
- package/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +15 -0
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +19 -7
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +31 -11
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +7 -3
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +7 -3
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +34 -12
- package/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +7 -3
- package/ReactAndroid/src/main/java/com/facebook/react/modules/systeminfo/ReactNativeVersion.java +2 -2
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/BridgelessCatalystInstance.kt +11 -18
- package/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +27 -14
- package/ReactAndroid/src/main/java/com/facebook/react/views/modal/ReactModalHostView.java +1 -3
- package/ReactAndroid/src/main/jni/react/fabric/Binding.cpp +38 -3
- package/ReactAndroid/src/main/jni/react/fabric/Binding.h +8 -0
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +43 -15
- package/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +10 -4
- package/ReactCommon/ReactCommon.podspec +1 -0
- package/ReactCommon/cxxreact/ReactNativeVersion.h +2 -2
- package/ReactCommon/jsc/JSCRuntime.cpp +2 -0
- package/ReactCommon/jsinspector-modern/React-jsinspector.podspec +2 -1
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +13 -5
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +16 -6
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +62 -26
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +8 -4
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +13 -5
- package/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +4 -2
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +16 -6
- package/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +7 -3
- package/ReactCommon/react/renderer/components/textinput/platform/ios/react/renderer/components/iostextinput/TextInputEventEmitter.cpp +53 -1
- package/ReactCommon/react/renderer/mounting/MountingTransaction.cpp +13 -0
- package/ReactCommon/react/renderer/mounting/MountingTransaction.h +9 -0
- package/ReactCommon/react/renderer/scheduler/Scheduler.cpp +7 -2
- package/ReactCommon/react/renderer/scheduler/SchedulerDelegate.h +11 -0
- package/cli.js +11 -3
- package/package.json +12 -12
- package/scripts/cocoapods/privacy_manifest_utils.rb +173 -0
- package/scripts/cocoapods/utils.rb +1 -38
- package/scripts/ios-configure-glog.sh +9 -2
- package/scripts/react_native_pods.rb +14 -3
- package/sdks/.hermesversion +1 -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/src/private/featureflags/NativeReactNativeFeatureFlags.js +4 -2
- package/src/private/featureflags/ReactNativeFeatureFlags.js +16 -6
- package/template/package.json +5 -5
- package/third-party-podspecs/RCT-Folly.podspec +1 -0
- package/types/public/ReactNativeTVTypes.d.ts +6 -10
- package/Libraries/React-Native +0 -214
- package/ReactAndroid/src/main/java/com/facebook/react/ReactAndroidHWInputDeviceHelper.java +0 -98
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type { View, ScrollViewProps, HostComponent, TVParallaxProperties } from 'react-native';
|
|
2
|
+
import type { View, ScrollViewProps, HostComponent, TVParallaxProperties, EventSubscription } from 'react-native';
|
|
3
3
|
|
|
4
4
|
declare module 'react-native' {
|
|
5
5
|
interface ViewProps {
|
|
@@ -54,18 +54,14 @@ declare module 'react-native' {
|
|
|
54
54
|
state: 'Began' | 'Changed' | 'Ended',
|
|
55
55
|
x: number,
|
|
56
56
|
y: number,
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
velocityX: number,
|
|
58
|
+
velocityY: number
|
|
59
59
|
} | undefined
|
|
60
60
|
};
|
|
61
61
|
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
callback?: (component: T, data: HWEvent) => void
|
|
66
|
-
): void;
|
|
67
|
-
disable(): void;
|
|
68
|
-
}
|
|
62
|
+
export const TVEventHandler: {
|
|
63
|
+
addListener: (listener: (event: HWEvent) => void) => EventSubscription | undefined
|
|
64
|
+
};
|
|
69
65
|
|
|
70
66
|
export interface FocusGuideProps extends ViewProps {
|
|
71
67
|
/**
|
package/Libraries/React-Native
DELETED
|
@@ -1,214 +0,0 @@
|
|
|
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;
|
|
@@ -1,98 +0,0 @@
|
|
|
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
|
-
package com.facebook.react;
|
|
9
|
-
|
|
10
|
-
import android.view.KeyEvent;
|
|
11
|
-
import android.view.View;
|
|
12
|
-
import com.facebook.react.bridge.WritableMap;
|
|
13
|
-
import com.facebook.react.bridge.WritableNativeMap;
|
|
14
|
-
import com.facebook.react.common.MapBuilder;
|
|
15
|
-
import java.util.Map;
|
|
16
|
-
|
|
17
|
-
/** Responsible for dispatching events specific for hardware inputs. */
|
|
18
|
-
class ReactAndroidHWInputDeviceHelper {
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Contains a mapping between handled KeyEvents and the corresponding navigation event that should
|
|
22
|
-
* be fired when the KeyEvent is received.
|
|
23
|
-
*/
|
|
24
|
-
private static final Map<Integer, String> KEY_EVENTS_ACTIONS =
|
|
25
|
-
MapBuilder.<Integer, String>builder()
|
|
26
|
-
.put(KeyEvent.KEYCODE_DPAD_CENTER, "select")
|
|
27
|
-
.put(KeyEvent.KEYCODE_ENTER, "select")
|
|
28
|
-
.put(KeyEvent.KEYCODE_SPACE, "select")
|
|
29
|
-
.put(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, "playPause")
|
|
30
|
-
.put(KeyEvent.KEYCODE_MEDIA_REWIND, "rewind")
|
|
31
|
-
.put(KeyEvent.KEYCODE_MEDIA_FAST_FORWARD, "fastForward")
|
|
32
|
-
.put(KeyEvent.KEYCODE_MEDIA_STOP, "stop")
|
|
33
|
-
.put(KeyEvent.KEYCODE_MEDIA_NEXT, "next")
|
|
34
|
-
.put(KeyEvent.KEYCODE_MEDIA_PREVIOUS, "previous")
|
|
35
|
-
.put(KeyEvent.KEYCODE_DPAD_UP, "up")
|
|
36
|
-
.put(KeyEvent.KEYCODE_DPAD_RIGHT, "right")
|
|
37
|
-
.put(KeyEvent.KEYCODE_DPAD_DOWN, "down")
|
|
38
|
-
.put(KeyEvent.KEYCODE_DPAD_LEFT, "left")
|
|
39
|
-
.put(KeyEvent.KEYCODE_INFO, "info")
|
|
40
|
-
.put(KeyEvent.KEYCODE_MENU, "menu")
|
|
41
|
-
.build();
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* We keep a reference to the last focused view id so that we can send it as a target for key
|
|
45
|
-
* events and be able to send a blur event when focus changes.
|
|
46
|
-
*/
|
|
47
|
-
private int mLastFocusedViewId = View.NO_ID;
|
|
48
|
-
|
|
49
|
-
private final ReactRootView mReactRootView;
|
|
50
|
-
|
|
51
|
-
ReactAndroidHWInputDeviceHelper(ReactRootView mReactRootView) {
|
|
52
|
-
this.mReactRootView = mReactRootView;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** Called from {@link ReactRootView}. This is the main place the key events are handled. */
|
|
56
|
-
public void handleKeyEvent(KeyEvent ev) {
|
|
57
|
-
int eventKeyCode = ev.getKeyCode();
|
|
58
|
-
int eventKeyAction = ev.getAction();
|
|
59
|
-
if ((eventKeyAction == KeyEvent.ACTION_UP || eventKeyAction == KeyEvent.ACTION_DOWN)
|
|
60
|
-
&& KEY_EVENTS_ACTIONS.containsKey(eventKeyCode)) {
|
|
61
|
-
dispatchEvent(KEY_EVENTS_ACTIONS.get(eventKeyCode), mLastFocusedViewId, eventKeyAction);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
/** Called from {@link ReactRootView} when focused view changes. */
|
|
66
|
-
public void onFocusChanged(View newFocusedView) {
|
|
67
|
-
if (mLastFocusedViewId == newFocusedView.getId()) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
if (mLastFocusedViewId != View.NO_ID) {
|
|
71
|
-
dispatchEvent("blur", mLastFocusedViewId);
|
|
72
|
-
}
|
|
73
|
-
mLastFocusedViewId = newFocusedView.getId();
|
|
74
|
-
dispatchEvent("focus", newFocusedView.getId());
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/** Called from {@link ReactRootView} when the whole view hierarchy looses focus. */
|
|
78
|
-
public void clearFocus() {
|
|
79
|
-
if (mLastFocusedViewId != View.NO_ID) {
|
|
80
|
-
dispatchEvent("blur", mLastFocusedViewId);
|
|
81
|
-
}
|
|
82
|
-
mLastFocusedViewId = View.NO_ID;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
private void dispatchEvent(String eventType, int targetViewId) {
|
|
86
|
-
dispatchEvent(eventType, targetViewId, -1);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
private void dispatchEvent(String eventType, int targetViewId, int eventKeyAction) {
|
|
90
|
-
WritableMap event = new WritableNativeMap();
|
|
91
|
-
event.putString("eventType", eventType);
|
|
92
|
-
event.putInt("eventKeyAction", eventKeyAction);
|
|
93
|
-
if (targetViewId != View.NO_ID) {
|
|
94
|
-
event.putInt("tag", targetViewId);
|
|
95
|
-
}
|
|
96
|
-
mReactRootView.sendEvent("onHWKeyEvent", event);
|
|
97
|
-
}
|
|
98
|
-
}
|