Skip to content

Commit

Permalink
fix: fix #49
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLindhout committed Aug 1, 2023
1 parent 4cc25eb commit 4ada7bb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 9 deletions.
22 changes: 16 additions & 6 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ function App({
const [backgroundColor, setBackgroundColor] = React.useState<
string | undefined
>(undefined);
const [showFlightTab, setShowFlightTab] = React.useState<boolean>(true);
const [uppercase, setUppercase] = React.useState<boolean>(true);
const [showIcons, setShowIcons] = React.useState<boolean>(true);
const [showText, setShowText] = React.useState<boolean>(true);
Expand Down Expand Up @@ -140,12 +141,14 @@ function App({
>
<ExploreWitHookExamples />
</TabScreen>
<TabScreen
label="Flights"
icon={showIcons ? 'airplane' : undefined}
>
<ScreenWithText text={'Flights'} />
</TabScreen>
{showFlightTab && (
<TabScreen
label="Flights"
icon={showIcons ? 'airplane' : undefined}
>
<ScreenWithText text={'Flights'} />
</TabScreen>
)}
<TabScreen
label="Trips"
icon={showIcons ? 'bag-personal' : undefined}
Expand Down Expand Up @@ -247,6 +250,13 @@ function App({
onValueChange={(v) => setShowBadges(v)}
/>
</Row>
<Row>
<Label>Show flights tabs</Label>
<Switch
value={showFlightTab}
onValueChange={(v) => setShowFlightTab(v)}
/>
</Row>
<Row>
<Title>Icon position</Title>
</Row>
Expand Down
2 changes: 1 addition & 1 deletion src/Swiper.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function SwiperNative(props: SwiperProps) {
}
)}
>
{React.Children.map(children, (tab, tabIndex) => (
{React.Children.map(children.filter(Boolean), (tab, tabIndex) => (
<View style={styles.viewPager} key={tab.props.label || tabIndex}>
{tab}
</View>
Expand Down
6 changes: 4 additions & 2 deletions src/TabsHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export default function TabsHeader({
}

const textColorV2 = isDark ? '#fff' : '#000';
const activeColorV2 = hasPrimaryBackground ? textColor : theme.colors.primary;
const activeColorV2 = hasPrimaryBackground
? textColorV2
: theme.colors.primary;

// Color (active) On surface md.sys.color.on-surface
// Color (inactive) On surface variant md.sys.color.on-surface-variant
Expand Down Expand Up @@ -192,7 +194,7 @@ export default function TabsHeader({
<View style={styles.scrollablePadding} />
) : null}

{React.Children.map(children, (tab, tabIndex) => (
{React.Children.map(children.filter(Boolean), (tab, tabIndex) => (
<TabsHeaderItem
theme={theme}
tabIndex={tabIndex}
Expand Down

0 comments on commit 4ada7bb

Please sign in to comment.