react-native-pager-view icon indicating copy to clipboard operation
react-native-pager-view copied to clipboard

6.8.1 property scrollEnabled allows for swiping on iOS

Open karkakol opened this issue 5 months ago • 16 comments

Environment

IOS react-native: "0.79.5" expo: "53.0.19" react-native-pager-view: "6.8.1"

Description

On iOS setting parameter scrollEnables={false} allows to scroll by swiping through pager. Not sure is it regression

Reproducible Demo

Link to repro: https://github.com/karkakol/bug-rn-pager-scroll-enabled-repro/blob/main/app/_layout.tsx

karkakol avatar Jul 14 '25 16:07 karkakol

Current workaround for this problem using rn-gesture-handler: https://github.com/karkakol/bug-rn-pager-scroll-enabled-repro/blob/main/components/workaround.tsx

karkakol avatar Jul 14 '25 16:07 karkakol

+1

obrad97 avatar Jul 20 '25 00:07 obrad97

+1

leecuong666 avatar Jul 20 '25 04:07 leecuong666

It is a regression, another workaround is to downgrade to 6.8.0

karkakol avatar Jul 21 '25 07:07 karkakol

+1

hql362502 avatar Aug 12 '25 04:08 hql362502

Personnally i've just patched the file to add setScrollEnabled(false) since i'm using react-native-tab-view which is the one calling react-native-pager-view, so the workaround was too much changes compared to that one-liner, also unsure of the potential edge-cases that could arise using blocksExternalGesture()

diff --git a/src/PagerView.tsx b/src/PagerView.tsx
index 5238f1d1bcc7f87f906bc12b4ea92a461c84d0d9..a73cd6a8cd47741a03f54453c206d510a60f4bc9 100644
--- a/src/PagerView.tsx
+++ b/src/PagerView.tsx
@@ -154,6 +154,7 @@ export class PagerView extends React.Component<NativeProps> {
           {...this.props}
           ref={(ref) => {
             this.pagerView = ref;
+            this.setScrollEnabled(false);
           }}
           style={this.props.style}
           layoutDirection={this.deducedLayoutDirection}

Note: its a yarn patch

By the way, the problem is still present in 7.0.0

TwistedMinda avatar Aug 22 '25 22:08 TwistedMinda

I slightly adapted the change from TwistedMinda's patch to allow enable/disable certain pagers with the initial prop. I have not tested if it still works when changing the prop during runtime, but the patch should not change that behaviour from the original implementation.

  • react-native-pager-view+7.0.0.patch (npx patch-package)
diff --git a/node_modules/react-native-pager-view/src/PagerView.tsx b/node_modules/react-native-pager-view/src/PagerView.tsx
index 5238f1d..a5d397e 100644
--- a/node_modules/react-native-pager-view/src/PagerView.tsx
+++ b/node_modules/react-native-pager-view/src/PagerView.tsx
@@ -154,6 +154,7 @@ export class PagerView extends React.Component<NativeProps> {
           {...this.props}
           ref={(ref) => {
             this.pagerView = ref;
+            this.setScrollEnabled(this.props.scrollEnabled);
           }}
           style={this.props.style}
           layoutDirection={this.deducedLayoutDirection}

dodgex avatar Sep 13 '25 14:09 dodgex

Facing this issue as well

rithik-raja avatar Sep 21 '25 17:09 rithik-raja

Any update on this?

LuanNguyen-HnL avatar Sep 22 '25 10:09 LuanNguyen-HnL

+1

GeorgeHop avatar Sep 23 '25 14:09 GeorgeHop

If you are using the new arch, this has been fixed on the alpha version (v7), old arch support has been dropped on that version as well.

focux avatar Sep 26 '25 18:09 focux

If you are using the new arch, this has been fixed on the alpha version (v7), old arch support has been dropped on that version as well.

which alpha version there are several. Are you saying we still have this issue on v7.0.0 (non alpha) https://www.npmjs.com/package/react-native-pager-view/v/7.0.0

Edit:

https://www.npmjs.com/package/react-native-pager-view/v/7.1.0-alpha.2 solved the issue

AyoParadis avatar Sep 26 '25 22:09 AyoParadis

It’s ridiculous. How can this critical issue still be unresolved after so many months?

There should already be a hotfix for both 6.X and 7.X.

RomanSytnyk avatar Nov 05 '25 08:11 RomanSytnyk

You can use "react-native-pager-view": "7.1.0-alpha.2", it's fixed

clementnv avatar Nov 05 '25 08:11 clementnv

Any timeline on when the fix will be merged to the main branch?

AyoParadis avatar Nov 05 '25 09:11 AyoParadis

@clementnv Thank you for sharing ,

"react-native-pager-view": "7.1.0-alpha.2" Fixed

ZainaliSyed avatar Nov 17 '25 10:11 ZainaliSyed

Fixed in latest stable release

okwasniewski avatar Dec 22 '25 08:12 okwasniewski