Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

react-monaco-editor in Modal Component doesn't work #652

Open
AnitaTang opened this issue Nov 8, 2022 · 5 comments
Open

react-monaco-editor in Modal Component doesn't work #652

AnitaTang opened this issue Nov 8, 2022 · 5 comments

Comments

@AnitaTang
Copy link

I encounter this problem, 'The container has valid width and height while the editor's width and height are only 5px', I could not see any error in the console of DevTool。 [react-monaco-editor] component works well in other page in my project.
"react-monaco-editor": "^0.34.0", "monaco-editor": "^0.20.0".
20221108203328
Any help?Thanks.

@AnitaTang AnitaTang changed the title [react-monaco-editor] doesn't work react-monaco-editor in Modal Ccomponent doesn't work Nov 8, 2022
@AnitaTang AnitaTang changed the title react-monaco-editor in Modal Ccomponent doesn't work react-monaco-editor in Modal Component doesn't work Nov 8, 2022
@lmarklil
Copy link

lmarklil commented Nov 14, 2022

I have same problem, and I found this problem is cause by Ant Design, you can try to unupgrade Ant Design to 4.23.1.

@ohhoney1
Copy link

add config automaticLayout: true , it works for me.

 <MonacoEditor
    width="800"
    height="600"
    language="javascript"
    theme="vs-dark"
    value={code}
    options={{ automaticLayout: true }}
  //...

@TimAstier
Copy link

Not sure if it's related but when using the component in my app with some custom css and webpack config, the editor was also rendering with a height of 5px, and I just realised that switching

<MonacoEditor
    width="800"
    height="600"
//...

to

<MonacoEditor
    width="800px"
    height="600px"
//...

made a difference 🤔

@zxq08
Copy link

zxq08 commented Aug 23, 2023

添加配置automaticLayout: true,它对我有用。

 <MonacoEditor
    width="800"
    height="600"
    language="javascript"
    theme="vs-dark"
    value={code}
    options={{ automaticLayout: true }}
  //...

yes It's helpful! thank you!

@Mrtaochen
Copy link

我有同样的问题,我发现这个问题是由Ant Design引起的,你可以尝试将Ant Design取消升级到4.23.1。

同样的发现,但是目前没有找到具体是antd的什么原因引起的。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants