我正在尝试在材料社区图标中使用店面图标。但是我收到一个错误,它不显示图标。这是我的代码:
import { StatusBar } from "expo-status-bar";
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { createMaterialBottomTabNavigator } from "@react-navigation/material-bottom-tabs";
import { NavigationContainer } from "@react-navigation/native";
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
import Products from "./src/components/Products";
import Cart from "./src/components/Cart";
import Account from "./src/components/Account";
const Tab = createMaterialBottomTabNavigator();
export default class App extends React.Component {
render() {
return (
<NavigationContainer>
<Tab.Navigator
initialRouteName="Browse"
activeColor="#f0edf6"
inactiveColor="#A3A3A3"
barStyle={{ backgroundColor: "#515151" }}
>
<Tab.Screen
name="Browse"
component={Products}
options={{
tabBarLabel: "Browse",
tabBarIcon: ({ color }) => (
<Icon name="storefront-outline" color={color} size={26} />
),
}}
/>
<Tab.Screen name="Cart" component={Cart} />
<Tab.Screen name="My Account" component={Account} />
</Tab.Navigator>
</NavigationContainer>
);
}
}
我已经安装了 Ionic 的矢量图标库和其他图标,例如工作。
编辑:
我想我需要将 react-native 链接到 react-native-vector-icons 但我收到一条错误消息The term 'react-native' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
编辑2:我认为这只是一些我无法访问的材料社区图标,包括“店面大纲”和“店面”。也许它们已被弃用但在您搜索商店时仍然存在?感谢大家的帮助,但我将只为我的情况使用一个替代图标,因为我已经浏览了矢量图标文档中的所有内容。