React-native-pager-view: scrollEnabled={false} does not work for IOS

Created on 5 Nov 2019  路  9Comments  路  Source: callstack/react-native-pager-view

scrollEnabled={false}

does not work on IOS 12.x.x.

Versions:

"react": "16.8.1",
"react-native": "0.61.3",
"@react-native-community/viewpager": "2.0.1",

Codes:
<ViewPager style={{flex: 1}} initialPage={0} keyboardDismissMode="on-drag" scrollEnabled={false}> <View key="1"> <Text>First page</Text> </View> <View key="2"> <Text>Second page</Text> </View> </ViewPager>

bug

Most helpful comment

Same here for me. Works on android and not on IOS. On IOS you are still able to scroll. Please assist.

All 9 comments

Same here for me. Works on android and not on IOS. On IOS you are still able to scroll. Please assist.

same problem . only works on iOS.

I will take a look on it

Hey,
I have tested above code and it seems to work. I provide you a reproduce repo https://github.com/troZee/viewPagerExample

Please open, when you provide reproducible example. (You can fork my repo)

it works on iOS 13 only

I have seen the issue. For each view in the view pager you have to add key="0",key="1",key="2".... so on... For example

<View key="0" >
</View>
<View key="1" >
</View>
<View key="2" >
</View>

it works on iOS 13 only

I reopen this issue due reproducible case

I had the same issue and get it solved by removing paddingTop from parent of ViewPager. It was working fine in Android and iOS-13 but not in below versions of iOS.

Here is what which solved issue for me.

            < View style={{
                ...otherStyle,
                //paddingTop: 20, have to remove it from here and put it in child view of viewpager.
            }} >
                <ViewPager
                    scrollEnabled={false}
                    initialPage={0}>
                    <View
                        key="1"
                        style={{
                            flex: 1,
                            paddingTop: 20//used padding here and its working.
                        }} >
                        {/* view here */}
                    </View>
                </ViewPager>
            </View>

If anybody can shower light on its reason, it would be great.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

troZee picture troZee  路  8Comments

panda0603 picture panda0603  路  5Comments

yashspr picture yashspr  路  5Comments

ferrannp picture ferrannp  路  10Comments

thecodecafe picture thecodecafe  路  4Comments