Skip to content

Commit

Permalink
fix(js): make sure that RCTEventEmitter is registered before emitting…
Browse files Browse the repository at this point in the history
… the first onScroll event (#809)
  • Loading branch information
cipolleschi authored Mar 29, 2024
1 parent dbfa61c commit 8d064d4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/PagerView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ import PagerViewView, {
Commands as PagerViewCommands,
} from './PagerViewNativeComponent';

// The Fabric component for PagerView uses a work around present also in ScrollView:
// https://github.com/callstack/react-native-pager-view/blob/master/ios/Fabric/RNCPagerViewComponentView.mm#L362-L368
// That workaround works only if we add these lines in to make sure that the RCTEventEmitter is registered properly
// in the JS callable modules.
// NOTE: This is a workaround as we would like to get rid of these lines below. But for the time being, as the cut date for
// 0.74 approaches, we need to keep these lines.
// As soon as we figure out how to move forward, we will provide guidance and/or submit a PR to fix this.
if (Platform.OS === 'ios') {
require('react-native/Libraries/Renderer/shims/ReactNative'); // Force side effects to prevent T55744311
}

/**
* Container that allows to flip left and right between child views. Each
* child view of the `PagerView` will be treated as a separate page
Expand Down

0 comments on commit 8d064d4

Please sign in to comment.