Ver código fonte

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 anos atrás
pai
commit
f0b1e7e269
1 arquivos alterados com 4 adições e 4 exclusões
  1. 4
    4
      autoHeightWebView/index.android.js

+ 4
- 4
autoHeightWebView/index.android.js Ver arquivo

@@ -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
     }