React-native-pager-view: [V2] scrollEnabled set to false brakes all touch events

Created on 17 Sep 2019  路  6Comments  路  Source: callstack/react-native-pager-view

Bug

If scrollEnabled of ViewPager is set to false on iOS content of initial page inside native view pager stops getting all touch events.

Environment info

React native info output:

  React Native Environment Info:
    System:
      OS: macOS 10.15
      CPU: (12) x64 Intel(R) Core(TM) i9-8950HK CPU @ 2.90GHz
      Memory: 2.39 GB / 16.00 GB
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 10.16.3 - /usr/local/bin/node
      Yarn: 1.17.3 - /usr/local/bin/yarn
      npm: 6.9.0 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    SDKs:
      iOS SDK:
        Platforms: iOS 12.4, macOS 10.14, tvOS 12.4, watchOS 5.3
      Android SDK:
        API Levels: 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 7, 8, 9
        Build Tools: 27.0.3, 28.0.2, 28.0.3
        System Images: android-16 | Intel x86 Atom, android-18 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-21 | Intel x86 Atom, android-22 | Google APIs Intel x86 Atom, android-23 | Google APIs Intel x86 Atom, android-24 | Google Play Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Android TV Intel x86 Atom, android-28 | Google Play Intel x86 Atom
    IDEs:
      Android Studio: 3.5 AI-191.8026.42.35.5791312
      Xcode: 10.3/10G8 - /usr/bin/xcodebuild
    npmPackages:
      react: 16.8.6 => 16.8.6
      react-native: 0.59.10 => 0.59.10
    npmGlobalPackages:
      react-native-cli: 2.0.1
      react-native-git-upgrade: 0.2.7
      react-native-rename: 2.4.1

Library version: 2.0.0

Steps To Reproduce

  1. Use native ViewPager component on iOS
  2. Set scrollEnabled to false
  3. Initial page of ViewPager stop receiving touch events

Describe what you expected to happen:

  1. Use native ViewPager component on iOS
  2. Set scrollEnabled to false
  3. Receive all touch events inside initial page while disabling scrolling of ViewPager

Reproducible sample code

let enableScroll = false

<ViewPager
  style={{ flex: 1 }}
  initialPage={0}
  scrollEnabled={enableScroll}
>
  <View style={{ flex: 1 }}>
       // This button is not receiving touch event on iOS
       <TouchableOpacity onPress={() => { enableScroll = true }}>
            <Text>Test</Text> 
       </TouchableOpacity>
  </View>
  <View style={{ flex: 1 }} />
</ViewPager>
bug

All 6 comments

Hey @ivan3177 , thank you for reporting this issue. I can reproduce it in example app. I will take a look onto it.

Hey, @ivan3177 thanks for reporting this issue! Could you please check it on new 2.0?
@ptrocki made a fix and it is merged already 馃帀

@ptrocki, @dratwas, yes, bug that I found was fixed. But another one, hard to reproduce bug appeared.

Now sometimes even with scollEnabled = false ViewPager can still be scrolled on iOS. Not always, it happens in about 25% of app restarts/reloads. Should I open new issue about it?

Did you scroll using your hand or triggering scroll method? scollEnabled = false only work for first one. The second one you have to handle by yourself.

@ptrocki I did it using hand. There was no bug before the touch events fix so my guess it's somehow related to it. But I'm not sure how to show and example of what's happening, apparently if I do reload or restart app for a bit(5-6 times) eventually I'll get into situation when ViewPager is scrolled using finger while scrollEnabled was set to false

@ivan3177 as the issue you reported was resolved (thank you!). If you are experimenting a different problem, please open a new issue and if you can add some reproduction code, steps and/or some gif or images.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nnajiabraham picture nnajiabraham  路  6Comments

ferrannp picture ferrannp  路  10Comments

troZee picture troZee  路  3Comments

panda0603 picture panda0603  路  5Comments

iqbalfaisal picture iqbalfaisal  路  3Comments