alibaba / lowcode-engine

An enterprise-class low-code technology stack with scale-out design / 一套面向扩展设计的企业级低代码技术体系
https://lowcode-engine.cn
MIT License
14.65k stars 2.55k forks source link

单独接入antd 的 umd 物料后 报错,渲染失败, TypeError: Cannot read properties of null (reading 'useContext') #3070

Open canyuegongzi opened 3 months ago

canyuegongzi commented 3 months ago

Describe the bug (required) / 详细描述 bug(必填)

A clear and concise description of what the bug is. / 请提供清晰且精确的 bug 描述

image

TypeError: Cannot read properties of null (reading 'useContext')

To Reproduce (required) / 如何复现 bug?(必填,非常重要)

Steps to reproduce the behavior: / 详细复现步骤:


中文版示例: 1: 单独使用 react-renderer, 采用 umd 引antd 的umd, 使用 antd 的组件时报错


const Components: Record<any, any> = {
    ImageView,
    DivView,
    AView,
    Button: window.antd.Button,
    Tag
  }

Expected behavior (required) / 预期行为(必填,非常重要)

能正常渲染


Screenshots (optional) / bug 截图(可选)

Sceenshots for further information. (If applicable.) / 一些有用的截图将会帮助我们更好的明确以及定位问题


Environments (please complete the following information) (required): / 请提供如下信息(必填)

(this information can be collected via the manual plugin / 版本信息可通过低代码用户手册插件收集)

Additional context (optional) / 更多额外信息(可选)

Any other context of the problem here. / 可以追加更多的额外信息,帮助定位问题

WHSnhcZDYRZC commented 3 months ago

可以去看下这个库的解决方案哦 https://github.com/WHSnhcZDYRZC/umi4-lowcode-engine-solutions

canyuegongzi commented 3 months ago

https://github.com/WHSnhcZDYRZC/umi4-lowcode-engine-solutions 好的, 感谢, 原因找到了, 是引入了俩个 react 库 造成的,