Skip to content

Commit ae8d77e

Browse files
authored
Fix how we handle dynamic tab bar items (#1932)
1 parent 238ae60 commit ae8d77e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/components/tabController/TabBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,9 @@ const TabBar = (props: Props) => {
206206
iconColor={iconColor}
207207
selectedIconColor={selectedIconColor}
208208
activeBackgroundColor={activeBackgroundColor}
209-
key={item.label}
210209
{...item}
211210
{...context}
211+
key={`${index}_${item.label}`}
212212
index={index}
213213
onLayout={onItemLayout}
214214
/>

src/components/tabController/TabBarItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ export default function TabBarItem({
149149
const onLayout = useCallback((event: LayoutChangeEvent) => {
150150
const {width} = event.nativeEvent.layout;
151151

152-
if (!props.width && itemRef?.current) {
152+
if (!itemWidth.current && itemRef?.current) {
153153
itemWidth.current = width;
154154
// @ts-ignore
155155
itemRef.current?.setNativeProps({style: {width, paddingHorizontal: null, flex: null}});

0 commit comments

Comments
 (0)