提问人:24ycarasco 提问时间:11/15/2023 更新时间:11/15/2023 访问量:37
如何摆脱我的 react native 应用程序上显示的默认“索引”标头
How do I get rid of the default "index" Header that shows up on my react native app
问:
这是我拥有的代码:
`import React from 'react'
import { View, Text, StyleSheet, StatusBar } from 'react-native';
export default function App() {
return(
<View style={styles.container}>
<Text style={styles.headerText}>This is the header text</Text>
<Text>Hello World</Text>
<Text>Is this under? Yes it is</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "dodgerblue",
alignItems: 'center',
justifyContent: 'center',
},
headerText: {
fontSize: 20,
fontWeight: 'bold',
marginBottom: 10,
},
});`
我试图隐藏标题并使其为 false,已经使用堆栈导航,但这不起作用。我还尝试了顶栏方法。这是它的样子,
答:
0赞
Ahmed Sbai
11/15/2023
#1
你创建了一个导航器吗? 如果是,请转到导航器 screenOptions 并添加 headerShown: false 如果它不起作用,您可以发布导航器的屏幕截图吗?
评论
0赞
24ycarasco
11/15/2023
我删除了导航器,认为它不起作用,我走在正确的轨道上吗?你能告诉我如何以正确的方式重新创建它吗?在我删除导航器之前,我之前在我的_layout.js上安装了它。
0赞
Ahmed Sbai
11/17/2023
如果您愿意,我们可以一起查看,请上传您的代码照片,如果您愿意,我会做出相应的回应。
评论