HarmonyOS RN中使用react-native-view-shot报错

已按照doc进行配置,在使用时调用:

captureRef(view).then((res) => {
  console.info(`captureRef: ${JSON.stringify(res)}`);
});

日志报错:

Possible Unhandled Promise Rejection (id: 0):
Object {
  "message": "componentSnapshot failed, message = 100001",
}
HarmonyOS
2025-01-10 08:10:21
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
shlp

CppComponentInstance.h中的:

protected:
  std::string getIdFromProps(
  facebook::react::SharedViewProps const& props) const {
  if (props->testId != "") {
  return props->testId;
} else if (props->nativeId != "") {
  return props->nativeId;
} else {
  std::ostringstream id;
  id << ShadowNodeT::Name() << "@" << m_tag;
  return id.str();
}
}

修改为:

protected:
  std::string getIdFromProps(
  facebook::react::SharedViewProps const& props) const {
  std::ostringstream id;
  id << m_tag;
  return id.str();
}
分享
微博
QQ
微信
回复
2025-01-10 12:03:01
相关问题
HarmonyOS react-native-view-shot使用
434浏览 • 1回复 待解决
HarmonyOS react-native-pager-view安装失败
465浏览 • 1回复 待解决
HarmonyOS react-native-device-info使用报错
311浏览 • 1回复 待解决
HarmonyOS react-native-svg(CAPI)使用报错
373浏览 • 1回复 待解决
HarmonyOS RNreact-native-modal是否支持
156浏览 • 1回复 待解决