'Vertical centering icons in react-navigation bottom-tabs

So I've been using react navigation bottom tabs and it seems like they auto move their icons up slightly, because they assume text will be below it. I have an image below where you can see the the margin below the icon is larger than above. I tried styling by using 'align-center', but that didn't fix it. How can I adjust this?

import React, {useState} from 'react';
import {StyleSheet, View, Image, Text, TouchableOpacity} from 'react-native';
import Loader from '../components/Loader';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {NavigationContainer} from '@react-navigation/native';
import PostsScreen from './PostsScreen';
import ProfileScreen from './ProfileScreen';
import PostSelectScreen from './PostSelectScreen';
import SearchScreen from './SearchScreen';

const Tab = createBottomTabNavigator();

const NavigatorTab = ({navigation}) => {
  const [loading, setLoading] = useState(false);

  return (
    <Tab.Navigator>
      <Tab.Screen
        name="Home"
        component={PostsScreen}
        options={{
          tabBarLabel: '',
          tabBarIcon: ({color, size}) => (
            <Image source={require('../assets/Home.png')} />
          ),
        }}
      />
      <Tab.Screen
        name="Search"
        component={SearchScreen}
        options={{
          tabBarLabel: '',
          tabBarIcon: ({color, size}) => (
            <Image source={require('../assets/Search.png')} />
          ),
        }}
      />
      <Tab.Screen
        name="Make Post"
        component={PostSelectScreen}
        options={{
          tabBarLabel: '',
          tabBarIcon: ({color, size}) => (
            <Image source={require('../assets/post.png')} />
          ),
        }}
      />
      <Tab.Screen
        name="Profile"
        component={ProfileScreen}
        options={{
          tabBarLabel: '',
          tabBarIcon: ({color, size}) => (
            <Image source={require('../assets/Main_Nav.png')} />
          ),
        }}
      />
    </Tab.Navigator>
  );
};

export default NavigatorTab;

const styles = StyleSheet.create({});

enter image description here



Solution 1:[1]

Use paddingTop:

....
tabBarOptions={{
    style: {
        height: ??, //optional
        paddingTop:??
    },
}}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Arvind K.