How can I make text vertical (rotated 90 deg) in react native?

React Native

React 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,
    

    }, enter image description here

Solution 5 - React Native

Try this for better positioning, especially fullscreen

const leftTransform = [
  { rotate: '90deg' },
  { translateY: (screenHeight - screenWidth) / 2 },
  { translateX: (screenHeight - screenWidth) / 3 },
];

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionDev01View Question on Stackoverflow
Solution 1 - React Natived-vineView Answer on Stackoverflow
Solution 2 - React NativeKamaljitView Answer on Stackoverflow
Solution 3 - React NativeSimon FoleyView Answer on Stackoverflow
Solution 4 - React NativeOmar bakhshView Answer on Stackoverflow
Solution 5 - React NativeNagibabaView Answer on Stackoverflow