scniro / react-codemirror2

Codemirror integrated components for React
MIT License
1.65k stars 192 forks source link

Not rendering code #13

Closed jordyvandomselaar closed 6 years ago

jordyvandomselaar commented 6 years ago

When using those component with the following code:

import CodeMirror from "react-codemirror2"
import "codemirror/lib/codemirror"
import "codemirror/lib/codemirror.css"
import "codemirror/mode/php/php"
import "codemirror/theme/material.css"

const Editor = () => (
    <CodeMirror
        value='<h1>I ♥ react-codemirror2</h1>'
        options={options}
        onChange={(editor, metadata, value) => {
        }}
    />
)

All I get is a grey screen that I can't do anything with. image

There's no code inside, and clicking it doesn't do anything either.

image

But I still cannot edit code, nor does it render the value it was given.

scniro commented 6 years ago

Any errors? What is options? Looks undefined to me. Are you importing your resources correctly? Lots to diagnose here...

jordyvandomselaar commented 6 years ago

Ah, yeah, forgot to add that;

const options = {
    mode: 'php',
    theme: 'material',
    lineNumbers: true
}
scniro commented 6 years ago

@jordyvandomselaar hmm I checked on my end with this basic setup, and all works. Could you spin up a quick repo that reproduces this? I'll be happy to help you out I just am not seeing an issue on my side at the moment

scniro commented 6 years ago

@jordyvandomselaar closing for now - please re-open if you are able to provide any more details