Skip to content

Commit 5b0f959

Browse files
authored
Merge pull request #203 from AndrewGable/andrew-fix-html
Fix HTML rendering issues
2 parents 3b2f957 + a4d6d23 commit 5b0f959

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

src/components/webView/index.native.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
import React from 'react';
66
import PropTypes from 'prop-types';
77
import HTML from 'react-native-render-html';
8-
import {View, Linking} from 'react-native';
9-
import styles, {webViewStyles} from '../../style/StyleSheet';
8+
import {Linking} from 'react-native';
9+
import {webViewStyles} from '../../style/StyleSheet';
1010

1111
const propTypes = {
1212
html: PropTypes.string,
@@ -16,14 +16,12 @@ const defaultProps = {
1616
};
1717

1818
const WebView = ({html}) => (
19-
<View style={[styles.flex1, styles.flexRow]}>
20-
<HTML
21-
baseFontStyle={webViewStyles.baseFontStyle}
22-
tagsStyles={webViewStyles.tagStyles}
23-
onLinkPress={(event, href) => Linking.openURL(href)}
24-
html={html}
25-
/>
26-
</View>
19+
<HTML
20+
baseFontStyle={webViewStyles.baseFontStyle}
21+
tagsStyles={webViewStyles.tagStyles}
22+
onLinkPress={(event, href) => Linking.openURL(href)}
23+
html={html}
24+
/>
2725
);
2826

2927
WebView.propTypes = propTypes;

src/page/HomePage/Report/ReportHistoryItemFragment.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import React from 'react';
2-
import {Text} from 'react-native';
32
import WebView from '../../../components/webView';
43
import Str from '../../../lib/Str';
54
import ReportHistoryFragmentPropTypes from './ReportHistoryFragmentPropTypes';
65
import styles from '../../../style/StyleSheet';
6+
import Text from '../../../components/Text'
77

88
const propTypes = {
99
// The message fragment needing to be displayed
@@ -13,7 +13,8 @@ const propTypes = {
1313
const ReportHistoryItemFragment = ({fragment}) => {
1414
switch (fragment.type) {
1515
case 'COMMENT':
16-
return fragment.html
16+
// Only render HTML if we have html in the fragment
17+
return fragment.html !== fragment.text
1718
? <WebView html={fragment.html} />
1819
: <Text>{Str.htmlDecode(fragment.text)}</Text>;
1920

src/page/HomePage/Report/ReportHistoryItemSingle.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@ class ReportHistoryItemSingle extends React.PureComponent {
4545
</View>
4646
</View>
4747
<View style={[styles.chatItemMessage]}>
48-
<Text>
49-
<ReportHistoryItemMessage historyItem={historyItem} />
50-
</Text>
48+
<ReportHistoryItemMessage historyItem={historyItem} />
5149
</View>
5250
</View>
5351
</View>

0 commit comments

Comments
 (0)