【发布时间】:2017-11-19 09:47:07
【问题描述】:
我正在使用 react-native 和 react-navigation。
我想隐藏状态栏。但它要么保持可见,要么不像我试图隐藏它的方式那样工作。
第一次尝试会导致完全白屏。好像导航器甚至没有加载。 第二次尝试同样的事情。 最后一次尝试正在工作,我有我想要的,但显示状态栏。我想把它隐藏起来。
我在网上找到的示例使用与我第二次尝试相同的语法。我不明白为什么我的不工作..
import React from 'react';
import { StyleSheet, StatusBar, View } from 'react-native';
import { TabNavigator } from 'react-navigation';
import PageLecture from './js/PageLecture';
import PageSalat from './js/PageSalat';
import PageHadiths from './js/PageHadiths';
import PageParametres from './js/PageParametres';
export default class App extends React.Component {
render() {
// This is not working
// return (
// <View>
// <View>
// <StatusBar hidden={true}/>
// </View>
//
// <ReactCoran />
// </View>
// );
// This is not working
// return (
// <View>
// <StatusBar hidden={true}/>
// <ReactCoran />
// </View>
// );
// This is working but status bar is displayed
return (
<ReactCoran />
);
}
}
const ReactCoran = TabNavigator({
Lecture: {
screen: PageLecture,
},
Salat: {
screen: PageSalat,
},
Hadith: {
screen: PageHadiths,
},
Parametres: {
screen: PageParametres,
}
},
{
tabBarPosition: 'bottom',
animationEnabled: false,
tabBarOptions: {
allowFontScaling: true,
activeTintColor: '#000000',
showIcon: true,
showLabel: false,
activeBackgroundColor: '#ff0000',
style: {
backgroundColor: '#aa0000',
},
indicatorStyle: {
height:2,
backgroundColor: '#ffffff',
}
},
});
谢谢
【问题讨论】:
标签: react-native react-navigation