Search code examples
react-nativetransform

In React Native, how can I flip a View horizontally?


Suppose I have an icon like this:

<FontAwesome
    name={'column'}
    size={20}
    style={ /* mirror horizontally */ }
/>

How can I mirror this horizontally?


Solution

  • React-native uses an array of transforms according to the docs, the scaleX prop has been deprecated. You can scale transform on the x-axis by the inverse:

    style={{
      transform: [
        { scaleX: -1 }
      ]
    }}