react-native-collapsible-tab-view: Header not showing

I’ve just tried to implement the basic example but the header isn’t displaying? I’m on:

"react-native": "0.63.3"

Using:

  const [index, setIndex] = useState(0);

  const [routes] = useState([
    { key: 'first', title: 'First' },
    { key: 'second', title: 'Second' },
  ]);

  const _renderHeader = () => (
    <View style={styles.header}>
      <Text style={styles.headerText}>COLLAPSIBLE</Text>
    </View>
  );

  const _onTabPress = (tabProps) => {
    tabProps.jumpTo(tabProps.route.key);
  };

  const _renderTabBar = (props) => {
    return <TabBar {...props} onTabPress={_onTabPress} />;
  };

  return (
    <CollapsibleTabView
      navigationState={{ index, routes }}
      onIndexChange={setIndex}
      renderHeader={_renderHeader}
      renderScene={SceneMap({
        first: () => null,
        second: () => null,
      })}
      renderTabBar={_renderTabBar}
    />
  );

Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (17 by maintainers)

Commits related to this issue

Most upvoted comments

👍🏻 Kudos on the library by the way. Nice work!