Skip to content

Commit 442eb6c

Browse files
committed
feat(HTMLRenderers): add default renderer for <pre>
1 parent 46995de commit 442eb6c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/HTMLRenderers.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { TouchableOpacity, Text, View, WebView, Dimensions } from 'react-native';
2+
import { TouchableOpacity, Text, View, WebView, Platform } from 'react-native';
33
import { _constructStyles, _getElementClassStyles } from './HTMLStyles';
44
import HTMLImage from './HTMLImage';
55

@@ -144,6 +144,16 @@ export function iframe (htmlAttribs, children, convertedCSSStyles, passProps) {
144144
);
145145
}
146146

147+
export function pre (htlmAttribs, children, convertedCSSStyles, passProps) {
148+
return (
149+
<Text
150+
key={passProps.key}
151+
style={{ fontFamily: Platform.OS === 'android' ? 'monospace' : 'Menlo' }}>
152+
{ children }
153+
</Text>
154+
);
155+
}
156+
147157
export function br (htlmAttribs, children, convertedCSSStyles, passProps) {
148158
return (
149159
<Text

0 commit comments

Comments
 (0)