Browse Source

clean up code style for the pr which fixed updating size issue on Android (https://github.com/iou90/react-native-autoheight-webview/pull/88)

iou90 6 years ago
parent
commit
f0b1e7e269
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      autoHeightWebView/index.android.js

+ 4
- 4
autoHeightWebView/index.android.js View File

@@ -122,8 +122,8 @@ export default class AutoHeightWebView extends PureComponent {
122 122
     const { height: oldHeight, width: oldWidth, source: prevSource, script: prevScript } = state;
123 123
     const { style } = props;
124 124
     const { source, script } = getUpdatedState(props, getBaseScript);
125
-    const height = style && style.height ? style.height : null;
126
-    const width = style && style.width ? style.width : null;
125
+    const height = style ? style.height : null;
126
+    const width = style ? style.width : null;
127 127
     if (source.html !== prevSource.html || source.uri !== prevSource.uri || script !== prevScript) {
128 128
       return {
129 129
         source,
@@ -133,8 +133,8 @@ export default class AutoHeightWebView extends PureComponent {
133 133
     }
134 134
     if (isSizeChanged(height, oldHeight, width, oldWidth)) {
135 135
       return {
136
-        height: height ? height : oldHeight,
137
-        width: width ? width : oldWidth,
136
+        height: height || oldHeight,
137
+        width: width || oldWidth,
138 138
         isSizeChanged: true
139 139
       };
140 140
     }