Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Libraries/Components/AppleTV/NativeTVNavigationEventEmitter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
* @format
*/

'use strict';

import type {TurboModule} from 'RCTExport';
import * as TurboModuleRegistry from 'TurboModuleRegistry';

export interface Spec extends TurboModule {
+addListener: (eventName: string) => void;
+removeListeners: (count: number) => void;
}

export default TurboModuleRegistry.getEnforcing<Spec>(
'TVNavigationEventEmitter',
);
8 changes: 4 additions & 4 deletions Libraries/Components/AppleTV/TVEventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
'use strict';

const Platform = require('../../Utilities/Platform');
const TVNavigationEventEmitter = require('../../BatchedBridge/NativeModules')
.TVNavigationEventEmitter;
const NativeEventEmitter = require('../../EventEmitter/NativeEventEmitter');

import NativeTVNavigationEventEmitter from './NativeTVNavigationEventEmitter';

function TVEventHandler() {
this.__nativeTVNavigationEventListener = null;
this.__nativeTVNavigationEventEmitter = null;
Expand All @@ -24,12 +24,12 @@ TVEventHandler.prototype.enable = function(
component: ?any,
callback: Function,
) {
if (Platform.OS === 'ios' && !TVNavigationEventEmitter) {
if (Platform.OS === 'ios' && !NativeTVNavigationEventEmitter) {
return;
}

this.__nativeTVNavigationEventEmitter = new NativeEventEmitter(
TVNavigationEventEmitter,
NativeTVNavigationEventEmitter,
);
this.__nativeTVNavigationEventListener = this.__nativeTVNavigationEventEmitter.addListener(
'onHWKeyEvent',
Expand Down