我正在尝试使用react-native-elements
中的图标向我的bottomTabNavigator添加图标。
import { createBottomTabNavigator } from "react-navigation"
import { ServicesNavigator } from "./services-navigator"
import { AccountScreen } from "../screens/account-screen/account-screen"
import { Icon } from "react-native-elements"
export const BottomTabNavigator = createBottomTabNavigator({
services: {
screen: ServicesNavigator,
navigationOptions: {
tabBarLabel:"Services",
tabBarIcon: ({ tintColor }) => (
<Icon name="ios-build" type="Ionicon" size={10} />
)
},
},
account: { screen: AccountScreen },
})
上面的代码在ios中显示以下错误:Unexpected token, expected "</>/<=/>="
所在的行周围的<Icon>
。
我尝试过在线查找,但似乎无法解决问题。任何帮助将不胜感激!
答案 0 :(得分:0)
这些设置不应位于RouteConfigs中。学习https://reactnavigation.org/docs/en/tab-based-navigation.html#customizing-the-appearance后,您应该做更多的事
hyperkit vm
答案 1 :(得分:0)
我终于找到了问题。一直以来,我文件的扩展名是.ts
,而不是.tsx
,它不支持jsx。将文件扩展名更改为.tsx
对我有用。