Skip to content

[iOS 15] swipeEnabled: false is not working #1028

Open

Description

@JamesGs1994

### Bug Report

When using Top Tabs with swipeEnabled: false, the very first tab is still swipeable on first mount. After swiping once, the swipe is locked as expected.

Code Snippet

<TopTab.Navigator
  screenOptions={({ route }) => ({
    swipeEnabled: false,
  })}
>

  {/* screens */}
</TopTab.Navigator>

Expected Behavior

All top tabs should be non-swipeable when swipeEnabled: false is set.

Actual Behavior

On first mount:

The very first top tab is still swipeable.

After the first swipe, it correctly locks and behaves as expected.

Package Versions

{
  "name": "My_App",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@react-native-community/blur": "^4.4.1",
    "@react-native-community/checkbox": "^0.5.20",
    "@react-native-community/netinfo": "^11.4.1",
    "@react-native-picker/picker": "^2.11.1",
    "@react-native-vector-icons/ant-design": "^12.3.0",
    "@react-native-vector-icons/common": "^12.3.0",
    "@react-native-vector-icons/entypo": "^12.3.0",
    "@react-native-vector-icons/fontawesome6": "^12.2.0",
    "@react-native-vector-icons/ionicons": "^12.3.0",
    "@react-native-vector-icons/material-design-icons": "^12.3.0",
    "@react-native/new-app-screen": "0.80.2",
    "@react-navigation/bottom-tabs": "^7.4.6",
    "@react-navigation/drawer": "^7.5.7",
    "@react-navigation/elements": "^2.6.3",
    "@react-navigation/material-top-tabs": "^7.3.6",
    "@react-navigation/native": "^7.1.17",
    "@react-navigation/native-stack": "^7.3.25",
    "@react-navigation/stack": "^7.4.8",
    "@realm/react": "^0.11.0",
    "@reduxjs/toolkit": "^2.8.2",
    "@types/react-native-table-component": "^1.2.8",
    "@types/react-native-vector-icons": "^6.4.18",
    "axios": "^1.11.0",
    "date-fns": "^4.1.0",
    "react": "19.1.0",
    "react-native": "0.80.2",
    "react-native-awesome-slider": "^2.9.0",
    "react-native-device-info": "^14.0.4",
    "react-native-dotenv": "^3.4.11",
    "react-native-element-dropdown": "^2.12.4",
    "react-native-full-responsive": "^2.4.5",
    "react-native-gesture-handler": "^2.28.0",
    "react-native-pager-view": "^6.9.1",
    "react-native-paper": "^5.14.5",
    "react-native-paper-dates": "^0.22.49",
    "react-native-radio-buttons-group": "^3.1.0",
    "react-native-reanimated": "^4.1.0",
    "react-native-safe-area-context": "^5.6.0",
    "react-native-screens": "^4.13.1",
    "react-native-table-component": "^1.2.2",
    "react-native-uuid": "^2.0.3",
    "react-native-webview": "^13.15.0",
    "react-native-worklets": "^0.5.1",
    "react-redux": "^9.2.0",
    "realm": "^12.14.2",
    "redux": "^5.0.1",
    "redux-devtools-extension": "^2.13.9",
    "uuid": "^11.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/runtime": "^7.25.0",
    "@react-native-community/cli": "19.1.1",
    "@react-native-community/cli-platform-android": "19.1.1",
    "@react-native-community/cli-platform-ios": "19.1.1",
    "@react-native/babel-preset": "0.80.2",
    "@react-native/eslint-config": "0.80.2",
    "@react-native/metro-config": "0.80.2",
    "@react-native/typescript-config": "0.80.2",
    "@types/jest": "^29.5.13",
    "@types/react": "^19.1.0",
    "@types/react-test-renderer": "^19.1.0",
    "babel-plugin-module-resolver": "^5.0.2",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-native-worklets": "^0.5.1",
    "react-test-renderer": "19.1.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

Full package.json attached above in case needed.

Environment

Node: >=18

Check the Issues already given

@tobycox @sophiebits @cpojer @bvaughn

https://github.com/react-navigation/react-navigation/issues/12668#issue-3193343632

Activity

  1. denysoleksiienko commented on Sep 30, 2025

    @denysoleksiienko
  2. Philboisvert commented on Oct 3, 2025

    @Philboisvert

    +1

  3. alextbogdanov commented on Oct 9, 2025

    @alextbogdanov

    +1

  4. doyoonkim12345 commented on Oct 12, 2025

    @doyoonkim12345

    +1

  5. danish5454 commented on Oct 16, 2025

    @danish5454

    +1

  6. marco242424 commented on Oct 19, 2025

    @marco242424

    +1

  7. rgcjhn commented on Oct 22, 2025

    @rgcjhn

    +1

  8. neodin2015 commented on Oct 22, 2025

    @neodin2015

    I managed to temporarily fix this issue with the following approach:

    const [isSwipeEnabled, setIsSwipeEnabled] = useState(true)
    
    useEffect(() => {
      setTimeout(() => {
        setIsSwipeEnabled(false)
      })
    }, [])
    
    <Tab.Navigator
      screenOptions={{
        swipeEnabled: isSwipeEnabled,
      }}
    >
    
  9. LarsDanau commented on Oct 27, 2025

    @LarsDanau

    +1

  10. aminhdev commented on Nov 5, 2025

    @aminhdev

    +1 issue

  11. aminhdev commented on Nov 5, 2025

    @aminhdev

    I managed to temporarily fix this issue with the following approach:

    const [isSwipeEnabled, setIsSwipeEnabled] = useState(true)
    
    useEffect(() => {
      setTimeout(() => {
        setIsSwipeEnabled(false)
      })
    }, [])
    
    <Tab.Navigator
      screenOptions={{
        swipeEnabled: isSwipeEnabled,
      }}
    >
    

    Your workaround is working!

  12. Daniel3711997 commented on Nov 28, 2025

    @Daniel3711997

    Still exists in 7.0

  13. preis-lab commented on Dec 2, 2025

    @preis-lab
    Contributor

    As mentioned by @Daniel3711997 , this was supposed to be fixed in 7.0.1, but it's still broken when scrollEnabled={false}. The first render looks fine, but it breaks again afterward.

    Here’s a proposed PR to fix it: #1043

  14. Daniel3711997 commented on Dec 3, 2025

    @Daniel3711997

    @troZee the NPM release action has failed.

  15. troZee commented on Dec 3, 2025

    @troZee
    Collaborator

    Thank you for letting me know. Now it should be fine https://www.npmjs.com/package/react-native-pager-view/v/7.0.2

  16. zewillze commented on Sep 7, 2026

    @zewillze
    Contributor

    using v9.0.4 the issue still exist(iOS 15 only) , even hard code collectionview.isScrollEnabled to false but not work. please help

  17. troZee commented on Sep 7, 2026

    @troZee
    Collaborator

    @zewillze, please provide a reproduction 🙏 I am not able to reproduce that

  18. zewillze commented on Sep 7, 2026

    @zewillze
    Contributor

    @zewillze, please provide a reproduction 🙏 I am not able to reproduce that

    hi @troZee , thanks for your reply. Since you couldn’t reproduce the issue, I have created a forked version with my modifications. https://github.com/zewillze/react-native-pager-view-ios15-issue/tree/main
    Note: This issue only occurs on iOS 15. I can consistently reproduce it on test devices running iOS 15.1 and 15.2.
    You should be able to observe the bug after that. Could you please help debug this issue based on this fork? Thank you very much!

  19. reopened this on Sep 8, 2026
  20. changed the title [-]swipeEnabled: false is not working[/-] [+][iOS 15] swipeEnabled: false is not working[/+] on Sep 8, 2026
  21. zewillze commented on Sep 21, 2026

    @zewillze
    Contributor

    Thanks @troZee — here is a reproduction plus the root cause. It only happens on iOS 15, which is likely why it isn't reproducible on a newer simulator.

    Root cause

    On iOS 15 SwiftUI implements .tabViewStyle(.page) with a compositional layout that pages orthogonally: the horizontal paging is performed by an embedded UIScrollView subview of the collection view (_UICollectionViewOrthogonalScrollerEmbeddedScrollView), while the collection view itself only scrolls vertically.

    ios/PagerView.swift applies isScrollEnabled / bounces only to the collection view that SwiftUIIntrospect hands us, so on iOS 15 the outer view is disabled correctly while the embedded paging scroll view keeps scrolling. Measured with lldb on an iOS 15.2 simulator with scrollEnabled={false}:

    view class isScrollEnabled panGestureRecognizer.isEnabled contentSize.width
    outer PagingCollectionView (UICollectionView) 0 ✅ 0 428 (1 page, vertical)
    inner _UICollectionViewOrthogonalScrollerEmbeddedScrollView 1 ❌ 1 ❌ 856 (2 pages = the pager)

    PagerViewProvider.scrollEnabled is also 0, i.e. the prop does arrive in the native view — the value just never reaches the view that actually handles the swipe. That is why hard-coding collectionView.isScrollEnabled = false doesn't help either.

    For comparison, on iOS 18.5 the same probe shows no embedded scroll view at all and PagingCollectionView.contentSize.width = 804 (= 2 pages): there the collection view itself is the pager, so disabling it is enough. Hence the bug is iOS 15-only.

    Worth noting: #1071 fixed a different failure mode (the initial-value timing, the .onAppear block). With 9.0.4 the outer collection view is already isScrollEnabled = 0, so the remaining iOS 15 report is exactly this embedded scroll view.

    Fix

    PR: <PR_LINK>

    It forwards scrollEnabled / overdrag to the embedded paging scroll views as well. The traversal stops at UICollectionViewCell boundaries, so scroll views that belong to the pages' React Native content (FlatList / ScrollView inside a page) are never touched.

    Verified on iOS 15.2 with lldb, same probe as above:

    • scrollEnabled={false} → outer 0 / 0, inner 0 / 0 (no swipe possible)
    • switching back to scrollEnabled={true} at runtime → both 1 / 1 (no regression)
    • programmatic setPage: still works while scrolling is disabled (contentOffset.x moves to the next page)
    • ScrollView inside a page keeps scrolling

    If you want to check it yourself without gestures: attach lldb, find _UICollectionViewOrthogonalScrollerEmbeddedScrollView (e.g. via recursiveDescription) and read

    expr -l objc++ -O -- (BOOL)[(UIScrollView *)$sv isScrollEnabled]
    expr -l objc++ -O -- (BOOL)[[(UIScrollView *)$sv panGestureRecognizer] isEnabled]
    

    Before the fix: 1 / 1. After: 0 / 0. A UIScrollView with isScrollEnabled = NO also has its pan gesture disabled, so no swipe can scroll it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions