Skip to content

Commit

Permalink
fix: memoize tabbar in example so it doesn't flicker
Browse files Browse the repository at this point in the history
  • Loading branch information
andreialecu committed Feb 5, 2021
1 parent 6cfdaf4 commit eeb94cc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion example/src/DynamicTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,18 @@ const DynamicTabs: ExampleComponentType = () => {
)
}

const TabBarComponent = React.useCallback(
(props) => <MaterialTabBar {...props} scrollEnabled />,
[]
)

return (
<Tabs.Container
headerHeight={HEADER_HEIGHT}
HeaderComponent={HeaderComponent}
lazy
onIndexChange={setCurrentTab}
TabBarComponent={(props) => <MaterialTabBar {...props} scrollEnabled />}
TabBarComponent={TabBarComponent}
>
{tabs.map((name) => {
return (
Expand Down

0 comments on commit eeb94cc

Please sign in to comment.