react-native - 指标未在 iOS 和 Android 上呈现
问题描述
我正在尝试在选项卡导航上呈现 topBar,但它没有显示
import { createBottomTabNavigator, createAppContainer } from "react-navigation";
const TabNavigator = createBottomTabNavigator(
{
Dashboard: {
screen: Dashboard,
navigationOptions: {
title: "Dashboard",
tabBarIcon: ({ tintColor }) => (
<Icon
name="home"
type="Entypo"
style={{
color: tintColor,
}}
color={tintColor}
/>
),
},
},
},
{
tabBarPosition: "top",
tabBarOptions: {
activeTintColor: "#5D10F6",
inactiveTintColor: "gray",
showIcon: true,
tintColor: "#333",
animationEnabled: false,
showLabel: false,
scrollEnabled: true,
tabBarPosition: "top",
indicatorStyle: {
backgroundColor: "red",
},
},
}
);
解决方案
注意:createTabNavigator 在 react-navigation@3.x 中被移除。请改用 createBottomTabNavigator 和/或 createMaterialTopTabNavigator。
但是createBottomTabNavigator
不再支持 indicatorStyle :(
推荐阅读
- google-sheets - 如何在列表的最后一项下方添加一行
- c - 如何使用 SIMD 计算字符出现次数
- typescript - Angular 6/typescript 日期时间戳文件
- asp.net-mvc - 如何在 ASP.NET MVC 中实现单点登录 (ADFS)
- django - 如何在使用多个 Django 应用程序时修复“ImportError”
- c# - C# WPF MVVM 切换视图
- excel - 在用户窗体文本框上执行 Change() 时如何保持光标位置?
- visual-studio-code - 如何在 vscode 中为 cppcheck 任务定义问题匹配器?
- x86 - Spectre (v2) 的内部工作原理
- ios - 用 3des 加密的密钥大小问题