|
|
|
|
34
|
meta.setAttribute('content', 'width=device-width, user-scalable=${zoomable ? 'yes' : 'no'}'); 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 = props =>
|
|
|
|
|
37
|
+const getBaseScript = ({style, zoomable}) =>
|
38
|
`
|
38
|
`
|
39
|
;
|
39
|
;
|
40
|
if (!document.getElementById("rnahw-wrapper")) {
|
40
|
if (!document.getElementById("rnahw-wrapper")) {
|
|
|
|
|
45
|
}
|
45
|
}
|
46
|
document.body.appendChild(wrapper);
|
46
|
document.body.appendChild(wrapper);
|
47
|
}
|
47
|
}
|
48
|
- var width = ${getWidth(props.style)};
|
|
|
|
|
48
|
+ var width = ${getWidth(style)};
|
49
|
${updateSizeWithMessage('wrapper')}
|
49
|
${updateSizeWithMessage('wrapper')}
|
50
|
window.addEventListener('load', updateSize);
|
50
|
window.addEventListener('load', updateSize);
|
51
|
window.addEventListener('resize', updateSize);
|
51
|
window.addEventListener('resize', updateSize);
|
52
|
${domMutationObserveScript}
|
52
|
${domMutationObserveScript}
|
53
|
- ${Platform.OS === 'ios' ? makeScalePageToFit(props.zoomable) : ''}
|
|
|
|
|
53
|
+ ${Platform.OS === 'ios' ? makeScalePageToFit(zoomable) : ''}
|
54
|
updateSize();
|
54
|
updateSize();
|
55
|
`;
|
55
|
`;
|
56
|
|
56
|
|
|
|
|
|
96
|
`;
|
96
|
`;
|
97
|
|
97
|
|
98
|
const getScript = props => {
|
98
|
const getScript = props => {
|
99
|
- const { files, customStyle, customScript } = props;
|
|
|
100
|
- let script = getBaseScript(props);
|
|
|
|
|
99
|
+ const { files, customStyle, customScript, style, zoomable } = props;
|
|
|
100
|
+ let script = getBaseScript({style, zoomable});
|
101
|
script = files && files.length > 0 ? appendFilesToHead({ files, script }) : script;
|
101
|
script = files && files.length > 0 ? appendFilesToHead({ files, script }) : script;
|
102
|
script = appendStylesToHead({ style: customStyle, script });
|
102
|
script = appendStylesToHead({ style: customStyle, script });
|
103
|
customScript && (script = customScript + script);
|
103
|
customScript && (script = customScript + script);
|