|
@@ -28,13 +28,13 @@ const updateSizeWithMessage = element =>
|
28
|
28
|
`;
|
29
|
29
|
|
30
|
30
|
// add viewport setting to meta for WKWebView
|
31
|
|
-const makeScalePageToFit = `
|
|
31
|
+const makeScalePageToFit = zoomable => `
|
32
|
32
|
var meta = document.createElement('meta');
|
33
|
33
|
meta.setAttribute('name', 'viewport');
|
34
|
|
-meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);
|
|
34
|
+meta.setAttribute('content', 'width=device-width, user-scalable=${zoomable ? 'yes' : 'no'}'); document.getElementsByTagName('head')[0].appendChild(meta);
|
35
|
35
|
`;
|
36
|
36
|
|
37
|
|
-const getBaseScript = style =>
|
|
37
|
+const getBaseScript = props =>
|
38
|
38
|
`
|
39
|
39
|
;
|
40
|
40
|
if (!document.getElementById("rnahw-wrapper")) {
|
|
@@ -45,12 +45,12 @@ const getBaseScript = style =>
|
45
|
45
|
}
|
46
|
46
|
document.body.appendChild(wrapper);
|
47
|
47
|
}
|
48
|
|
- var width = ${getWidth(style)};
|
|
48
|
+ var width = ${getWidth(props.style)};
|
49
|
49
|
${updateSizeWithMessage('wrapper')}
|
50
|
50
|
window.addEventListener('load', updateSize);
|
51
|
51
|
window.addEventListener('resize', updateSize);
|
52
|
52
|
${domMutationObserveScript}
|
53
|
|
- ${Platform.OS === 'ios' ? makeScalePageToFit : ''}
|
|
53
|
+ ${Platform.OS === 'ios' ? makeScalePageToFit(props.zoomable) : ''}
|
54
|
54
|
updateSize();
|
55
|
55
|
`;
|
56
|
56
|
|
|
@@ -96,8 +96,8 @@ ${script}
|
96
|
96
|
`;
|
97
|
97
|
|
98
|
98
|
const getScript = props => {
|
99
|
|
- const { files, customStyle, customScript, style } = props;
|
100
|
|
- let script = getBaseScript(style);
|
|
99
|
+ const { files, customStyle, customScript } = props;
|
|
100
|
+ let script = getBaseScript(props);
|
101
|
101
|
script = files && files.length > 0 ? appendFilesToHead({ files, script }) : script;
|
102
|
102
|
script = appendStylesToHead({ style: customStyle, script });
|
103
|
103
|
customScript && (script = customScript + script);
|