Updated AppState module to use new emitter system

Summary: AppState now subclasses NativeEventEmitter instead of using global RCTDeviceEventEmitter.

Reviewed By: javache

Differential Revision: D3310488

fbshipit-source-id: f0116599223f4411307385c0dab683659d8d63b6
This commit is contained in:
Nick Lockwood
2016-05-23 09:08:51 -07:00
committed by Facebook Github Bot 3
parent c87b737ca1
commit d9737571c4
20 changed files with 187 additions and 264 deletions

View File

@@ -35,7 +35,6 @@ RCT_EXTERN const NSInteger RCTTextUpdateLagWarningThreshold;
RCT_EXTERN NSString *RCTNormalizeInputEventName(NSString *eventName);
@protocol RCTEvent <NSObject>
@required
@property (nonatomic, strong, readonly) NSNumber *viewTag;
@@ -60,25 +59,25 @@ RCT_EXTERN NSString *RCTNormalizeInputEventName(NSString *eventName);
@interface RCTEventDispatcher : NSObject <RCTBridgeModule>
/**
* Send an application-specific event that does not relate to a specific
* view, e.g. a navigation or data update notification.
* Deprecated, do not use.
*/
- (void)sendAppEventWithName:(NSString *)name body:(id)body;
- (void)sendAppEventWithName:(NSString *)name body:(id)body
__deprecated_msg("Subclass RCTEventEmitter instead");
/**
* Send a device or iOS event that does not relate to a specific view,
* e.g.rotation, location, keyboard show/hide, background/awake, etc.
* Deprecated, do not use.
*/
- (void)sendDeviceEventWithName:(NSString *)name body:(id)body;
- (void)sendDeviceEventWithName:(NSString *)name body:(id)body
__deprecated_msg("Subclass RCTEventEmitter instead");
/**
* Send a user input event. The body dictionary must contain a "target"
* parameter, representing the React tag of the view sending the event
* Deprecated, do not use.
*/
- (void)sendInputEventWithName:(NSString *)name body:(NSDictionary *)body;
- (void)sendInputEventWithName:(NSString *)name body:(NSDictionary *)body
__deprecated_msg("Use RCTDirectEventBlock or RCTBubblingEventBlock instead");
/**
* Send a text input/focus event.
* Send a text input/focus event. For internal use only.
*/
- (void)sendTextEventWithType:(RCTTextEventType)type
reactTag:(NSNumber *)reactTag

View File

@@ -126,7 +126,10 @@ RCT_EXPORT_MODULE()
body[@"key"] = key;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self sendInputEventWithName:events[type] body:body];
#pragma clang diagnostic pop
}
- (void)sendEvent:(id<RCTEvent>)event