Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Superscript Text in React Native

Tags:

react-native

I would like to style text as superscript in React Native. How would this be accomplished? Is there a way to make use of the Javascript sup() string method to return a string as superscript within a <Text> object?

like image 842
Steed-Asprey Avatar asked Aug 17 '16 17:08

Steed-Asprey


People also ask

How do you show a superscript in HTML?

The <sup> tag defines superscript text. Superscript text appears half a character above the normal line, and is sometimes rendered in a smaller font. Superscript text can be used for footnotes, like WWW. Tip: Use the <sub> tag to define subscript text.

What is subscript example?

Subscripts are often used to refer to members of a mathematical sequence or set or elements of a vector. For example, in the sequence O = (45, −2, 800), O3 refers to the third member of sequence O, which is 800.

How do you do subscript in HTML?

Subscript: The <sub> tag is used to add a subscript text to the HTML document. The <sub> tag defines the subscript text. Subscript text appears half a character below the normal line and is sometimes rendered in a smaller font.


1 Answers

I got this working for me using a view container and flex.

<View style={{flexDirection: 'row', alignItems: 'flex-start'}}>
    <Text style={{fontSize: 20, lineHeight: 30}}>10</Text>
    <Text style={{fontSize: 11, lineHeight: 18}}>am</Text>
</View>

Here is the link to this in action https://repl.it/Haap/0

Cheers!

like image 71
Jaspal Singh Avatar answered Oct 14 '22 15:10

Jaspal Singh