React-native-tab-view: Tab inside scroll view on android not working

Created on 17 Jul 2018  路  6Comments  路  Source: satya164/react-native-tab-view

Current behaviour

I have a ScrollList with two components one with information and the second one is a tab view. I want to be able to scroll the page in order to see the tabs sections which may change in height.

On iOS the behaviour is correct, i am able to scroll down the page with no problem, and switching the tabs with no issues at all. However on android i cant scroll the scroll view.

Expected behaviour

The expected behaviour is that i can scroll the scroll view.

Code sample

const { content } = this.props;
    return (
      <ScrollView
        style={styles.container}
        onScroll={this.onScroll}
        scrollEventThrottle={100}
      >
        <ContentInfo content={content} />
        { content.type === 'series' ? <SeriesContent /> : <MovieContent content={content} /> }
      </ScrollView>
    );

MovieContent Component

<View style={styles.container}>
        <TabView
          navigationState={{ index, routes }}
          renderScene={({ route }) => {
            switch (route.key) {
            case 'first':
              return error ?
                <Text style={[TextStyles.error, styles.error]}> { error } </Text> :
                <ContentGridList items={related} scrollEnabled={false} />;
            case 'second':
              return <Trailers />;
            default:
              return null;
            }
          }}
          onIndexChange={key => this.setState({ index: key })}
          initialLayout={{ width: Dimensions.get('window').width }}
          renderTabBar={props => (
            <TabBar
              {...props}
              indicatorStyle={{ backgroundColor: Colors.main }}
              style={{ backgroundColor: Colors.secondary }}
              labelStyle={TextStyles.titleSmall}
            />
          )}
        />
      </View>

Your Environment

| software | version
| --------------------- | -------
| android |
| react-native | 0.55.4
| react-native-tab-view |1.02

Most helpful comment

I have the same. This is a real show stopper. The only way for it to work in Android is to set the parent container of the TabView to a fixed height, which is not practical. Anyone know any alternative tab libraries that would work?

All 6 comments

I just see that the tabs are not rendering. Dont know why might this happen

i have exactly same problem to ......:(

I have the same. This is a real show stopper. The only way for it to work in Android is to set the parent container of the TabView to a fixed height, which is not practical. Anyone know any alternative tab libraries that would work?

Same issue on my new development app !
Any solution without fixed height ?

Please don't nest TabView inside ScrollView. Whatever feature you're trying to achieve, this is not the optimal way and will cause perf issues if you have any listview inside the tabs. See https://github.com/react-native-community/react-native-tab-view/issues/107#issuecomment-287708043

Was this page helpful?
0 / 5 - 0 ratings

Related issues

QuentinBrosse picture QuentinBrosse  路  4Comments

glennvgastel picture glennvgastel  路  3Comments

karthikeyansundaram2 picture karthikeyansundaram2  路  3Comments

lubomyr picture lubomyr  路  3Comments

satya164 picture satya164  路  3Comments