File tree 3 files changed +12
-15
lines changed
3 files changed +12
-15
lines changed Original file line number Diff line number Diff line change 5
5
import React from 'react' ;
6
6
import PropTypes from 'prop-types' ;
7
7
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' ;
10
10
11
11
const propTypes = {
12
12
html : PropTypes . string ,
@@ -16,14 +16,12 @@ const defaultProps = {
16
16
} ;
17
17
18
18
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
+ />
27
25
) ;
28
26
29
27
WebView . propTypes = propTypes ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import { Text } from 'react-native' ;
3
2
import WebView from '../../../components/webView' ;
4
3
import Str from '../../../lib/Str' ;
5
4
import ReportHistoryFragmentPropTypes from './ReportHistoryFragmentPropTypes' ;
6
5
import styles from '../../../style/StyleSheet' ;
6
+ import Text from '../../../components/Text'
7
7
8
8
const propTypes = {
9
9
// The message fragment needing to be displayed
@@ -13,7 +13,8 @@ const propTypes = {
13
13
const ReportHistoryItemFragment = ( { fragment} ) => {
14
14
switch ( fragment . type ) {
15
15
case 'COMMENT' :
16
- return fragment . html
16
+ // Only render HTML if we have html in the fragment
17
+ return fragment . html !== fragment . text
17
18
? < WebView html = { fragment . html } />
18
19
: < Text > { Str . htmlDecode ( fragment . text ) } </ Text > ;
19
20
Original file line number Diff line number Diff line change @@ -45,9 +45,7 @@ class ReportHistoryItemSingle extends React.PureComponent {
45
45
</ View >
46
46
</ View >
47
47
< View style = { [ styles . chatItemMessage ] } >
48
- < Text >
49
- < ReportHistoryItemMessage historyItem = { historyItem } />
50
- </ Text >
48
+ < ReportHistoryItemMessage historyItem = { historyItem } />
51
49
</ View >
52
50
</ View >
53
51
</ View >
You can’t perform that action at this time.
0 commit comments