Skip to content

Commit 7bd0f14

Browse files
machourHoussein Djirdeh
authored andcommitted
fix: remove extra spaces from empty text nodes (#729)
1 parent 6599e19 commit 7bd0f14

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/components/github-htmlview.component.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,8 @@ export class GithubHtmlView extends Component {
300300
<Text
301301
style={linkStyle}
302302
onPress={() =>
303-
onLinkPress({ ...node, attribs: { href: node.attribs.src } })}
303+
onLinkPress({ ...node, attribs: { href: node.attribs.src } })
304+
}
304305
>
305306
[{node.attribs.alt}]
306307
{'\n'}
@@ -388,13 +389,13 @@ export class GithubHtmlView extends Component {
388389
};
389390

390391
if (_node.type === 'text') {
391-
if (_node.data === '\n') {
392+
if (_node.data.trim() === '' && _node.data.includes('\n')) {
392393
return (
393394
<Text
394395
key={_index}
395396
style={{ height: 8, fontSize: normalize(8), width: 2 }}
396397
>
397-
{_node.data}
398+
{'\n'}
398399
</Text>
399400
);
400401
}

0 commit comments

Comments
 (0)