I want to rotate a Text
component with an angle of -90deg
. The component should be rotated from the left corner instead of middle. I am using below
This issue on GitHub has a solution.
If you're able to use an SVG, in your render method, you can do something like this:
const pointX = 25;
const pointY = 25;
The this.state.offset
is a hack for android which behaves differently. The onlayout to set that value looks like this.
onLayout = Platform.OS === 'android'
? e => { this.setState({ offset: e.nativeEvent.layout.width / 2 }) }
: null;
Note: using 25 as my x and y would rotate about the center.
The user who posted the solution included this fully-functional example