I am trying to insert a codemirror 6 component inside Ionic react framework's IonContent, but it completely messes with the codemirror styles because of the shadowdom used by IonContent. Codemirror allows us to pass a root property where I can pass the IonContent shadow root, but I am not sure how I can get the ref for the parent IonContent.
const ICRef = useRef<HTMLIonContentElement>(null); return ( <IonContent ref={ICRef}> <CodeMirrorEditor editorRoot={ ICRef.current.shadowRoot }/> </IonContent> ) `
But I get error -
react-dom.development.js:23275 Uncaught TypeError: Cannot read properties of null (reading 'shadowRoot')
It seems like the shadowdom of IonContent is not yet part of the browser dom when CodeMirrorEditor is being rendered. Any pointers would be appreciated. Thanks.