Skip to content

Commit 610c482

Browse files
littlesomeFacebook Github Bot 3
authored andcommitted
Set viewTag for RCTTouchEvent to avoid EventID conflict
Summary: Using target view's reactTag as viewTag for RCTTouchEvent. Fix issue facebook#9503 Closes facebook#9952 Differential Revision: D3880152 Pulled By: majak fbshipit-source-id: 1025aae6a6a1d5074496a9e4a6cf7dfebc713dc7
1 parent b62ed2f commit 610c482

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

React/Base/RCTTouchEvent.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
@interface RCTTouchEvent : NSObject <RCTEvent>
1919

2020
- (instancetype)initWithEventName:(NSString *)eventName
21+
reactTag:(NSNumber *)reactTag
2122
reactTouches:(NSArray<NSDictionary *> *)reactTouches
2223
changedIndexes:(NSArray<NSNumber *> *)changedIndexes
2324
coalescingKey:(uint16_t)coalescingKey NS_DESIGNATED_INITIALIZER;

React/Base/RCTTouchEvent.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ @implementation RCTTouchEvent
2121
@synthesize viewTag = _viewTag;
2222

2323
- (instancetype)initWithEventName:(NSString *)eventName
24+
reactTag:(NSNumber *)reactTag
2425
reactTouches:(NSArray<NSDictionary *> *)reactTouches
2526
changedIndexes:(NSArray<NSNumber *> *)changedIndexes
2627
coalescingKey:(uint16_t)coalescingKey
2728
{
2829
if (self = [super init]) {
30+
_viewTag = reactTag;
2931
_eventName = eventName;
3032
_reactTouches = reactTouches;
3133
_changedIndexes = changedIndexes;

React/Base/RCTTouchHandler.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ - (void)_updateAndDispatchTouches:(NSSet<UITouch *> *)touches
199199
}
200200

201201
RCTTouchEvent *event = [[RCTTouchEvent alloc] initWithEventName:eventName
202+
reactTag:self.view.reactTag
202203
reactTouches:reactTouches
203204
changedIndexes:changedIndexes
204205
coalescingKey:_coalescingKey];

0 commit comments

Comments
 (0)