mirror of
https://github.com/zhigang1992/react-native-web.git
synced 2026-01-12 22:51:09 +08:00
[fix] support for Animated transform styles
Animated uses 'setNativeProps' to update styles. This mutates the DOM without using React. But the code path was not adding 'px' units to transform values and browsers were ignoring the style. Fix #129
This commit is contained in:
@@ -14,7 +14,7 @@ suite('apis/StyleSheet/processTransform', () => {
|
||||
|
||||
assert.deepEqual(
|
||||
processTransform(style),
|
||||
{ transform: 'scaleX(20) rotate(20deg)' }
|
||||
{ transform: 'scaleX(20px) rotate(20deg)' }
|
||||
)
|
||||
})
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import normalizeValue from './normalizeValue'
|
||||
|
||||
// { scale: 2 } => 'scale(2)'
|
||||
const mapTransform = (transform) => {
|
||||
var key = Object.keys(transform)[0]
|
||||
return `${key}(${transform[key]})`
|
||||
const type = Object.keys(transform)[0]
|
||||
const value = normalizeValue('transform', transform[type])
|
||||
return `${type}(${value})`
|
||||
}
|
||||
|
||||
// [1,2,3,4,5,6] => 'matrix3d(1,2,3,4,5,6)'
|
||||
|
||||
Reference in New Issue
Block a user