我正在遵循使用react-native-elements设置图标来创建CreateBottomTabNavigation的代码。
const AppStack = createBottomTabNavigator(
{
QrCode: { screen: QrCodeScreen },
Profile: { screen: ProfileScreen }
},
{
navigationOptions: ({navigation}) => ({
tabBarIcon: ({focused, horizontal, tinitColor}) => {
const { routeName } = navigation.state;
let iconName;
if (routeName == 'QrCode') {
iconName = 'qrcode-scan';
} else if (routeName == 'Profile') {
iconName = 'face';
}
if (!focused)
return <Icon type='ionicon' name={iconName} color='#517fa4'/>
else
return <Icon type='ionicon' reverse name={iconName} color='#517fa4'/>
// You can return any component that you like here! We usually use an
// icon component from react-native-vector-icons
}
}),
tabBarOptions: {
activeTintColor: 'tomato',
inactiveBackgroundColor: 'gray'
}
});
包装是否有问题。
答案 0 :(得分:0)
像
一样简单地将React导入文件顶部import React from 'react';
应该可以。