Skip to content

Commit 4b2d574

Browse files
author
wangcuijuan
committed
补充安卓逻辑
1 parent 937760a commit 4b2d574

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/webpack-plugin/lib/runtime/components/react/mpx-web-view.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,9 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
155155
}
156156

157157
const _reload = function () {
158+
if (__mpx_mode__ === 'android') {
159+
fristLoaded.current = false // 安卓需要重新设置
160+
}
158161
setPageLoadErr(false)
159162
}
160163

@@ -291,7 +294,7 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
291294

292295
let isLoadError = false
293296
let statusCode: string | number = ''
294-
const onLoadEnd = function (res: WebViewEvent) {
297+
const onLoadEndHandle = function (res: WebViewEvent) {
295298
fristLoaded.current = true
296299
setIsLoaded(true)
297300
const src = res.nativeEvent?.url
@@ -318,6 +321,15 @@ const _WebView = forwardRef<HandlerRef<WebView, WebViewProps>, WebViewProps>((pr
318321
bindload?.(result)
319322
}
320323
}
324+
const onLoadEnd = function (res: WebViewEvent) {
325+
if (__mpx_mode__ === 'android') {
326+
setTimeout(() => {
327+
onLoadEndHandle(res)
328+
}, 0)
329+
} else {
330+
onLoadEndHandle(res)
331+
}
332+
}
321333
const onHttpError = function (res: WebViewHttpErrorEvent) {
322334
isLoadError = true
323335
statusCode = res.nativeEvent?.statusCode

0 commit comments

Comments
 (0)