HarmonyOS react-native-webview闪退问题

报错信息如下:

Error message:Cannot read property layoutMetrics of undefined
SourceCode:
  Stack.width(this.descriptor.layoutMetrics.frame.size.width);
^
Stacktrace:
  at anonymous (oh_modules/.ohpm/rnoh-webview@be7mw7jzuxdjc6emzbzsliwkofk=/oh_modules/rnoh-webview/src/main/ets/WebView.ets:561:12)
at updateFunc (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6661:6661)
at observeComponentCreation2 (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6702:1)
at initialRender (oh_modules/.ohpm/rnoh-webview@be7mw7jzuxdjc6emzbzsliwkofk=/oh_modules/rnoh-webview/src/main/ets/WebView.ets:531:3)
at initialRenderView (/usr1/hmos_for_system/src/increment/sourcecode/foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/stateMgmt.js:6324:6324)
at build (../../../foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/jsXNode.js:176:176)
at build (../../../foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/jsXNode.js:68:68)
at ComponentContent (../../../foundation/arkui/ace_engine/frameworks/bridge/declarative_frontend/engine/jsXNode.js:2026:2026)
at create (oh_modules/.ohpm/@rnoh+react-native-openharmony@bob8j5zuju575xuzn64mxh+8nj0=/oh_modules/@rnoh/react-native-openharmony/src/main/ets/RNOH/CustomRNComponentFrameNodeFactory.ets:39:25)
HarmonyOS
1天前
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
superinsect

版本升级后,需要给RNApp组件加个arkTsComponentNames白名单配置,麻烦确认一下是否加了:

import { RNCWebView, WEB_VIEW } from "@react-native-oh-tpl/react-native-webview"
const arkTsComponentNames: Array<string> = [
  WEB_VIEW,
];
RNApp({
  rnInstanceConfig: {
    ...others, // the other properties
    arkTsComponentNames: arkTsComponentNames,
  },
})
分享
微博
QQ
微信
回复
1天前
相关问题
HarmonyOS升级后,react-native-svg退
31浏览 • 1回复 待解决
HarmonyOS 使用Webview退
49浏览 • 1回复 待解决
HarmonyOS应用退问题
753浏览 • 1回复 待解决
HarmonyOS webview加载html string一直退
74浏览 • 1回复 待解决
HarmonyOSreact native兼容问题
337浏览 • 1回复 待解决
HarmonyOS number toFixed方法退
68浏览 • 1回复 待解决
HarmonyOS 退报错 Error code:2100001
49浏览 • 1回复 待解决
HarmonyOS 关于react-native-fs问题咨询
59浏览 • 1回复 待解决
HarmonyOS 适配 React native
371浏览 • 1回复 待解决
HarmonyOS 申请短时后台任务退
68浏览 • 1回复 待解决
HarmonyOS PixelMap.rotate接口导致退
31浏览 • 1回复 待解决
HarmonyOS 页面返回时应用退报错
652浏览 • 1回复 待解决
加载FFMpeg后APP出现退
227浏览 • 1回复 待解决