Tab not rendered after dynamic ScrollableTab update
See original GitHub issueAfter ScrollableTab dynamically updated, sometimes Tab won’t get rendered.
I modified the scrollableTab.js (from the Kitchen Sink example) for this issue, please follow the steps below to reproduce it:
- use the attached code to replace scrollableTab.js file
- lauch app, and goes to “Tabs > Scrollable Tabs” from menu
- please click ‘Tab3’ immediately
- after 5 seconds, the ScrollableTab will be dynamically udpated, and it shows that ‘Tab5’ is the highlighted one, however, the ‘TabFive’ content is not rendered, it shows an empty view.
import React, { Component } from "react";
import {
Container,
Header,
Title,
Button,
Icon,
Tabs,
Tab,
Right,
Left,
Body,
ScrollableTab
} from "native-base";
import TabOne from "./tabOne";
import TabTwo from "./tabTwo";
import TabThree from "./tabThree";
import TabFour from "./tabFour";
import TabFive from "./tabFive";
class BasicTab extends Component {
constructor() {
super();
this.state = { small: false };
}
componentDidMount() {
setTimeout(() => {
this.setState({ small: true });
}, 5000);
}
render() {
let tabs = (
<Tabs renderTabBar={() => <ScrollableTab />}>
<Tab heading="Tab1">
<TabOne />
</Tab>
<Tab heading="Tab2">
<TabTwo />
</Tab>
<Tab heading="Tab3">
<TabThree />
</Tab>
</Tabs>
);
if (this.state.small) {
tabs = (
<Tabs renderTabBar={() => <ScrollableTab />}>
<Tab heading="Tab4">
<TabFour />
</Tab>
<Tab heading="Tab5">
<TabFive />
</Tab>
</Tabs>
);
}
return (
<Container>
<Header hasTabs>
<Left>
<Button transparent onPress={() => this.props.navigation.goBack()}>
<Icon name="arrow-back" />
</Button>
</Left>
<Body>
<Title> Scrollable Tabs</Title>
</Body>
<Right />
</Header>
{tabs}
</Container>
);
}
}
export default BasicTab;
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Scrolling issue with dynamic tabs in Kendo UI for jQuery - Telerik
Hi I have a TabStrips that gets the tabs from external source (dynamic) and the scrollable property is not working for me.
Read more >primefaces nested tabview and tabs, not able to scroll tabs
Version 5.3 adds the scroll controls if space is to small to show all tabs on initial rendering. Version 5.2 doesn't for nested...
Read more >React Tabs component - Material UI - MUI
Long labels will automatically wrap on tabs. If the label is too long for the tab, it will overflow, and the text will...
Read more >React Native Tab View - Best of JS
Note that some functionalities are not available with the React Navigation 4 integration because of the limitations in React Navigation. For example, it's ......
Read more >Building a Tabs component - web.dev
A foundational overview of how to build a tabs component similar to ... elements are in here, the browser will render a scrollbar...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey guys, is this issue solved, or in the process of getting solved? Is it possible to render
<ScrollableTab />
dynamically using themap()
method? I seem to have the same problem too, tried wrapping it around<React.Fragment />
and<View />
but no success. As in 👇I solved this issue. This is work for me to do the dynamically tabs using map().