TabController
A performant solution for a tab controller with lazy load mechanism
(code example)
Usageβ
Live Editor
<TabController items={[{label: 'First'}, {label: 'Second'}, {label: 'Third'}]}> <TabController.TabBar enableShadows/> <View flex> <TabController.TabPage index={0}>{renderFirstPage()}</TabController.TabPage> <TabController.TabPage index={1} lazy>{renderSecondPage()}</TabController.TabPage> <TabController.TabPage index={2} lazy>{renderThirdPage()}</TabController.TabPage> </View> </TabController>
Result
Loading...
APIβ
asCarouselβ
When using TabController.PageCarousel this should be turned on
boolean
carouselPageWidth;β
Pass for custom carousel page width
number
initialIndexβ
Initial selected index
number
itemsβ
The list of tab bar items
TabControllerItemProps[]
nestedInScrollViewβ
Does not work with asCarouselβ
Pass when TabController is render inside a ScrollView (with a header)
boolean
onChangeIndexβ
Callback for when index has change (will not be called on ignored items)
(index: number, prevIndex: number | null) => void