Skip to content

Send files directly between devices over the internet - no cloud storage, no size limits.

fix: active tab pill sometimes invisible on mobile

Denis Lupookov36c748d040e2
diff --git a/packages/components/src/components/Tabs/TabIndicator.native.tsx b/packages/components/src/components/Tabs/TabIndicator.native.tsx
index 1f8cc28..dd8ad58 100644
--- a/packages/components/src/components/Tabs/TabIndicator.native.tsx
+++ b/packages/components/src/components/Tabs/TabIndicator.native.tsx
@@ -15,6 +15,9 @@ export function TabIndicator({ activeIndex, count, stretch }: TabIndicatorProps)
const slot = stretch && count > 0 ? width / count : 0
useEffect(() => {
+ if (slot <= 0) {
+ return
+ }
Animated.timing(translateX, {
toValue: activeIndex * slot,
duration: 200,
@@ -24,20 +27,22 @@ export function TabIndicator({ activeIndex, count, stretch }: TabIndicatorProps)
const onLayout = (event: LayoutChangeEvent) => setWidth(event.nativeEvent.layout.width)
+ if (!stretch || count < 1) {
+ return null
+ }
+
return (
<View pointerEvents='none' style={styles.layer} onLayout={onLayout}>
- {slot > 0 ? (
- <Animated.View
- style={[
- styles.pill,
- {
- width: slot,
- backgroundColor: theme.colors.colorSurfacePrimary,
- transform: [{ translateX }]
- }
- ]}
- />
- ) : null}
+ <Animated.View
+ style={[
+ styles.pill,
+ {
+ width: `${100 / count}%`,
+ backgroundColor: theme.colors.colorSurfaceSecondary,
+ transform: [{ translateX }]
+ }
+ ]}
+ />
</View>
)
}
diff --git a/packages/components/src/components/Tabs/TabIndicator.tsx b/packages/components/src/components/Tabs/TabIndicator.tsx
index fa098ba..e5b1d55 100644
--- a/packages/components/src/components/Tabs/TabIndicator.tsx
+++ b/packages/components/src/components/Tabs/TabIndicator.tsx
@@ -24,7 +24,7 @@ const styles = css.create({
top: 0,
bottom: 0,
borderRadius: tokens.radiusSm,
- backgroundColor: tokens.colorSurfacePrimary,
+ backgroundColor: tokens.colorSurfaceSecondary,
transitionProperty: 'transform, width',
transitionDuration: '200ms',
transitionTimingFunction: 'ease'