React Native-Native Base Footer不会改变颜色 [英] React Native - Native Base Footer not change color

查看:109
本文介绍了React Native-Native Base Footer不会改变颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是代码:

 // Bottom.js
<StyleProvider style={getTheme(commonColor)}>
    <Footer>
        <FooterTab>
            <Button active>
                <Icon active name="food" size={24}  />
                <Text active>Lunch Box</Text>
            </Button>
            <Button>
                <Icon name="coins" size={24} />
                <Text>Point</Text>
            </Button>
            <Button>
                <Icon name="face" size={24} />
                <Text>Profile</Text>
            </Button>
        </FooterTab>
    </Footer>

</StyleProvider>

// commonColor.js

// Footer
footerHeight: 55,
footerDefaultBg: '#ffffff',

// FooterTab
tabBarTextColor: '#FFF',
tabBarTextSize: platform === 'ios' ? 14 : 16,
activeTab: platform === 'ios' ? '#007aff' : '#fff',
sTabBarActiveTextColor: '#007aff',
tabBarActiveTextColor: '#fff',
tabActiveBgColor: platform === 'ios' ? '#1569f4' : '#1569f4',

结果如下:

我已经尝试直接编辑FooterTab.js,但没有任何改变.

I've tried edit FooterTab.js directly but no changed at all.

渲染上唯一可能发生的更改是 tabActiveBgColor:platform ==='ios'吗?'#1569f4':'#1569f4'.而且我什至不知道为什么只有此代码才起作用,我什至没有在 FooterTab 上设置任何 active .

The only changes that can happen on render is tabActiveBgColor: platform === 'ios' ? '#1569f4' : '#1569f4'. And I don't even know why only this code is working, I not even set any active on FooterTab.

我期望的是当我将按钮设置为活动状态并且文本变为白色时.

What I expected is when I set active the button and text become white.

有解决方案吗?

推荐答案

我已经解决了在 FooterTab 中添加样式的问题.您无需在本机基础 Footer中进行任何样式设置组件.这是我的源代码-

I have solved this issue for adding style in FooterTab.You do not need to do any styling in native base Footer component.Here is my source code-

     <Footer>
          <FooterTab style={{backgroundColor:"#FFF"}}>
              <Button style={{paddingLeft:0, paddingRight:0}}>
                  <Text}}>iFeeds</Text>
              </Button>
              <Button style={{paddingLeft:0, paddingRight:0}}>
                  <Text}}>iFeeds</Text>
              </Button>
          </FooterTab>
    <Footer>

这篇关于React Native-Native Base Footer不会改变颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆