Nativebase: Horizontal ScrollView inside Tab component doesn't work

Created on 23 Dec 2017  路  8Comments  路  Source: GeekyAnts/NativeBase

I'm using NativeBase scrollable Tabs and each tab contains a horizontall ScrollView on top and some other contents under the ScrollView. The issue is when I try to scroll the contents inside ScrollView, it does not move and instead, the page (or Tab) scrolls to the other page or tab.

I want to keep locked={false} to slide between tabs. If I set locked = {true} the scrollview works but not the page content sliding.

Anyone knows how to fix this?

react-native : 0.49.3
native-base : 2.3.3

Expected behaviour

ScrollView scrolls horizontally

Actual behaviour

Scrolls to the next tabbed page

Steps to reproduce (code snippet or screenshot)

This is my code

render() {
        return (
            <Tabs renderTabBar={()=> <ScrollableTab />} style={tabsStyles.tab} initialPage={2}
                  onChangeTab={page => this.tabChanged(page)}
                  locked={false}>
                 <Tab heading="Tab One">
                       <ScrollView
                          horizontal
                          showsHorizontalScrollIndicator={false}
                        >
                      <Image source={...}> // There are several images here
                  </ScrollView>
                      <PageContent> // This could be any page content
                  </Tab>
                 <Tab heading="Tab Two">
                       <ScrollView
                          horizontal
                          showsHorizontalScrollIndicator={false}
                        >
                      <Image source={...}> // There are several images here
                     </ScrollView>
                      <PageContent> // This could be any page content
                  </Tab>
                  <Tab heading="Tab Three">
                       <ScrollView
                          horizontal
                          showsHorizontalScrollIndicator={false}
                        >
                      <Image source={...}> // There are several images here
                     </ScrollView>
                      <PageContent> // This could be any page content
                  </Tab>
           <Tabs>
        );
    }

I tested on Android, not sure about iOs

Most helpful comment

setting locked={true} for Tabs components it worked for me. but still it is a bug very annoying.

All 8 comments

Currently this is a limitation. When using Horizontal ScrollView with tabs, you have to lock the tabs for Horizontal ScrollView to work correctly. On wrapping the Horizontal ScrollView inside the tab, for horizontal scroll - the parent scroll action dominates the child scroll action which causes only Tab to scroll

Any Update on this Limitation? i Want to Use the Tabs with the horizontal scroll view inside one Tab.. or Is there any other alternative ?

I'm using NativeBase scrollable Tabs and each tab contains a horizontall ScrollView on top and some other contents under the ScrollView. The issue is when I try to scroll the contents inside ScrollView, it does not move and instead, the page (or Tab) scrolls to the other page or tab.

I want to keep locked={false} to slide between tabs. If I set locked = {true} the scrollview works but not the page content sliding.

Anyone knows how to fix this?

react-native : 0.49.3
native-base : 2.3.3

Expected behaviour

ScrollView scrolls horizontally

Actual behaviour

Scrolls to the next tabbed page

Steps to reproduce (code snippet or screenshot)

This is my code

render() {
        return (
            <Tabs renderTabBar={()=> <ScrollableTab />} style={tabsStyles.tab} initialPage={2}
                  onChangeTab={page => this.tabChanged(page)}
                  locked={false}>
                 <Tab heading="Tab One">
                       <ScrollView
                          horizontal
                          showsHorizontalScrollIndicator={false}
                        >
                      <Image source={...}> // There are several images here
                  </ScrollView>
                      <PageContent> // This could be any page content
                  </Tab>
                 <Tab heading="Tab Two">
                       <ScrollView
                          horizontal
                          showsHorizontalScrollIndicator={false}
                        >
                      <Image source={...}> // There are several images here
                     </ScrollView>
                      <PageContent> // This could be any page content
                  </Tab>
                  <Tab heading="Tab Three">
                       <ScrollView
                          horizontal
                          showsHorizontalScrollIndicator={false}
                        >
                      <Image source={...}> // There are several images here
                     </ScrollView>
                      <PageContent> // This could be any page content
                  </Tab>
           <Tabs>
        );
    }

I tested on Android, not sure about iOs

its Working for IOS but it's not working for Android

@SupriyaKalghatgi It does not work for me, I setted locked={true} and still not working, any suggestion?

setting locked={true} for Tabs components it worked for me. but still it is a bug very annoying.

any solution other than setting locked={true}

Hi there! Please can someone help us to use ScrollView with Tab component on android too?

same problem in android, but work in iOS.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

natashache picture natashache  路  3Comments

kitsune7 picture kitsune7  路  3Comments

omerdn1 picture omerdn1  路  3Comments

georgemickael-b picture georgemickael-b  路  3Comments

bsiddiqui picture bsiddiqui  路  3Comments