|
1 | 1 | import React from 'react';
|
2 | 2 | import { TouchableOpacity, Text, View, WebView, Dimensions } from 'react-native';
|
3 |
| -import { _constructStyles } from './HTMLStyles'; |
| 3 | +import { _constructStyles, _getElementClassStyles } from './HTMLStyles'; |
4 | 4 | import HTMLImage from './HTMLImage';
|
5 | 5 |
|
6 | 6 | export function a (htmlAttribs, children, convertedCSSStyles, passProps) {
|
@@ -116,24 +116,27 @@ export function iframe (htmlAttribs, children, convertedCSSStyles, passProps) {
|
116 | 116 | if (!htmlAttribs.src) {
|
117 | 117 | return false;
|
118 | 118 | }
|
119 |
| - const { staticContentMaxWidth } = passProps; |
| 119 | + const { staticContentMaxWidth, tagsStyles, classesStyles } = passProps; |
| 120 | + |
| 121 | + const tagStyleHeight = tagsStyles.iframe && tagsStyles.iframe.height; |
| 122 | + const tagStyleWidth = tagsStyles.iframe && tagsStyles.iframe.width; |
| 123 | + |
| 124 | + const classStyles = _getElementClassStyles(htmlAttribs, classesStyles); |
| 125 | + const classStyleWidth = classStyles.width; |
| 126 | + const classStyleHeight = classStyles.height; |
| 127 | + |
| 128 | + const attrHeight = htmlAttribs.height ? parseInt(htmlAttribs.height) : false; |
| 129 | + const attrWidth = htmlAttribs.width ? parseInt(htmlAttribs.width) : false; |
| 130 | + |
| 131 | + const height = attrHeight || classStyleHeight || tagStyleHeight || 200; |
| 132 | + const width = attrWidth || classStyleWidth || tagStyleWidth || staticContentMaxWidth; |
| 133 | + |
120 | 134 | const style = _constructStyles({
|
121 | 135 | tagName: 'iframe',
|
122 | 136 | htmlAttribs,
|
123 | 137 | passProps,
|
124 | 138 | styleSet: 'VIEW',
|
125 |
| - additionalStyles: [ |
126 |
| - { |
127 |
| - height: htmlAttribs.height ? |
128 |
| - parseInt(htmlAttribs.height, 10) : |
129 |
| - undefined |
130 |
| - }, |
131 |
| - { |
132 |
| - width: staticContentMaxWidth && htmlAttribs.width && htmlAttribs.width <= staticContentMaxWidth ? |
133 |
| - parseInt(htmlAttribs.width, 10) : |
134 |
| - staticContentMaxWidth |
135 |
| - } |
136 |
| - ] |
| 139 | + additionalStyles: [{ height, width }] |
137 | 140 | });
|
138 | 141 |
|
139 | 142 | return (
|
|
0 commit comments