Created
June 29, 2022 07:15
-
-
Save manakuro/4e3f7a922ebb37da47e0f9a07813fbf5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {TabViewProps, Route} from 'react-native-tab-view'; | |
import {View} from 'react-native'; | |
import {TabBarItem} from './TabBarItem'; | |
type Props<T extends Route> = Parameters< | |
NonNullable<TabViewProps<T>['renderTabBar']> | |
>[0] & { | |
onIndexChange: (index: number) => void; | |
}; | |
export const TabBar = <T extends Route>(props: Props<T>) => { | |
return ( | |
<View | |
style={{ | |
flexDirection: 'row', | |
borderBottomWidth: 0.5, | |
borderStyle: 'solid', | |
borderBottomColor: 'rgba(255, 255, 255, 0.24)', | |
}}> | |
{props.navigationState.routes.map((route, i) => ( | |
<TabBarItem key={i} onPress={props.onIndexChange} index={i}> | |
{route.title} | |
</TabBarItem> | |
))} | |
</View> | |
); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment