如何将 tabBarOption 添加到下面的代码中?这样我就可以使用 tintColor
Posted
技术标签:
【中文标题】如何将 tabBarOption 添加到下面的代码中?这样我就可以使用 tintColor【英文标题】:How can I add tabBarOption to the code bellow? so that I can use tintColor 【发布时间】:2020-01-15 23:50:14 【问题描述】:如何在下面的代码中添加选项卡栏选项并同时使用色调颜色。 我想对标签栏选项内的图标使用活动和非活动
import React from 'react'
import SafeAreaView, Text from 'react-native';
export default class Chat extends React.Component
static navigationOptions = ( navigation ) =>
let tabBarIcon = () =>
return <MaterialIcons
style= backgroundColor: 'transparent'
name='chat'
color='#000'
size=30
/>
return tabBarIcon
render()
return(
<SafeAreaView>
<Text>Chat</Text>
</SafeAreaView>
)
【问题讨论】:
【参考方案1】:如官方site 中所述。 tabBarIcon 是一个函数,它被赋予焦点状态、tintColor 和水平参数,它是一个布尔值。
试试这个
static navigationOptions = ( navigation ) =>
let tabBarIcon = ( focused, horizontal, tintColor ) =>
return <MaterialIcons
style= backgroundColor: 'transparent'
name='chat'
color=tintColor
size=30
/>
return tabBarIcon
【讨论】:
以上是关于如何将 tabBarOption 添加到下面的代码中?这样我就可以使用 tintColor的主要内容,如果未能解决你的问题,请参考以下文章
如何将前 2 个 hive 表中的数据加载到下面的第三个表中?