Skip to content

Commit 8d064d4

Browse files
authored
fix(js): make sure that RCTEventEmitter is registered before emitting the first onScroll event (#809)
1 parent dbfa61c commit 8d064d4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/PagerView.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,17 @@ import PagerViewView, {
1414
Commands as PagerViewCommands,
1515
} from './PagerViewNativeComponent';
1616

17+
// The Fabric component for PagerView uses a work around present also in ScrollView:
18+
// https://github.com/callstack/react-native-pager-view/blob/master/ios/Fabric/RNCPagerViewComponentView.mm#L362-L368
19+
// That workaround works only if we add these lines in to make sure that the RCTEventEmitter is registered properly
20+
// in the JS callable modules.
21+
// 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
22+
// 0.74 approaches, we need to keep these lines.
23+
// As soon as we figure out how to move forward, we will provide guidance and/or submit a PR to fix this.
24+
if (Platform.OS === 'ios') {
25+
require('react-native/Libraries/Renderer/shims/ReactNative'); // Force side effects to prevent T55744311
26+
}
27+
1728
/**
1829
* Container that allows to flip left and right between child views. Each
1930
* child view of the `PagerView` will be treated as a separate page

0 commit comments

Comments
 (0)