Skip to content

Commit edc30cd

Browse files
committed
passthrough styles to root element
1 parent 1ff6ea3 commit edc30cd

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

HTMLView.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,16 @@ class HtmlView extends Component {
7676

7777
render() {
7878
if (this.state.element) {
79-
return <View children={this.state.element} />;
79+
return <View children={this.state.element} styles={this.props.styles} />;
8080
}
81-
return <View />;
81+
return <View styles={this.props.styles} />;
8282
}
8383
}
8484

8585
HtmlView.propTypes = {
8686
value: PropTypes.string,
8787
stylesheet: PropTypes.object,
88+
styles: PropTypes.object,
8889
onLinkPress: PropTypes.func,
8990
onError: PropTypes.func,
9091
renderNode: PropTypes.func,

__tests__/__snapshots__/HTMLView-test.js.snap

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`<HTMLView/> can use a custom renderer 1`] = `
4-
<View>
4+
<View
5+
styles={undefined}
6+
>
57
<Text
68
accessible={true}
79
allowFontScaling={true}
@@ -45,7 +47,9 @@ exports[`<HTMLView/> can use a custom renderer 1`] = `
4547
`;
4648

4749
exports[`<HTMLView/> should render an <Image /> with set width/height 1`] = `
48-
<View>
50+
<View
51+
styles={undefined}
52+
>
4953
<Image
5054
source={
5155
Object {
@@ -66,7 +70,9 @@ exports[`<HTMLView/> should render an <Image /> with set width/height 1`] = `
6670
`;
6771

6872
exports[`<HTMLView/> should render an <Image />, with default width/height of 1 1`] = `
69-
<View>
73+
<View
74+
styles={undefined}
75+
>
7076
<Image
7177
source={
7278
Object {
@@ -87,7 +93,9 @@ exports[`<HTMLView/> should render an <Image />, with default width/height of 1
8793
`;
8894

8995
exports[`<HTMLView/> should render an empty <Text/> element 1`] = `
90-
<View>
96+
<View
97+
styles={undefined}
98+
>
9199
<Text
92100
accessible={true}
93101
allowFontScaling={true}
@@ -119,7 +127,9 @@ exports[`<HTMLView/> should render an empty <Text/> element 1`] = `
119127
`;
120128

121129
exports[`<HTMLView/> should render shoddy html including headings, links, bold, italic 1`] = `
122-
<View>
130+
<View
131+
styles={undefined}
132+
>
123133
<Text
124134
accessible={true}
125135
allowFontScaling={true}
@@ -340,7 +350,9 @@ exports[`<HTMLView/> should render shoddy html including headings, links, bold,
340350
`;
341351

342352
exports[`<HTMLView/> should render text in a (nested) <Text/> element 1`] = `
343-
<View>
353+
<View
354+
styles={undefined}
355+
>
344356
<Text
345357
accessible={true}
346358
allowFontScaling={true}

example/__tests__/__snapshots__/Example-test.js.snap

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ exports[`<Example/> should render 1`] = `
1010
}
1111
>
1212
<View>
13-
<View>
13+
<View
14+
styles={undefined}
15+
>
1416
<Text
1517
accessible={true}
1618
allowFontScaling={true}

0 commit comments

Comments
 (0)