Make RCTTVNavigationEventEmitter TurboModule-compatible

Summary:
See title.

Changelog:
[iOS][Added] - Make RCTTVNavigationEventEmitter TurboModule-compatible

Reviewed By: shergin

Differential Revision: D18142252

fbshipit-source-id: c633a5a0abd9e980346379921b34219228153348
This commit is contained in:
Ramanpreet Nara 2019-11-04 15:58:49 -08:00 коммит произвёл Facebook Github Bot
Родитель 7e5de4e241
Коммит 3beb8341fd
5 изменённых файлов: 21 добавлений и 1 удалений

Просмотреть файл

@ -96,6 +96,9 @@ rn_apple_library(
) + react_module_plugin_providers(
name = "RedBox",
native_class_func = "RCTRedBoxCls",
) + react_module_plugin_providers(
name = "TVNavigationEventEmitter",
native_class_func = "RCTTVNavigationEventEmitterCls",
),
plugins_header = "FBCoreModulesPlugins.h",
preprocessor_flags = OBJC_ARC_PREPROCESSOR_FLAGS + get_debug_preprocessor_flags() + rn_extra_build_flags() + [

Просмотреть файл

@ -48,6 +48,7 @@ Class RCTPerfMonitorCls(void) __attribute__((used));
Class RCTDevMenuCls(void) __attribute__((used));
Class RCTDevSettingsCls(void) __attribute__((used));
Class RCTRedBoxCls(void) __attribute__((used));
Class RCTTVNavigationEventEmitterCls(void) __attribute__((used));
#ifdef __cplusplus
}

Просмотреть файл

@ -37,6 +37,7 @@ Class RCTCoreModulesClassProvider(const char *name) {
{"DevMenu", RCTDevMenuCls},
{"DevSettings", RCTDevSettingsCls},
{"RedBox", RCTRedBoxCls},
{"TVNavigationEventEmitter", RCTTVNavigationEventEmitterCls},
};
auto p = sCoreModuleClassMap.find(name);

Просмотреть файл

@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/
#import "RCTEventEmitter.h"
#import <React/RCTEventEmitter.h>
RCT_EXTERN NSString *const RCTTVNavigationEventNotification;

Просмотреть файл

@ -7,10 +7,16 @@
#import "RCTTVNavigationEventEmitter.h"
#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import "CoreModulesPlugins.h"
NSString *const RCTTVNavigationEventNotification = @"RCTTVNavigationEventNotification";
static NSString *const TVNavigationEventName = @"onHWKeyEvent";
@interface RCTTVNavigationEventEmitter() <NativeTVNavigationEventEmitterSpec>
@end
@implementation RCTTVNavigationEventEmitter
RCT_EXPORT_MODULE()
@ -44,4 +50,13 @@ RCT_EXPORT_MODULE()
}
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModuleWithJsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
{
return std::make_shared<facebook::react::NativeTVNavigationEventEmitterSpecJSI>(self, jsInvoker);
}
@end
Class RCTTVNavigationEventEmitterCls(void) {
return RCTTVNavigationEventEmitter.class;
}