css - 我无法对齐我的 reactnative 应用程序的标题
问题描述
我在打开vscode的simulator.app上进行反应性iOS模拟,看看几个小时后dat代码有什么问题,我尝试了10多个解决方案......仍然是同样的问题
我尝试在我的顶部栏中对齐“左”标题。就这么简单。
我正在开发一个新版本,我刚刚为该项目进行了初始化。
快速清晰: headerTitleAlign 在我的应用程序上不起作用。
目前我的代码是:
<Stack.Navigator screenOptions={{
headerStyle :{
backgroundColor : Colors.light.tint,
},
headerTintColor: Colors.light.background,
headerTitleStyle: {
fontWeight:'bold',
}
}}>
在这种情况下,我能找到的大部分解决方案是将我的 headerTitleAlign 设置为标题样式:
<Stack.Navigator screenOptions={{
**<!-- PUT MY CODE HERE -->**
headerStyle :{
backgroundColor : Colors.light.tint,
},
headerTintColor: Colors.light.background,
headerTitleStyle: {
fontWeight:'bold',
}
}}>
所以我做了 :
<Stack.Navigator screenOptions={{
alignHeaderTitle : 'left',
headerStyle :{
backgroundColor : Colors.light.tint,
},
headerTintColor: Colors.light.background,
headerTitleStyle: {
fontWeight:'bold',
}
}}>
但它不起作用。我的意思是,我的头衔是居中。我听说它是在 iOS 上默认设置的,我可以做些什么来修改它?
我的测试的某些部分:
<Stack.Navigator screenOptions={{
defaultNavigationOptions: {
headerTitleAlign: 'left'},
headerStyle :{
backgroundColor : Colors.light.tint,
},
headerTintColor: Colors.light.background,
headerTitleStyle: {
fontWeight:'bold',
}
}}>
<Stack.Navigator screenOptions={{
headerStyle :{
backgroundColor : Colors.light.tint,
},
headerTitleAlign: 'left',
headerTintColor: Colors.light.background,
headerTitleStyle: {
fontWeight:'bold',
}
}}>
<Stack.Navigator screenOptions={{headerTitleAlign: 'left',
headerStyle :{
backgroundColor : Colors.light.tint,
},
headerTintColor: Colors.light.background,
headerTitleStyle: {
fontWeight:'bold',
}
}}>
<Stack.Navigator screenOptions={{
title: "Title left",
headerTitleAlign:'left',
headerTitleStyle: {
textAlign:"left",
flex:1
},
headerStyle :{
backgroundColor : Colors.light.tint,
},
headerTintColor: Colors.light.background,
headerTitleStyle: {
fontWeight:'bold',
}
}}>
……等等等等
所以我猜它可能在这部分代码之外,也许它默认设置为 !important 直到新版本?
我在我的问题上尝试了同样的事情, <Stack.Screen name="Root"
但仍然是同样的问题。
这个问题来自该视频的开头:
https://www.youtube.com/watch?v=EvSUJ5lUcBw&t=1705s
非常感谢您的帮助兄弟们
解决方案
我想我找到了答案,React 导航在文档中说: 文档屏幕
有黑客吗?)) 它完全破坏了我的应用程序的用户界面:D
推荐阅读
- pandas - 如何在熊猫中移动日期时间的时间戳边界(使用历史数据)?
- python - gdal-python 中的 ReadAsArray 是否与 C-GDAL 中的 GDALRasterIO 相同?
- javascript - 使用上下文订阅停止子组件重新渲染
- sql - databricks/spark SQL 中的动态数据透视?
- c# - iText 7.1.8 无法读取某些 pdf 文件
- nearprotocol - init 方法中设置的字符串属性总是返回空字符串
- reactjs - 如何将西瓜数据库从 APP 本地反应到组件
- javascript - 角度接口对象属性未定义
- javascript - 如何将 Date.now() 的数据转换成 String 供用户使用 express
- reactjs - 你可能需要一个合适的加载器来处理这个文件类型,目前没有配置加载器来使用 React 和 Babel 处理这个文件