反应导航变量标签宽度 [英] React-navigation variable tab width

查看:27
本文介绍了反应导航变量标签宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在哪里可以设置可变标签宽度而不是在 React 导航中固定?

Where can I set variable tab width rather than fixed in React navigation?

目前所有标签页宽度相同,需要将其包裹到文本宽度.

Currently all tabs are same width, need to wrap it to text width.

推荐答案

您可以使用导航选项中的 tabBarLabel 选项.使用 Text 元素上的 style 属性,您可以设置宽度.

You can use the tabBarLabel option in the navigationOptions. Using the style property on a Text element you can then set the width.

navigationOptions: {
  tabBarLabel: <Text style={{ textAlign: 'center', width: 200 }}>Long Tab Title</Text>
},

这篇关于反应导航变量标签宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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