How do you remove white space between the tabs in react-navigation top bar. So what should happen is the tab size should adjust based on the screen size.
This is what my navigation looks like at the moment.
You can see that the tabs are really big. They are taking too much space. How can I get those white spaces so the tabs are only taking enough size to fit the tab name.
I've tried styling Tab.Navigator
with no luck. For example Ive tried the following:
<Tab.Navigator
initialRouteName="All"
tabBarOptions={{
scrollEnabled: true,
labelStyle: { padding: 0, margin: 0, border: 0 },
tabStyle: { padding: 0, margin: 0, border: 0 },
}}
lazy={true}
style={{ padding: 0, margin: 0, border: 0 }}
>
import React from "react";
import { createStackNavigator } from "@react-navigation/stack";
import { createMaterialTopTabNavigator } from "@react-navigation/material-top-tabs";
import Home from "../screens/Home";
const Tab = createMaterialTopTabNavigator();
const Stack = createStackNavigator();
const HomeTabNavigation = () => {
return (
<Tab.Navigator
initialRouteName="All"
tabBarOptions={{
scrollEnabled: true,
labelStyle: { padding: 0, margin: 0, border: 0 },
tabStyle: { padding: 0, margin: 0, border: 0 },
}}
lazy={true}
style={{ padding: 0, margin: 0, border: 0 }}
>
<Tab.Screen name="All" component={Home} />
<Tab.Screen name="Hot" component={Home} />
<Tab.Screen name="Winners" component={Home} />
</Tab.Navigator>
);
};
const HomeNavigation = () => {
return (
<Stack.Navigator>
<Stack.Screen name="HomeTabNavigation" component={HomeTabNavigation} />
</Stack.Navigator>
);
};
export default HomeNavigation;