React Native Transform Origin

前端 未结 2 1706
后悔当初
后悔当初 2021-01-17 11:11

how do I apply the transform-origin property to a style in react native? I\'ve tried in several ways, but I did not get an event

I tried:



        
2条回答
  •  花落未央
    2021-01-17 11:26

    I have made a lib to achieve transform-origin. react-native-anchor-point

    easy to use

    import { withAnchorPoint } from 'react-native-anchor-point';
    
    getTransform = () => {
        let transform = {
            transform: [{ perspective: 400 }, { rotateX: rotateValue }],
        };
        return withAnchorPoint(transform, { x: 0, y: 0.5 }, { width: CARD_WIDTH, height: CARD_HEIGHT });
    };
    
    
    

提交回复
热议问题