okwasniewski / react-native-bottom-tabs

Native Bottom Tabs for React Native
https://www.npmjs.com/package/react-native-bottom-tabs
MIT License
284 stars 9 forks source link

ReactNode icons not supported, even though types specify you should use them #27

Closed fredrikburmester closed 5 days ago

fredrikburmester commented 5 days ago

Using a ReactNode as icon gives me this error:

simulator_screenshot_EE21B19E-6E29-4BF0-8D51-952AD66CF549

Screenshot 2024-10-09 at 19 58 40

Here's my code:

<NativeTabs.Screen
        name="(home)"
        options={{
          title: "Home",
          tabBarIcon: ({ focused, color, size }) => (
            <Ionicons name="home" size={size} color={color} />
          ),
        }}
      />
okwasniewski commented 5 days ago

Hey!

Thanks for opening the issue.

I've looked at your PR: https://github.com/fredrikburmester/streamyfin/pull/166/files

It looks like you are importing BottomTabNavigationOptions

import { BottomTabNavigationOptions } from "@react-navigation/bottom-tabs"; 

You should import

import { NativeBottomTabNavigationOptions } from "react-native-bottom-tabs/react-navigation"

This will give you correct typings. You can't pass ReactNode for the icon.

If you want to use react-native-vector-icons you can use getImageSourceSync from react-native-vector-icons:

import Icon from 'react-native-vector-icons/Ionicons';

const navIcon = Icon.getImageSourceSync('md-arrow-back', 24, 'white');
fredrikburmester commented 5 days ago

Ah, thank you for the amazing support!