mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-06 11:53:18 +00:00
[fix] StyleSheet: support for 'transform' and 'transformMatrix'
Fix #46
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import prefixAll from 'inline-style-prefix-all'
|
import prefixAll from 'inline-style-prefix-all'
|
||||||
import flattenStyle from './flattenStyle'
|
import flattenStyle from './flattenStyle'
|
||||||
|
import processTransform from './processTransform'
|
||||||
|
|
||||||
class StyleSheetRegistry {
|
class StyleSheetRegistry {
|
||||||
static registerStyle(style: Object, store): number {
|
static registerStyle(style: Object, store): number {
|
||||||
@@ -15,7 +16,7 @@ class StyleSheetRegistry {
|
|||||||
Object.freeze(style)
|
Object.freeze(style)
|
||||||
}
|
}
|
||||||
|
|
||||||
const normalizedStyle = flattenStyle(style)
|
const normalizedStyle = processTransform(flattenStyle(style))
|
||||||
Object.keys(normalizedStyle).forEach((prop) => {
|
Object.keys(normalizedStyle).forEach((prop) => {
|
||||||
// add each declaration to the store
|
// add each declaration to the store
|
||||||
store.set(prop, normalizedStyle[prop])
|
store.set(prop, normalizedStyle[prop])
|
||||||
@@ -26,7 +27,7 @@ class StyleSheetRegistry {
|
|||||||
let _className
|
let _className
|
||||||
let _style = {}
|
let _style = {}
|
||||||
const classList = []
|
const classList = []
|
||||||
const normalizedStyle = flattenStyle(style)
|
const normalizedStyle = processTransform(flattenStyle(style))
|
||||||
|
|
||||||
for (const prop in normalizedStyle) {
|
for (const prop in normalizedStyle) {
|
||||||
let styleClass = store.get(prop, normalizedStyle[prop])
|
let styleClass = store.get(prop, normalizedStyle[prop])
|
||||||
|
|||||||
@@ -38,7 +38,9 @@ const TransformPropTypes = {
|
|||||||
PropTypes.shape({ skewX: numberOrString }),
|
PropTypes.shape({ skewX: numberOrString }),
|
||||||
PropTypes.shape({ skewY: numberOrString }),
|
PropTypes.shape({ skewY: numberOrString }),
|
||||||
PropTypes.shape({ translateX: numberOrString }),
|
PropTypes.shape({ translateX: numberOrString }),
|
||||||
PropTypes.shape({ translateY: numberOrString })
|
PropTypes.shape({ translateY: numberOrString }),
|
||||||
|
PropTypes.shape({ translateZ: numberOrString }),
|
||||||
|
PropTypes.shape({ translate3d: PropTypes.string })
|
||||||
])
|
])
|
||||||
),
|
),
|
||||||
transformMatrix: TransformMatrixPropType
|
transformMatrix: TransformMatrixPropType
|
||||||
|
|||||||
Reference in New Issue
Block a user