From 696f203b1bfddab1e6b7435f0e3ba5e3b06fad73 Mon Sep 17 00:00:00 2001 From: birdguo Date: Fri, 22 Sep 2023 14:41:03 +0800 Subject: [PATCH] fix(web-renderer): fix codeReview issue --- .../src/component/list-view.ts | 2 +- .../src/env/dynamic-load.ts | 20 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/driver/js/packages/hippy-web-renderer/src/component/list-view.ts b/driver/js/packages/hippy-web-renderer/src/component/list-view.ts index 860cefee601..68297a7716a 100644 --- a/driver/js/packages/hippy-web-renderer/src/component/list-view.ts +++ b/driver/js/packages/hippy-web-renderer/src/component/list-view.ts @@ -70,7 +70,7 @@ export class ListView extends HippyWebView { } public defaultStyle() { - return { display: 'flex', flex: 1, flexDirection: 'column', flexShrink: 0, boxSizing: 'border-box', overflow: 'scroll' }; + return { display: 'flex', flexDirection: 'column', flexShrink: 0, boxSizing: 'border-box', overflow: 'scroll' }; } public get overScrollEnabled() { diff --git a/driver/js/packages/hippy-web-renderer/src/env/dynamic-load.ts b/driver/js/packages/hippy-web-renderer/src/env/dynamic-load.ts index 60b40dd81d1..193ca3299d4 100644 --- a/driver/js/packages/hippy-web-renderer/src/env/dynamic-load.ts +++ b/driver/js/packages/hippy-web-renderer/src/env/dynamic-load.ts @@ -18,17 +18,17 @@ * limitations under the License. */ -export const dynamicLoad = (path: string, cb) => { - const s = document.createElement('script'); - s.async = true; - s.setAttribute('src', path); - if (cb) { - s.onload = () => { - cb(); +export const dynamicLoad = (path: string, callback: Function): void => { + const script = document.createElement('script'); + script.async = true; + script.setAttribute('src', path); + if (typeof callback === 'function') { + script.onload = () => { + callback(); }; - s.onerror = () => { - cb('load script error'); + script.onerror = () => { + callback(`load script "${path}" error`); }; } - document.head.appendChild(s); + document.head.appendChild(script); };