react-ace
react-ace copied to clipboard
highlightActiveLine not working properly
The current line is not initially highlighted with this setting on true/default. It starts working after a little while after you've clicked on a bunch of lines.
A functioning workaround is to set highlightActiveLine to false on the JSX component, and use ref to grab a reference to the editor, and instead do .setHighlightActiveLine inside componentDidMount. This indicates there is some DOM race condition going on that that react-ace is trying to do something earlier than is possible.
Hi @mpj , so how to do?
Hi @mpj . I found a hack:
onLoad={e => {
e.setHighlightActiveLine(false)
e.setHighlightActiveLine(true)
}}
It works to me.