[fix] Text: style props

This commit is contained in:
Nicolas Gallagher
2015-12-19 03:57:04 -08:00
parent 4191d58694
commit 25b74d30c4
4 changed files with 18 additions and 12 deletions

View File

@@ -55,7 +55,6 @@ This function is called on press.
+ `backgroundColor`
+ `color`
+ `direction`
+ `fontFamily`
+ `fontSize`
+ `fontStyle`
@@ -69,6 +68,7 @@ This function is called on press.
+ `textTransform`
+ `whiteSpace`
+ `wordWrap`
+ `writingDirection`
**testID**: string
@@ -102,16 +102,16 @@ class PrettyText extends Component {
...other
style={{
...style,
...localStyle.color[color],
...localStyle.size[size],
...localStyle.weight[weight]
...styles.color[color],
...styles.size[size],
...styles.weight[weight]
}}
/>
);
}
}
const localStyle = StyleSheet.create({
const styles = StyleSheet.create({
color: {
white: { color: 'white' },
gray: { color: 'gray' },

View File

@@ -5,10 +5,9 @@ export default {
...pickProps(CoreComponent.stylePropTypes, [
'backgroundColor',
'color',
'direction',
'font',
'fontFamily',
'fontSize',
'fontStyle',
'fontWeight',
'letterSpacing',
'lineHeight',
@@ -30,6 +29,7 @@ export default {
'textDecoration',
'textTransform',
'whiteSpace',
'wordWrap'
'wordWrap',
'writingDirection'
])
}

View File

@@ -3,6 +3,10 @@ import { PropTypes } from 'react'
const { number, string } = PropTypes
const numberOrString = PropTypes.oneOfType([ number, string ])
/**
* Any properties marked @private are used internally in resets or property
* mappings.
*/
export default {
alignContent: string,
alignItems: string,
@@ -43,16 +47,16 @@ export default {
clear: string,
color: string,
cursor: string,
direction: string,
display: string,
flex: string,
direction: string, /* @private */
flex: string, /* @private */
flexBasis: string,
flexDirection: string,
flexGrow: numberOrString,
flexShrink: numberOrString,
flexWrap: string,
float: string,
font: string,
font: string, /* @private */
fontFamily: string,
fontSize: numberOrString,
fontStyle: string,
@@ -99,5 +103,6 @@ export default {
whiteSpace: string,
width: numberOrString,
wordWrap: string,
writingDirection: string,
zIndex: numberOrString
}

View File

@@ -8,7 +8,8 @@ const styleShortHands = {
marginVertical: [ 'marginTop', 'marginBottom' ],
padding: [ 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft' ],
paddingHorizontal: [ 'paddingRight', 'paddingLeft' ],
paddingVertical: [ 'paddingTop', 'paddingBottom' ]
paddingVertical: [ 'paddingTop', 'paddingBottom' ],
writingDirection: [ 'direction' ]
}
/**