mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-02 02:25:22 +00:00
@@ -100,6 +100,7 @@ from `style`.
|
|||||||
+ `boxShadow`
|
+ `boxShadow`
|
||||||
+ `boxSizing`
|
+ `boxSizing`
|
||||||
+ `cursor`
|
+ `cursor`
|
||||||
|
+ `flex` (number)
|
||||||
+ `flexBasis`
|
+ `flexBasis`
|
||||||
+ `flexDirection`
|
+ `flexDirection`
|
||||||
+ `flexGrow`
|
+ `flexGrow`
|
||||||
@@ -108,7 +109,7 @@ from `style`.
|
|||||||
+ `height`
|
+ `height`
|
||||||
+ `justifyContent`
|
+ `justifyContent`
|
||||||
+ `left`
|
+ `left`
|
||||||
+ `margin`
|
+ `margin` (single value)
|
||||||
+ `marginBottom`
|
+ `marginBottom`
|
||||||
+ `marginHorizontal`
|
+ `marginHorizontal`
|
||||||
+ `marginLeft`
|
+ `marginLeft`
|
||||||
@@ -124,7 +125,7 @@ from `style`.
|
|||||||
+ `overflow`
|
+ `overflow`
|
||||||
+ `overflowX`
|
+ `overflowX`
|
||||||
+ `overflowY`
|
+ `overflowY`
|
||||||
+ `padding`
|
+ `padding` (single value)
|
||||||
+ `paddingBottom`
|
+ `paddingBottom`
|
||||||
+ `paddingHorizontal`
|
+ `paddingHorizontal`
|
||||||
+ `paddingLeft`
|
+ `paddingLeft`
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export default {
|
|||||||
'boxShadow',
|
'boxShadow',
|
||||||
'boxSizing',
|
'boxSizing',
|
||||||
'cursor',
|
'cursor',
|
||||||
|
'flex',
|
||||||
'flexBasis',
|
'flexBasis',
|
||||||
'flexDirection',
|
'flexDirection',
|
||||||
'flexGrow',
|
'flexGrow',
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ export default {
|
|||||||
cursor: string,
|
cursor: string,
|
||||||
display: string,
|
display: string,
|
||||||
direction: string, /* @private */
|
direction: string, /* @private */
|
||||||
flex: string, /* @private */
|
flex: number,
|
||||||
flexBasis: string,
|
flexBasis: string,
|
||||||
flexDirection: string,
|
flexDirection: string,
|
||||||
flexGrow: numberOrString,
|
flexGrow: number,
|
||||||
flexShrink: numberOrString,
|
flexShrink: number,
|
||||||
flexWrap: string,
|
flexWrap: string,
|
||||||
float: string,
|
float: string,
|
||||||
font: string, /* @private */
|
font: string, /* @private */
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import assert from 'assert'
|
|||||||
import expandStyle from '../expandStyle'
|
import expandStyle from '../expandStyle'
|
||||||
|
|
||||||
suite('modules/StyleSheet/expandStyle', () => {
|
suite('modules/StyleSheet/expandStyle', () => {
|
||||||
test('style property', () => {
|
test('style resolution', () => {
|
||||||
const initial = {
|
const initial = {
|
||||||
borderTopWidth: 1,
|
borderTopWidth: 1,
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
@@ -13,7 +13,7 @@ suite('modules/StyleSheet/expandStyle', () => {
|
|||||||
margin: 10
|
margin: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
const expectedStyle = {
|
const expected = {
|
||||||
borderTopWidth: 1,
|
borderTopWidth: 1,
|
||||||
borderLeftWidth: 2,
|
borderLeftWidth: 2,
|
||||||
borderRightWidth: 2,
|
borderRightWidth: 2,
|
||||||
@@ -24,6 +24,22 @@ suite('modules/StyleSheet/expandStyle', () => {
|
|||||||
marginRight: 10
|
marginRight: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.deepEqual(expandStyle(initial), expectedStyle)
|
assert.deepEqual(expandStyle(initial), expected)
|
||||||
|
})
|
||||||
|
|
||||||
|
test('flex', () => {
|
||||||
|
const value = 10
|
||||||
|
|
||||||
|
const initial = {
|
||||||
|
flex: value
|
||||||
|
}
|
||||||
|
|
||||||
|
const expected = {
|
||||||
|
flexGrow: value,
|
||||||
|
flexShrink: 1,
|
||||||
|
flexBasis: 'auto'
|
||||||
|
}
|
||||||
|
|
||||||
|
assert.deepEqual(expandStyle(initial), expected)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ const expandStyle = (style) => {
|
|||||||
expandedProps.forEach((prop, i) => {
|
expandedProps.forEach((prop, i) => {
|
||||||
resolvedStyle[expandedProps[i]] = value
|
resolvedStyle[expandedProps[i]] = value
|
||||||
})
|
})
|
||||||
|
} else if (key === 'flex') {
|
||||||
|
resolvedStyle.flexGrow = value
|
||||||
|
resolvedStyle.flexShrink = 1
|
||||||
|
resolvedStyle.flexBasis = 'auto'
|
||||||
} else {
|
} else {
|
||||||
resolvedStyle[key] = value
|
resolvedStyle[key] = value
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user