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
react-native-vector-icons
v6.0.0react-navigation
v3.11.0react-native
https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz"react-native-ui-kitten
v4.1.0Full 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
In case anybody faced this issue - here is an answer on Github