Skip to content

Commit

Permalink
fix: conditionally hide tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
hyoban committed Dec 11, 2024
1 parent e26d1c7 commit c6903bf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions app/(app)/(tabs)/_layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@ export default function TabLayout() {
<Tabs.Screen
key={view.name}
name={view.name}
options={{
title: view.title,
tabBarIcon: view.iconRequire,
tabBarBadge: `${countList[view.view] > 0 ? countList[view.view] : ''}`,
options={({ navigation }) => {
const currentIndex = navigation.getState().index as number
return {
title: view.title,
tabBarIcon: view.iconRequire,
tabBarBadge: `${countList[view.view] > 0 ? countList[view.view] : ''}`,
tabBarItemHidden: (currentIndex < 2 && view.view === 5) || (currentIndex >= 2 && view.view === 0),
}
}}
initialParams={{ view: view.view, title: view.title }}
/>
))}
</Tabs>
Expand Down

0 comments on commit c6903bf

Please sign in to comment.