Set viewTag for RCTTouchEvent to avoid EventID conflict

Summary:
Using target view's reactTag as viewTag for RCTTouchEvent.

Fix issue https://github.com/facebook/react-native/issues/9503
Closes https://github.com/facebook/react-native/pull/9952

Differential Revision: D3880152

Pulled By: majak

fbshipit-source-id: 1025aae6a6a1d5074496a9e4a6cf7dfebc713dc7
This commit is contained in:
littlesome 2016-09-16 16:12:17 -07:00 committed by Facebook Github Bot 3
parent b62ed2f291
commit 610c4826a5
3 changed files with 4 additions and 0 deletions

View File

@ -18,6 +18,7 @@
@interface RCTTouchEvent : NSObject <RCTEvent>
- (instancetype)initWithEventName:(NSString *)eventName
reactTag:(NSNumber *)reactTag
reactTouches:(NSArray<NSDictionary *> *)reactTouches
changedIndexes:(NSArray<NSNumber *> *)changedIndexes
coalescingKey:(uint16_t)coalescingKey NS_DESIGNATED_INITIALIZER;

View File

@ -21,11 +21,13 @@
@synthesize viewTag = _viewTag;
- (instancetype)initWithEventName:(NSString *)eventName
reactTag:(NSNumber *)reactTag
reactTouches:(NSArray<NSDictionary *> *)reactTouches
changedIndexes:(NSArray<NSNumber *> *)changedIndexes
coalescingKey:(uint16_t)coalescingKey
{
if (self = [super init]) {
_viewTag = reactTag;
_eventName = eventName;
_reactTouches = reactTouches;
_changedIndexes = changedIndexes;

View File

@ -199,6 +199,7 @@ typedef NS_ENUM(NSInteger, RCTTouchEventType) {
}
RCTTouchEvent *event = [[RCTTouchEvent alloc] initWithEventName:eventName
reactTag:self.view.reactTag
reactTouches:reactTouches
changedIndexes:changedIndexes
coalescingKey:_coalescingKey];