@@ -8,16 +8,14 @@ @interface RCTOnPageScrollEvent : NSObject <RCTEvent>
88
99- (instancetype ) initWithReactTag : (NSNumber *)reactTag
1010 position : (NSNumber *)position
11- offset : (NSNumber *)offset
12- coalescingKey : (uint16_t )coalescingKey ;
11+ offset : (NSNumber *)offset ;
1312
1413@end
1514
1615@implementation RCTOnPageScrollEvent
1716{
1817 NSNumber * _position;
1918 NSNumber * _offset;
20- uint16_t _coalescingKey;
2119}
2220
2321@synthesize viewTag = _viewTag;
@@ -28,30 +26,28 @@ - (NSString *)eventName {
2826
2927- (instancetype ) initWithReactTag : (NSNumber *)reactTag
3028 position : (NSNumber *)position
31- offset : (NSNumber *)offset
32- coalescingKey : (uint16_t )coalescingKey ;
29+ offset : (NSNumber *)offset ;
3330{
3431 RCTAssertParam (reactTag);
3532
3633 if ((self = [super init ])) {
3734 _viewTag = reactTag;
3835 _position = position;
3936 _offset = offset;
40- _coalescingKey = coalescingKey;
4137 }
4238 return self;
4339}
4440
4541RCT_NOT_IMPLEMENTED (- (instancetype )init)
4642- (uint16_t )coalescingKey
4743{
48- return _coalescingKey ;
44+ return 0 ;
4945}
5046
5147
5248- (BOOL )canCoalesce
5349{
54- return NO ;
50+ return YES ;
5551}
5652
5753+ (NSString *)moduleDotMethod
@@ -426,7 +422,7 @@ - (void)pageViewController:(UIPageViewController *)pageViewController
426422 _currentIndex = [_childrenViewControllers indexOfObject: currentVC];
427423 [_eventDispatcher sendEvent: [[RCTOnPageSelected alloc ] initWithReactTag: self .reactTag position: [NSNumber numberWithInteger: _currentIndex] coalescingKey: _coalescingKey++]];
428424
429- [_eventDispatcher sendEvent: [[RCTOnPageScrollEvent alloc ] initWithReactTag: self .reactTag position: [NSNumber numberWithInteger: _currentIndex] offset: [NSNumber numberWithFloat: 0 ] coalescingKey: _coalescingKey++ ]];
425+ [_eventDispatcher sendEvent: [[RCTOnPageScrollEvent alloc ] initWithReactTag: self .reactTag position: [NSNumber numberWithInteger: _currentIndex] offset: [NSNumber numberWithFloat: 0 ]]];
430426 _reactPageIndicatorView.currentPage = _currentIndex;
431427 }
432428}
@@ -522,7 +518,7 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
522518 if (fabs (offset) > 1 ) {
523519 offset = offset > 0 ? 1.0 : -1.0 ;
524520 }
525- [_eventDispatcher sendEvent: [[RCTOnPageScrollEvent alloc ] initWithReactTag: self .reactTag position: [NSNumber numberWithInteger: _currentIndex] offset: [NSNumber numberWithFloat: offset] coalescingKey: _coalescingKey++ ]];
521+ [_eventDispatcher sendEvent: [[RCTOnPageScrollEvent alloc ] initWithReactTag: self .reactTag position: [NSNumber numberWithInteger: _currentIndex] offset: [NSNumber numberWithFloat: offset]]];
526522}
527523
528524@end
0 commit comments