所以我真的很想与本地和移动开发人员互动,我想更改底部标签栏导航的背景颜色,但是我似乎无法弄清楚该怎么做,因为我从一个带有导航功能的本机项目开始(在expo init阶段选择),因此编写方法是与我在网上看到的不同,我知道我需要添加
tabBarOptions: {
style: { backgroundColor: 'orange'}
}
但是老实说,如果有人可以帮助的话,不胜感激!这是我的代码:
import React from 'react';
import { Platform } from 'react-native';
import { createStackNavigator } from 'react-navigation-stack';
import { createBottomTabNavigator } from 'react-navigation-tabs';
import TabBarIcon from '../components/TabBarIcon';
import HomeScreen from '../screens/HomeScreen';
import LinksScreen from '../screens/LinksScreen';
import SettingsScreen from '../screens/SettingsScreen';
const config = Platform.select({
web: { headerMode: 'screen' },
default: {},
});
const HomeStack = createStackNavigator(
{
Home: HomeScreen,
},{
defaultNavigationOptions: {
headerTintColor: '#444',
headerStyle: {
backgroundColor: 'pink'
}
}
},
config
);
HomeStack.navigationOptions = {
tabBarLabel: 'Home',
tabBarIcon: ({ focused, tintColor }) => (
<TabBarIcon
focused={focused}
name={
Platform.OS === 'ios'
? `ios-information-circle${focused ? '' : '-outline'}`
: 'md-information-circle'
}
color= {"#cd077dr"}
/>
), style: {
backgroundColor: 'pink'
}
};
HomeStack.path = '';
const LinksStack = createStackNavigator(
{
Links: LinksScreen,
},{
defaultNavigationOptions: {
headerTintColor: '#444',
headerStyle: {
backgroundColor: 'pink'
}
}
},
config
);
LinksStack.navigationOptions = {
tabBarLabel: 'Links',
tabBarIcon: ({ focused }) => (
<TabBarIcon focused={focused} name={Platform.OS === 'ios' ? 'ios-link' : 'md-link'} />
)
};
LinksStack.path = '';
const SettingsStack = createStackNavigator(
{
Settings: SettingsScreen,
},{
defaultNavigationOptions: {
headerTintColor: '#444',
headerStyle: {
backgroundColor: 'pink'
},
tabBarOptions: {
style: { backgroundColor: 'orange'}
}
}
},
config
);
SettingsStack.navigationOptions = {
tabBarLabel: 'Settings',
tabBarIcon: ({ focused }) => (
<TabBarIcon focused={focused} name={Platform.OS === 'ios' ? 'ios-options' : 'md-options'} />
),
};
SettingsStack.path = '';
const tabNavigator = createBottomTabNavigator({
HomeStack,
LinksStack,
SettingsStack,
});
tabNavigator.path = '';
export default tabNavigator;
@ Zelda,请参阅此链接(react-native-tab-view git-hub问题)。
https://github.com/react-native-community/react-native-tab-view/issues/152