我想使用MaterialCommunityIcons,但图标没有显示我在搜索答案,但我没有找到任何很酷的东西
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>
)
}
}
...在第27行,我使用了它,但它没有向我显示任何东西,请帮助我,我是新手
发布于 2021-02-08 15:04:08
尝试使用()而不是{},如下所示
<Tab.Screen name="گفت و گو" component={Chat} options={{tabBarIcon:({color,size})=>(
<MaterialCommunityIcons name="home" color={color} size={26}/>
)}} />https://stackoverflow.com/questions/66096899
复制相似问题