2015-03-23 20:28:42 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
2015-05-28 03:15:33 +00:00
|
|
|
#import "RCTBridge.h"
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, RCTTextEventType) {
|
|
|
|
RCTTextEventTypeFocus,
|
|
|
|
RCTTextEventTypeBlur,
|
|
|
|
RCTTextEventTypeChange,
|
|
|
|
RCTTextEventTypeSubmit,
|
|
|
|
RCTTextEventTypeEnd
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef NS_ENUM(NSInteger, RCTScrollEventType) {
|
|
|
|
RCTScrollEventTypeStart,
|
|
|
|
RCTScrollEventTypeMove,
|
|
|
|
RCTScrollEventTypeEnd,
|
|
|
|
RCTScrollEventTypeStartDeceleration,
|
|
|
|
RCTScrollEventTypeEndDeceleration,
|
|
|
|
RCTScrollEventTypeEndAnimation,
|
|
|
|
};
|
|
|
|
|
2015-05-28 03:15:33 +00:00
|
|
|
@protocol RCTEvent <NSObject>
|
|
|
|
|
|
|
|
@required
|
|
|
|
|
|
|
|
@property (nonatomic, strong, readonly) NSNumber *viewTag;
|
|
|
|
@property (nonatomic, copy, readonly) NSString *eventName;
|
|
|
|
@property (nonatomic, copy, readonly) NSDictionary *body;
|
|
|
|
@property (nonatomic, assign, readonly) uint16_t coalescingKey;
|
|
|
|
|
|
|
|
- (BOOL)canCoalesce;
|
|
|
|
- (id<RCTEvent>)coalesceWithEvent:(id<RCTEvent>)newEvent;
|
|
|
|
|
|
|
|
+ (NSString *)moduleDotMethod;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface RCTBaseEvent : NSObject <RCTEvent>
|
|
|
|
|
|
|
|
- (instancetype)initWithViewTag:(NSNumber *)viewTag
|
|
|
|
eventName:(NSString *)eventName
|
|
|
|
body:(NSDictionary *)body NS_DESIGNATED_INITIALIZER;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2015-02-20 04:10:52 +00:00
|
|
|
/**
|
|
|
|
* This class wraps the -[RCTBridge enqueueJSCall:args:] method, and
|
|
|
|
* provides some convenience methods for generating event calls.
|
|
|
|
*/
|
|
|
|
@interface RCTEventDispatcher : NSObject
|
|
|
|
|
|
|
|
/**
|
2015-02-24 17:06:57 +00:00
|
|
|
* Send an application-specific event that does not relate to a specific
|
|
|
|
* view, e.g. a navigation or data update notification.
|
2015-02-20 04:10:52 +00:00
|
|
|
*/
|
2015-02-24 17:06:57 +00:00
|
|
|
- (void)sendAppEventWithName:(NSString *)name body:(id)body;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send a device or iOS event that does not relate to a specific view,
|
|
|
|
* e.g.rotation, location, keyboard show/hide, background/awake, etc.
|
|
|
|
*/
|
|
|
|
- (void)sendDeviceEventWithName:(NSString *)name body:(id)body;
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send a user input event. The body dictionary must contain a "target"
|
2015-04-27 20:55:01 +00:00
|
|
|
* parameter, representing the React tag of the view sending the event
|
2015-02-20 04:10:52 +00:00
|
|
|
*/
|
|
|
|
- (void)sendInputEventWithName:(NSString *)name body:(NSDictionary *)body;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Send a text input/focus event.
|
|
|
|
*/
|
|
|
|
- (void)sendTextEventWithType:(RCTTextEventType)type
|
|
|
|
reactTag:(NSNumber *)reactTag
|
|
|
|
text:(NSString *)text;
|
|
|
|
|
2015-05-28 03:15:33 +00:00
|
|
|
- (void)sendEvent:(id<RCTEvent>)event;
|
2015-02-20 04:10:52 +00:00
|
|
|
|
|
|
|
@end
|