Skip to content

Text alignment ignored on Android #876

@AdamGerthel

Description

@AdamGerthel

UPDATE!: This bug only happens with the old arch. On the new arch, alignment works as expected. I also realized that it doesn't matter if there's strong/em etc. Alignment simply does not work on old arch, only on new arch.

Describe the bug

When using strong or similar decorations, the alignment stops working. It behaves differently depending on platform:

Android: If the markdown string starts with something like **Hello**, the text will always end up being left aligned, no matter what textAlign value is used, and no matter if it's used on only text or on all text element styles (strong etc.). Using textAlign: 'right' doesn't work at all, while textAlign: 'center' works as long as the string doesn't contain any other inline elements such as strong/em etc.

Web/iOS: The same alignment (textAlign) styling needs to applied to all types of text elements that exist in the markdown text. I'm guessing this is the intended behavior, but it doesn't work like this on Android.

To Reproduce

Apply center text alignment to a markdown string that contains text-styles such as bold, italic etc. The text will be left-aligned instead of centered.

Reproducible Code

See https://github.com/AdamGerthel/markdown-bug-android-centered.

Expected behavior

That the text respects the alignment.

Screenshots

Using { textAlign: 'center' }

Image

Using { textAlign: 'right' }

Image

Environment

  • React Native Version:
    0.79.2

  • react-native-marked Version:
    7.0.1-rc.0

  • Platform:
    Android

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions