react-native-render-html icon indicating copy to clipboard operation
react-native-render-html copied to clipboard

Subscript elements should be bottom aligned

Open jamesovens opened this issue 7 years ago • 6 comments

Is this a bug report or a feature request?

Bug Report

Have you read the guidelines regarding bug report?

Yes

Have you read the documentation in its entirety?

Yes

Have you made sure that your issue hasn't already been reported/solved?

Yes

Is the bug specific to iOS or Android? Or can it be reproduced on both platforms?

Reproducible on all platforms

Is the bug reproductible in a production environment (not a debug one)?

Yes

Have you been able to reproduce the bug in the provided example?

Yes

Environment

The bug is environment independent

Steps to Reproduce

Attempt to render a subscript element e.g. <p>N<sub>2</sub></p>

Expected Behavior

You should see the text that is within the subscript element is vertically aligned to the bottom, e.g. it should look like:

N2

Actual Behavior

The text that is within the subscript element is vertically aligned to the top, e.g. it currently looks like:

N2

We can see that that <sub> elements are given vertical alignment to top here: https://github.com/archriss/react-native-render-html/blob/master/src/HTMLDefaultStyles.js#L47 when it just needs to be bottom.

jamesovens avatar Apr 24 '19 15:04 jamesovens

Hi

sup tag align text to bottom , sub is working fine now.

can you please help me with this ?

shift2androidios avatar Aug 08 '19 05:08 shift2androidios

Hey, sup or sub is not working for me. Were you able to do this with a custom renderer/styling?

muskanaul avatar Aug 13 '19 18:08 muskanaul

So I managed to use a custom renderer for both sub and sup and managed to set it so that sup received textAlignVertical: "top" and also display: "inline-block" for web but display: "flex" for native (as I'm working on a React Native Web project), and for sub it was textAlignVertical: "bottom"

Unfortunately textAlignVertical is an android only property, and not sure about what the plans are for it in the future for both Android and iOS.

jamesovens avatar Aug 20 '19 12:08 jamesovens

@jamesovens Can you share your code here?

jsamr avatar Jul 04 '20 21:07 jsamr

I'm closing in favor of #76. @jamesovens in response to what you suggested, see this commit message: 002b7fbc63731e7050dd3c64509383821b5cf0fd

jsamr avatar Jul 20 '20 20:07 jsamr

If you want this feature, upvote it here: https://react-native.canny.io/feature-requests/p/support-superscript-and-subscript

jsamr avatar Jul 20 '20 20:07 jsamr