mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-28 20:25:33 +08:00
Prettier React Native Libraries
Reviewed By: sahrens Differential Revision: D7961488 fbshipit-source-id: 05f9b8b0b91ae77f9040a5321ccc18f7c3c1ce9a
This commit is contained in:
committed by
Facebook Github Bot
parent
1e2de71290
commit
d01ab66b47
@@ -4,12 +4,15 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @flow
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const Platform = require('Platform');
|
||||
const TVNavigationEventEmitter = require('NativeModules').TVNavigationEventEmitter;
|
||||
const TVNavigationEventEmitter = require('NativeModules')
|
||||
.TVNavigationEventEmitter;
|
||||
const NativeEventEmitter = require('NativeEventEmitter');
|
||||
|
||||
function TVEventHandler() {
|
||||
@@ -17,19 +20,24 @@ function TVEventHandler() {
|
||||
this.__nativeTVNavigationEventEmitter = null;
|
||||
}
|
||||
|
||||
TVEventHandler.prototype.enable = function(component: ?any, callback: Function) {
|
||||
TVEventHandler.prototype.enable = function(
|
||||
component: ?any,
|
||||
callback: Function,
|
||||
) {
|
||||
if (Platform.OS === 'ios' && !TVNavigationEventEmitter) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.__nativeTVNavigationEventEmitter = new NativeEventEmitter(TVNavigationEventEmitter);
|
||||
this.__nativeTVNavigationEventEmitter = new NativeEventEmitter(
|
||||
TVNavigationEventEmitter,
|
||||
);
|
||||
this.__nativeTVNavigationEventListener = this.__nativeTVNavigationEventEmitter.addListener(
|
||||
'onHWKeyEvent',
|
||||
(data) => {
|
||||
data => {
|
||||
if (callback) {
|
||||
callback(component, data);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user