1
votes

In a basic react-native app with bottom navigation tabs,

<BottomNavigationTab title='Baz' icon={() => <Icon name='line-chart' size={20} color='#000' />} />

shows the error message

Warning: Failed prop type: Invalid props.style key `tintColor` supplied to `ForwardRef(Text)`.

However if we were to remove Icon element, then

<BottomNavigationTab title='Baz />

works fine.

Question: What is causing this and how can we fix it?

Using

Full Code

import React from 'react';
import { createBottomTabNavigator, createStackNavigator, createSwitchNavigator, createAppContainer } from 'react-navigation';
import { BottomNavigation, BottomNavigationTab, BottomNavigationProps, Avatar } from 'react-native-ui-kitten';
import Icon from 'react-native-vector-icons/FontAwesome';

import ProfitScreen from '../screens/Profit';

class BottomNavigationShowcase extends React.Component {
    state = {
        selectedIndex: 0,
    };

    onTabSelect = (selectedIndex) => {
        this.setState({ selectedIndex });
    };

    render () {
        return (
            <BottomNavigation
                selectedIndex={this.state.selectedIndex}
                onSelect={this.onTabSelect}
            >
                <BottomNavigationTab title='Baz' icon={() => <Icon name='line-chart' size={20} color='#000' />} />
            </BottomNavigation>
        );
    }
}

const FooStack = createStackNavigator({
    Bar: BarScreen
})

const TabNavigator = createBottomTabNavigator(
    {
        Foo: FooStack,
    }, {
        initialRouteName: 'Foo',
        tabBarComponent: BottomNavigationShowcase
    }
)

const RootNavigator = createSwitchNavigator({
    Main: TabNavigator,
}, {
    initialRoute: "Main"
})

const AppContainer = createAppContainer(RootNavigator);

export default AppContainer 
1

1 Answers

2
votes

In case anybody faced this issue - here is an answer on Github