2016-08-18 20 views

回答

13

这里的cheatsheet文件:

支持的样式包括每个组件的官方文档。下面是View链接和Text组件:

注意的地方说:视图样式道具...上的样式顶部文本,这意味着它也支持(大部分)View支持的样式。

+1

这并不总是存在的,如G。 [TouchableHighlight](https://facebook.github.io/react-native/docs/touchablehighlight.html#style)为空。 –

4

我已经从反应原生日志中提取了有效样式列表。

下面的集合帮助我在日常工作中很多。

[ 
    "alignContent", 
    "alignItems", 
    "alignSelf", 
    "aspectRatio", 
    "backfaceVisibility", 
    "backgroundColor", 
    "borderBottomColor", 
    "borderBottomLeftRadius", 
    "borderBottomRightRadius", 
    "borderBottomWidth", 
    "borderColor", 
    "borderLeftColor", 
    "borderLeftWidth", 
    "borderRadius", 
    "borderRightColor", 
    "borderRightWidth", 
    "borderStyle", 
    "borderTopColor", 
    "borderTopLeftRadius", 
    "borderTopRightRadius", 
    "borderTopWidth", 
    "borderWidth", 
    "bottom", 
    "color", 
    "decomposedMatrix", 
    "direction", 
    "display", 
    "elevation", 
    "flex", 
    "flexBasis", 
    "flexDirection", 
    "flexGrow", 
    "flexShrink", 
    "flexWrap", 
    "fontFamily", 
    "fontSize", 
    "fontStyle", 
    "fontVariant", 
    "fontWeight", 
    "height", 
    "includeFontPadding", 
    "justifyContent", 
    "left", 
    "letterSpacing", 
    "lineHeight", 
    "margin", 
    "marginBottom", 
    "marginHorizontal", 
    "marginLeft", 
    "marginRight", 
    "marginTop", 
    "marginVertical", 
    "maxHeight", 
    "maxWidth", 
    "minHeight", 
    "minWidth", 
    "opacity", 
    "overflow", 
    "overlayColor", 
    "padding", 
    "paddingBottom", 
    "paddingHorizontal", 
    "paddingLeft", 
    "paddingRight", 
    "paddingTop", 
    "paddingVertical", 
    "position", 
    "resizeMode", 
    "right", 
    "rotation", 
    "scaleX", 
    "scaleY", 
    "shadowColor", 
    "shadowOffset", 
    "shadowOpacity", 
    "shadowRadius", 
    "textAlign", 
    "textAlignVertical", 
    "textDecorationColor", 
    "textDecorationLine", 
    "textDecorationStyle", 
    "textShadowColor", 
    "textShadowOffset", 
    "textShadowRadius", 
    "tintColor", 
    "top", 
    "transform", 
    "transformMatrix", 
    "translateX", 
    "translateY", 
    "width", 
    "writingDirection", 
    "zIndex" 
] 

实现细节在这里: https://github.com/vhpoet/react-native-styling-cheat-sheet/blob/master/README.md

+0

-1;目前还不清楚这份清单是从哪里来的(所以我们甚至无法确信它是正确的),再加上没有迹象表明如何为未来版本进行更新,再加上这个答案有点误导新手,因为它没有注意到不同的样式规则适用于不同的组件。 –

+0

@MarkAmery正如我已经明确提到,我从日志中获得列表,每个人都可以找到这些有效的样式属性。 一套规则可以在这里找到: https://github.com/vhpoet/react-native-styling-cheat-sheet/blob/master/README.md – Ahsanwarsi

+0

*什么*日志?也许我错过了一些明显的东西,但我不知道你的意思。 –

相关问题