I’m using createMaterialTopTabNavigator from React Navigation with React Native Web. The tab layout behaves weirdly on scale/zoom change in browser — it recalculates the width of the <Tab.Navigator> and causes layout jumps or “jank” (it looks like a re-render with visible snapping). Here’s what I’ve tried: • Disabling animations: animationEnabled: false • Turning off lazy loading: lazy: false • Putting the entire <Tab.Navigator> in a wrapper View with fixed width • Setting tabBarOptions and screenOptions directly
But nothing helps — the tab bar still shifts when zooming in/out in the browser.
Any way to stabilize the layout on zoom/scale and prevent this “jumpiness”? I want the tab widths to remain consistent without recalculating or jittering on zoom.
import { createMaterialTopTabNavigator } from '@react-navigation/material-top-tabs';
const Tab = createMaterialTopTabNavigator();
<Tab.Navigator
tabBarOptions={{
activeTintColor: '#008000',
indicatorStyle: { backgroundColor: '#008000' },
}}
screenOptions={{
lazy: false,
animationEnabled: Platform.OS !== 'web',
swipeEnabled: Platform.OS !== 'web',
}}
>
<Tab.Screen
name="General"
options={{
tabBarLabel: 'General',
tabBarTestID: 'GeneralTabButton',
}}
>
{() => (
<View testID="GeneralTab">
<General inspection={inspection} id={id} navigation={navigation} />
</View>
)}
</Tab.Screen>
<Tab.Screen
name="Photos"
options={{
tabBarLabel: 'Photos',
tabBarTestID: 'PhotosTabButton',
}}
>
{() => (
<View testID="PhotosTab">
<Photos
inspection={inspection}
navigation={navigation}
id={id}
simple={false}
projectLookups={{
floors: project?.floors,
buildings: project?.buildings,
}}
visibility={visibility}
/>
</View>
)}
</Tab.Screen>
</Tab.Navigator>