Skip to content
This repository was archived by the owner on Jul 15, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ containerStyle | Style the container wrapping the webview | View style object |
HTMLStyles | CSS style to be injected | `string` |
defaultHeight | Webview's height before it's updated | `number` | 100
additionalHeight | Add some height to the webview once it's calculated | `number` | 0
bodyClass | Add some height to the webview once it's calculated | `string` | `''`
bodyClass | Add some styles to body | `string` | `''`
contentContainerClass | Add some styles to content container (which is a wrapper for content inside of body) | `string` | `''`

## Tips and tricks

Expand Down
12 changes: 8 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ export default class DisplayHTML extends Component {
HTMLStyles: PropTypes.string,
defaultHeight: PropTypes.number,
additionalHeight: PropTypes.number,
bodyClass: PropTypes.string
bodyClass: PropTypes.string,
contentContainerClass: PropTypes.string
};
};

Expand All @@ -27,7 +28,8 @@ export default class DisplayHTML extends Component {
additionalHeight: 0,
containerStyle: {},
style: {},
bodyClass: ''
bodyClass: '',
contentContainerClass: ''
};

constructor (props) {
Expand All @@ -50,7 +52,9 @@ export default class DisplayHTML extends Component {
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<html>${this.HTMLStyles}
<body class="${this.props.bodyClass}">
${this.props.htmlString}
<div style="width: 100%; height: 100%" id="contentContainer" class="${this.props.contentContainerClass}">
${this.props.htmlString}
</div>
</body>
</html>`;
}
Expand Down Expand Up @@ -81,7 +85,7 @@ export default class DisplayHTML extends Component {
*/
heightScript () {
function updateHeight () {
var B = document.body;
var B = document.getElementById("contentContainer");
var height;
if (typeof document.height !== 'undefined') {
height = document.height;
Expand Down