react-native-collapsible-tab-view: [bug] When switch between tabs, there is a blank space at the top if use Tabs.ScrollView
Hey 👋 When I switch between tabs, there is a blank space at the top if I use Tabs.ScrollView:
"react-native-collapsible-tab-view": "^6.1.4"
Code:
const tabs = useMemo(
() => [
{ key: 'about', title: 'T' },
{ key: 'products', title: 'A' },
{ key: 'categories', title: 'S' },
{ key: 'reviews', title: 'F' },
],
[],
);
const renderHeader = useCallback(() => {
return <Header title={storeName} />;
}, []);
return (
<View style={{ flex: 1, backgroundColor: colors.gray100 }}>
<Tabs.Container
headerHeight={undefined}
renderTabBar={(props) => (
<MaterialTabBar
{...props}
activeColor={colors.primary}
inactiveColor={colors.gray900}
labelStyle={styles.labelStyle}
tabStyle={styles.tabStyle}
scrollEnabled
indicatorStyle={styles.indicatorStyle}
contentContainerStyle={{
gap: scale.sx,
}}
/>
)}
renderHeader={renderHeader}
headerContainerStyle={styles.tabBarStyle}>
{tabs.map((tab) => {
switch (tab.key) {
case 'about':
return (
<Tabs.Tab name={tab.title} key={'about'}>
<AboutTab />
</Tabs.Tab>
);
case 'products':
return (
<Tabs.Tab name={tab.title} key={'products'}>
<ProductsTab translationY={translationY} />
</Tabs.Tab>
);
case 'categories':
return (
<Tabs.Tab name={tab.title} key={'categories'}>
<CategoriesTab />
</Tabs.Tab>
);
case 'reviews':
return (
<Tabs.Tab name={tab.title} key={'reviews'}>
<ReviewsTab />
</Tabs.Tab>
);
default:
return null;
}
})}
</Tabs.Container>
</View>
);
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 21
I encountered the same problem in a multilingual application and it turned out that for the English language everything works correctly, but with other languages ​​there is this problem.
Before my code was like
<Tabs.Tab name={‘Some tab name’}>
After my code is like
<Tabs.Tab name={‘Some tab name ID’} label={‘Some tab label text’}>
Where label is displayed text and everything works fine.
https://github.com/PedroBern/react-native-collapsible-tab-view/pull/394 might fix this, I released it as 7.0.1-beta.0 on npm. Please help test it for unwanted side effects and report back. Thanks!
here is the fix I came up with
Yes, it’s gone for me. Only appears if I debug with Chrome. Haven’t tried out TestFlight build yet… 😬