Pārlūkot izejas kodu

fixed passing props

Pavel T 5 gadus atpakaļ
vecāks
revīzija
23417cbed8
1 mainītis faili ar 5 papildinājumiem un 5 dzēšanām
  1. 5
    5
      autoHeightWebView/utils.js

+ 5
- 5
autoHeightWebView/utils.js Parādīt failu

@@ -34,7 +34,7 @@ meta.setAttribute('name', 'viewport');
34 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 40
   if (!document.getElementById("rnahw-wrapper")) {
@@ -45,12 +45,12 @@ const getBaseScript = props =>
45 45
     }
46 46
     document.body.appendChild(wrapper);
47 47
   }
48
-  var width = ${getWidth(props.style)};
48
+  var width = ${getWidth(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(props.zoomable) : ''}
53
+  ${Platform.OS === 'ios' ? makeScalePageToFit(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 } = props;
100
-  let script = getBaseScript(props);
99
+  const { files, customStyle, customScript, style, zoomable } = props;
100
+  let script = getBaseScript({style, zoomable});
101 101
   script = files && files.length > 0 ? appendFilesToHead({ files, script }) : script;
102 102
   script = appendStylesToHead({ style: customStyle, script });
103 103
   customScript && (script = customScript + script);