Browse Source

update hooks using for demo

iou90kant 5 years ago
parent
commit
87a755419d
1 changed files with 11 additions and 11 deletions
  1. 11
    11
      demo/App.js

+ 11
- 11
demo/App.js View File

@@ -54,39 +54,39 @@ const onWidthLoad = () => console.log('width on load');
54 54
 const onWidthLoadEnd = () => console.log('width on load end');
55 55
 
56 56
 const Explorer = () => {
57
-  const [{ widthHtml, heightHtml }, setHtml] = useState(() => ({
57
+  const [{ widthHtml, heightHtml }, setHtml] = useState({
58 58
     widthHtml: autoWidthHtml0,
59 59
     heightHtml: autoHeightHtml0
60
-  }));
60
+  });
61 61
   const changeSource = () =>
62 62
     setHtml({
63 63
       widthHtml: widthHtml === autoWidthHtml0 ? autoWidthHtml1 : autoWidthHtml0,
64 64
       heightHtml: heightHtml === autoHeightHtml0 ? autoHeightHtml1 : autoHeightHtml0
65 65
     });
66 66
 
67
-  const [{ widthStyle, heightStyle }, setStyle] = useState(() => ({
67
+  const [{ widthStyle, heightStyle }, setStyle] = useState({
68 68
     heightStyle: null,
69 69
     widthStyle: inlineBodyStyle
70
-  }));
70
+  });
71 71
   const changeStyle = () =>
72 72
     setStyle({
73
-      widthStyle: widthStyle == inlineBodyStyle ? style0 + inlineBodyStyle : inlineBodyStyle,
74
-      heightStyle: heightStyle == null ? style0 : null
73
+      widthStyle: widthStyle === inlineBodyStyle ? style0 + inlineBodyStyle : inlineBodyStyle,
74
+      heightStyle: heightStyle === null ? style0 : null
75 75
     });
76 76
 
77
-  const [{ widthScript, heightScript }, setScript] = useState(() => ({
77
+  const [{ widthScript, heightScript }, setScript] = useState({
78 78
     heightScript: autoDetectLinkScript,
79 79
     widthScript: null
80
-  }));
80
+  });
81 81
   const changeScript = () =>
82 82
     setScript({
83
-      widthScript: widthScript !== autoWidthScript ? autoWidthScript : null,
83
+      widthScript: widthScript == autoWidthScript ? autoWidthScript : null,
84 84
       heightScript:
85 85
         heightScript !== autoDetectLinkScript ? autoDetectLinkScript : autoHeightScript + autoDetectLinkScript
86 86
     });
87 87
 
88
-  const [heightSize, setHeightSize] = useState(() => ({ height: 0, width: 0 }));
89
-  const [widthSize, setWidthSize] = useState(() => ({ height: 0, width: 0 }));
88
+  const [heightSize, setHeightSize] = useState({ height: 0, width: 0 });
89
+  const [widthSize, setWidthSize] = useState({ height: 0, width: 0 });
90 90
 
91 91
   return (
92 92
     <ScrollView