首页 > 解决方案 > Text with textAlign:justify has weird space at the end

问题描述

I have a Text component with a lot of text inside. I want to set textAlign: "justify" to the content but a weird space is added after the component. I'm sure no styles are applied to add the space in my code.

enter image description here

It happens on both IOS and Android, but the space is too big in Android.

Snack working example

标签: react-native

解决方案


您只需要删除textAlign: 'justify',段落样式,它仍然可以使用相同的样式并且没有错误。

您可以使用以下内容:

<WebView
    source={{ html: "<p style='text-align: justify;'>Justified text here</p>" }}
/>

推荐阅读