【发布时间】:2016-06-09 15:50:06
【问题描述】:
我正在使用<TabBarIOS> 组件,我有自定义图标工作(使用react-native-vector-icons)但是我正在努力在<Icon.TabBarItemIOS> 组件上获得自定义fontFamily。我希望能够更改每个图标下方文本标签的字体。
我尝试将样式添加到标签栏和标签栏项目,但是它返回错误:
2016-06-09 17:45:52.449 [warn][tid:com.facebook.react.JavaScript] Warning: Failed propType: Invalid props.style key `fontFamily` supplied to `RCTTabBar`.
Bad object: {
"flex": 1,
"fontFamily": "Roboto-Regular"
}
Valid keys: [
"width",
"height",
"top",
"left",
"right",
"bottom",
"margin",
"marginVertical",
"marginHorizontal",
"marginTop",
"marginBottom",
"marginLeft",
"marginRight",
"padding",
"paddingVertical",
"paddingHorizontal",
"paddingTop",
"paddingBottom",
"paddingLeft",
"paddingRight",
"borderWidth",
"borderTopWidth",
"borderRightWidth",
"borderBottomWidth",
"borderLeftWidth",
"position",
"flexDirection",
"flexWrap",
"justifyContent",
"alignItems",
"alignSelf",
"flex",
"shadowColor",
"shadowOffset",
"shadowOpacity",
"shadowRadius",
"transform",
"transformMatrix",
"decomposedMatrix",
"scaleX",
"scaleY",
"rotation",
"translateX",
"translateY",
"backfaceVisibility",
"backgroundColor",
"borderColor",
"borderTopColor",
"borderRightColor",
"borderBottomColor",
"borderLeftColor",
"borderRadius",
"borderTopLeftRadius",
"borderTopRightRadius",
"borderBottomLeftRadius",
"borderBottomRightRadius",
"borderStyle",
"opacity",
"overflow",
"elevation"
] Check the render method of `TabBarIOS`.
我浏览了文档,但找不到关于该主题的任何内容,有什么想法吗?
【问题讨论】:
-
根据我的经验,TabBarIOS 在objective-c 之外不是很可定制。我最终使用了github.com/exponentjs/react-native-tab-navigator。
-
您能分享一下您是如何让 react-native-vector-icons 在 TabBarIOS 中工作的吗?
-
@SergeySinkovskiy,当然!它在他们的文档中:github.com/oblador/…
-
@BradBumbalough 错过了你的评论,但这就是我最终要做的。
标签: ios react-native font-family