iamacup / react-native-markdown-display

React Native 100% compatible CommonMark renderer
MIT License
607 stars 173 forks source link

textAlign: "center" not working on second paragraph #209

Open g-hamilton opened 9 months ago

g-hamilton commented 9 months ago

Given the following:

image

I would expect all text to centre align. However, in my Markdown editor, adding this:

image

Results in the component rendering this:

image

The second paragraph should be centre aligned shouldn't it?

PS. I have tried adding paragraph: {textAlign: "center"}to my Markdown styles but that didn't help.

Thanks

jtvargas commented 8 months ago

@g-hamilton Hi I was facing some issues trying to center some text too, and this is how I fixed:

<Markdown
  style={{
    body: {
      ...Typography.FontStyle.SUBHEADING,
      color: Colors.TextPlaceholder,
      includeFontPadding: false,
    },
    textgroup: {
      textAlign: 'center',
    },
    strong: {
      color: Colors.Text,
    },
  }}
>
  {children}
</Markdown>

I added the textgroup style property

g-hamilton commented 7 months ago

Thanks @jtvargas very helpful 👍🏻