|
@@ -109,7 +109,7 @@ export default class AutoHeightWebView extends PureComponent {
|
109
|
109
|
};
|
110
|
110
|
if (enableAnimation) {
|
111
|
111
|
Object.assign(state, {
|
112
|
|
- heightValue: new Animated.Value(initHeight + heightOffset),
|
|
112
|
+ heightValue: new Animated.Value(initHeight ? initHeight + heightOffset : 0),
|
113
|
113
|
widthValue: new Animated.Value(initWidth)
|
114
|
114
|
});
|
115
|
115
|
}
|
|
@@ -154,7 +154,7 @@ export default class AutoHeightWebView extends PureComponent {
|
154
|
154
|
if (enableAnimation) {
|
155
|
155
|
Animated.parallel([
|
156
|
156
|
Animated.timing(heightValue, {
|
157
|
|
- toValue: height + heightOffset,
|
|
157
|
+ toValue: height ? height + heightOffset : 0,
|
158
|
158
|
easing: animationEasing,
|
159
|
159
|
duration: animationDuration
|
160
|
160
|
}),
|
|
@@ -326,12 +326,10 @@ const getBaseScript = isBelowKitKat
|
326
|
326
|
${commonScript}
|
327
|
327
|
var width = ${getWidth(style)};
|
328
|
328
|
function updateSize() {
|
329
|
|
- if(document.body.offsetHeight !== height || document.body.offsetWidth !== width) {
|
330
|
|
- var size = getSize(document.body.firstChild);
|
331
|
|
- height = size.height;
|
332
|
|
- width = size.width;
|
333
|
|
- AutoHeightWebView.send(JSON.stringify({ width, height }));
|
334
|
|
- }
|
|
329
|
+ var size = getSize(document.body.firstChild);
|
|
330
|
+ height = size.height;
|
|
331
|
+ width = size.width;
|
|
332
|
+ AutoHeightWebView.send(JSON.stringify({ width, height }));
|
335
|
333
|
}
|
336
|
334
|
(function () {
|
337
|
335
|
AutoHeightWebView.onMessage = updateSize;
|
|
@@ -345,12 +343,10 @@ const getBaseScript = isBelowKitKat
|
345
|
343
|
${commonScript}
|
346
|
344
|
var width = ${getWidth(style)};
|
347
|
345
|
function updateSize() {
|
348
|
|
- if(document.body.offsetHeight !== height || document.body.offsetWidth !== width) {
|
349
|
|
- var size = getSize(document.body.firstChild);
|
350
|
|
- height = size.height;
|
351
|
|
- width = size.width;
|
352
|
|
- window.postMessage(JSON.stringify({ width, height }), '*');
|
353
|
|
- }
|
|
346
|
+ var size = getSize(document.body.firstChild);
|
|
347
|
+ height = size.height;
|
|
348
|
+ width = size.width;
|
|
349
|
+ window.postMessage(JSON.stringify({ width, height }), '*');
|
354
|
350
|
}
|
355
|
351
|
(function () {
|
356
|
352
|
document.addEventListener("message", updateSize);
|