How can I make text vertical (rotated 90 deg) in react native?
React NativeReact Native Problem Overview
How can I make <Text />
vertical (rotated 90 deg) in react native? I want to have some text on the right side of the page along the edge of the screen.
React Native Solutions
Solution 1 - React Native
You can use a transformation.
https://facebook.github.io/react-native/docs/transforms.html#proptypes
myStyle: {
transform: [{ rotate: '90deg'}]
}
Solution 2 - React Native
In style, use transform to rotate and element
style={{transform: [{ rotate: '180deg' }]}}
E.g.:
<View style={{transform: [{ rotate: '180deg' }]}} />
Solution 3 - React Native
For anyone using Material-UI Typography with makeStyles(), this should work :
myClassName: {
transform: "rotate(90deg)"
},
Solution 4 - React Native
creat view
<View style={styles.arrow_1_6} ></View>
add in style transform: [{ rotate: '14deg' }], if you make view position absolute it will not affect another view!
-
the rotate start from 0 to 360 deg .
arrow_1_6: { transform: [{ rotate: '14deg' }], width: 260, marginTop: 145, position: 'absolute', marginLeft: 75, backgroundColor: 'orange', height: 4, flexDirection: "row", padding: 0, alignItems: 'center', justifyContent: 'flex-start', borderBottomColor: '#075fff', borderBottomWidth: 4,
Solution 5 - React Native
Try this for better positioning, especially fullscreen
const leftTransform = [
{ rotate: '90deg' },
{ translateY: (screenHeight - screenWidth) / 2 },
{ translateX: (screenHeight - screenWidth) / 3 },
];