From feda8ce2ee768b0a85daa558ebbea0f5733e8836 Mon Sep 17 00:00:00 2001 From: Pieter De Baets Date: Thu, 28 Apr 2016 05:47:29 -0700 Subject: [PATCH] Clean up RCTEventDispatcher code Reviewed By: majak Differential Revision: D3175583 fb-gh-sync-id: c751c9dc79edfd9cb6073a2ff5dd743a03334bc4 fbshipit-source-id: c751c9dc79edfd9cb6073a2ff5dd743a03334bc4 --- React/Base/RCTBridge.h | 11 ----------- React/Base/RCTBridge.m | 5 ----- React/Base/RCTEventDispatcher.h | 6 ++++++ React/Base/RCTEventDispatcher.m | 9 +++++++++ 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/React/Base/RCTBridge.h b/React/Base/RCTBridge.h index 925a432bd..18cf73876 100644 --- a/React/Base/RCTBridge.h +++ b/React/Base/RCTBridge.h @@ -145,17 +145,6 @@ RCT_EXTERN NSString *RCTBridgeModuleNameForClass(Class bridgeModuleClass); */ @property (nonatomic, weak, readonly) id delegate; -/** - * The event dispatcher is a wrapper around -enqueueJSCall:args: that provides a - * higher-level interface for sending UI events such as touches and text input. - * - * NOTE: RCTEventDispatcher is now a bridge module, this is implemented as a - * category but remains declared in the bridge to avoid breaking changes - * - * To be moved. - */ -@property (nonatomic, readonly) RCTEventDispatcher *eventDispatcher; - /** * The launch options that were used to initialize the bridge. */ diff --git a/React/Base/RCTBridge.m b/React/Base/RCTBridge.m index baf28d65f..dceaf4409 100644 --- a/React/Base/RCTBridge.m +++ b/React/Base/RCTBridge.m @@ -209,11 +209,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)init) return [self.batchedBridge moduleIsInitialized:moduleClass]; } -- (RCTEventDispatcher *)eventDispatcher -{ - return [self moduleForClass:[RCTEventDispatcher class]]; -} - - (void)reload { /** diff --git a/React/Base/RCTEventDispatcher.h b/React/Base/RCTEventDispatcher.h index 02fd28356..105bb2def 100644 --- a/React/Base/RCTEventDispatcher.h +++ b/React/Base/RCTEventDispatcher.h @@ -103,3 +103,9 @@ RCT_EXTERN NSString *RCTNormalizeInputEventName(NSString *eventName); - (void)sendEvent:(id)event; @end + +@interface RCTBridge (RCTEventDispatcher) + +- (RCTEventDispatcher *)eventDispatcher; + +@end diff --git a/React/Base/RCTEventDispatcher.m b/React/Base/RCTEventDispatcher.m index fd3997c8d..18a6c9f44 100644 --- a/React/Base/RCTEventDispatcher.m +++ b/React/Base/RCTEventDispatcher.m @@ -189,3 +189,12 @@ RCT_EXPORT_MODULE() } @end + +@implementation RCTBridge (RCTEventDispatcher) + +- (RCTEventDispatcher *)eventDispatcher +{ + return [self moduleForClass:[RCTEventDispatcher class]]; +} + +@end