Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ios/Fabric/RNCPagerViewComponentView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
#import "RCTFabricComponentsPlugins.h"
#import "React/RCTConversions.h"

#import <React/RCTBridge+Private.h>
#import "RCTOnPageScrollEvent.h"

using namespace facebook::react;

@interface RNCPagerViewComponentView () <RCTRNCViewPagerViewProtocol, UIPageViewControllerDataSource, UIPageViewControllerDelegate, UIScrollViewDelegate>
Expand Down Expand Up @@ -315,6 +318,15 @@ - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
const auto strongEventEmitter = *std::dynamic_pointer_cast<const RNCViewPagerEventEmitter>(_eventEmitter);
int eventPosition = (int) position;
strongEventEmitter.onPageScroll(RNCViewPagerEventEmitter::OnPageScroll{.position = static_cast<double>(eventPosition), .offset = absoluteOffset});

//This is temporary workaround to allow animations based on onPageScroll event
//until Fabric implements proper NativeAnimationDriver
RCTBridge *bridge = [RCTBridge currentBridge];

if (bridge) {
[bridge.eventDispatcher sendEvent:[[RCTOnPageScrollEvent alloc] initWithReactTag:[NSNumber numberWithInt:self.tag] position:@(position) offset:@(absoluteOffset)]];
}

}


Expand Down