0

I want to use MaterialCommunityIcons but icons don't show I search for the answer but I didn't find anything cool

import ...
import MaterialCommunityIcons from 'react-native-vector-

icons/MaterialCommunityIcons'
    
const Tab = createMaterialBottomTabNavigator();

export class main extends Component {
    componentDidMount(){
        this.props.fethchUser();
        this.props.fethchUserPosts();
    }
    render() {
        const {currentUser} =  this.props;
        console.log(currentUser)
        return (
            
            <Tab.Navigator tabBarOptions={{showIcon:true}} initialRouteName="خانه" barStyle={{ backgroundColor: '#0059b3' }}>
                <Tab.Screen name="خانه" component={HomeScreen} options={{tabBarIcon:({color,size})=>{
                    <MaterialCommunityIcons name="mdiAccountCircle " color={color} size={26}/>
                }}} />
                <Tab.Screen name="گفت و گو" component={Chat} options={{tabBarIcon:({color,size})=>{
                    <MaterialCommunityIcons name="home" color={color} size={26}/>
                }}} />
                <Tab.Screen name="افزودن" component={Addd} options={{tabBarIcon:({color,size})=>{
                    <MaterialCommunityIcons name="home" color={color} size={26}/>
                }}} />
                <Tab.Screen name="جست و جو" component={SearchSecreen} options={{tabBarIcon:({color,size})=>{
                    <MaterialCommunityIcons name="magnify" color={color} size={26}/>
                }}} />
                <Tab.Screen name="پروفایل" component={Profilecreen} options={{tabBarIcon:({color,size})=>{
                    <MaterialCommunityIcons name="home" color={color} size={26}/>
                }}} />
                
                
            </Tab.Navigator>
            
        )
        
    }
}
...

in line 27 I used it but it doesn't show anything to me please help me with it I am new at this

ali taher
  • 1
  • 1

1 Answers1

0

Try to use () instead of {} like this

  <Tab.Screen name="گفت و گو" component={Chat} options={{tabBarIcon:({color,size})=>(
            <MaterialCommunityIcons name="home" color={color} size={26}/>
            )}} />
Jagjeet Singh
  • 505
  • 3
  • 8