【发布时间】:2020-02-21 10:47:34
【问题描述】:
我刚开始用 react-native 开发一个应用程序并添加了底部导航。然后我开始为组件设置样式,并注意到导航上方有一条白线,我根本无法摆脱它。
问题的图片
任何关于如何使该线与背景颜色相同的想法将不胜感激。视图后面的默认背景颜色可能是“闪耀的”,因为它是白色的,我不知道如何更改它。该应用只能在我自己的 iPhone XR 上运行,所以我不担心与 android 或其他 iPhone 型号的兼容性
我是 react-native 的初学者,所以请耐心等待。 到目前为止,这是我的代码:
导航
const Tab = createBottomTabNavigator();
export default function App() {
return (
<NavigationContainer>
<Tab.Navigator
tabBarOptions={{
activeTintColor: Colors.tabIconSelected,
inactiveTintColor: Colors.tabIconDefault,
style: styles.container
}}>
<Tab.Screen
name="Payments"
component={PaymentScreen}
options={{
tabBarIcon: ({focused}) => <TabBarIcon focused={focused} name="logout"/>
}}/>
<Tab.Screen
name="Income"
component={IncomeScreen}
options={{
tabBarIcon: ({focused}) => <TabBarIcon focused={focused} name="login"/>
}}/>
</Tab.Navigator>
</NavigationContainer>
);
}
const styles = StyleSheet.create({
container: {
backgroundColor: Colors.darkBackgroundColor,
}
});
付款视图
export default class PaymentScreen extends Component{
render() {
return (
<View style={styles.container}>
<Text style={styles.text}>Payments!</Text>
</View>
)
}
}
const styles = StyleSheet.create({
container:{
flex: 1,
alignItems: 'center',
justifyContent: 'center',
backgroundColor: Colors.backgroundColor,
},
text:{
color: Colors.textColor
}
});
【问题讨论】:
-
我真的要问谢谢! :)
标签: ios react-native