mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-11 19:01:43 +08:00
reintroduced coalescing key for events
Summary: This was previously removed in D2884587, but we will need it going forward. See D3092867 for reasons why it's necessary again. Reviewed By: javache Differential Revision: D3092848 fb-gh-sync-id: 0d10dbac4148fcc8e035d32d8eab50f876d99e88 fbshipit-source-id: 0d10dbac4148fcc8e035d32d8eab50f876d99e88
This commit is contained in:
committed by
Facebook Github Bot 8
parent
8f07b01ac8
commit
a496baa68c
@@ -29,14 +29,19 @@
|
||||
|
||||
@synthesize viewTag = _viewTag;
|
||||
@synthesize eventName = _eventName;
|
||||
@synthesize coalescingKey = _coalescingKey;
|
||||
|
||||
- (instancetype)initWithViewTag:(NSNumber *)viewTag eventName:(NSString *)eventName body:(NSDictionary<NSString *, id> *)body
|
||||
- (instancetype)initWithViewTag:(NSNumber *)viewTag
|
||||
eventName:(NSString *)eventName
|
||||
body:(NSDictionary<NSString *, id> *)body
|
||||
coalescingKey:(uint16_t)coalescingKey
|
||||
{
|
||||
if (self = [super init]) {
|
||||
_viewTag = viewTag;
|
||||
_eventName = eventName;
|
||||
_body = body;
|
||||
_canCoalesce = YES;
|
||||
_coalescingKey = coalescingKey;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -85,7 +90,8 @@
|
||||
_body = @{ @"foo": @"bar" };
|
||||
_testEvent = [[RCTTestEvent alloc] initWithViewTag:nil
|
||||
eventName:_eventName
|
||||
body:_body];
|
||||
body:_body
|
||||
coalescingKey:0];
|
||||
|
||||
_JSMethod = [[_testEvent class] moduleDotMethod];
|
||||
}
|
||||
@@ -127,7 +133,8 @@
|
||||
{
|
||||
RCTTestEvent *nonCoalescingEvent = [[RCTTestEvent alloc] initWithViewTag:nil
|
||||
eventName:_eventName
|
||||
body:@{}];
|
||||
body:@{}
|
||||
coalescingKey:0];
|
||||
nonCoalescingEvent.canCoalesce = NO;
|
||||
[_eventDispatcher sendEvent:_testEvent];
|
||||
|
||||
@@ -144,7 +151,8 @@
|
||||
{
|
||||
RCTTestEvent *ignoredEvent = [[RCTTestEvent alloc] initWithViewTag:nil
|
||||
eventName:_eventName
|
||||
body:@{ @"other": @"body" }];
|
||||
body:@{ @"other": @"body" }
|
||||
coalescingKey:0];
|
||||
|
||||
[_eventDispatcher sendEvent:ignoredEvent];
|
||||
[_eventDispatcher sendEvent:_testEvent];
|
||||
@@ -162,7 +170,8 @@
|
||||
NSString *firstEventName = RCTNormalizeInputEventName(@"firstEvent");
|
||||
RCTTestEvent *firstEvent = [[RCTTestEvent alloc] initWithViewTag:nil
|
||||
eventName:firstEventName
|
||||
body:_body];
|
||||
body:_body
|
||||
coalescingKey:0];
|
||||
|
||||
[_eventDispatcher sendEvent:firstEvent];
|
||||
[_eventDispatcher sendEvent:_testEvent];
|
||||
|
||||
Reference in New Issue
Block a user