You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to create a shared virtual keyboard in react, but not sure how to go about it. The docs on cortex say this:
To use a shared virtual keyboard, call the makeSharedVirtualKeyboard() function in the context of the main document.
You should make that call as early as possible, before changing the options of any mathfield or adding mathfields to the DOM.
As far as I can tell, in React I'm only able to access / manipulate the MathView component via refs. Am I missing something?
Thanks,
Will
The text was updated successfully, but these errors were encountered:
I'm not sure what you are asking. Are you asking how to make the call to makeSharedVirtualKeyboard() when using React? I'm not a React expert, but I believe you would use the useEffect hook, i.e. something like:
import React, {useEffect} from 'react';
useEffect(()=> makeSharedVirtualKeyboard(),[])
Yes, that was basically my question and sorry that it wasn't very clear.
The issue, finally, was that react-math-view doesn't expose makeSharedVirtualKeyboard(), so I added mathlive as a dependency and imported it from there. After that I simply fired the function and the shared keyboard worked, without having to call the function from a useEffect hook. Here's an example repo that also shows how to customize the keyboard.
Hey Arnog,
I'm trying to create a shared virtual keyboard in react, but not sure how to go about it. The docs on cortex say this:
As far as I can tell, in React I'm only able to access / manipulate the MathView component via refs. Am I missing something?
Thanks,
Will
The text was updated successfully, but these errors were encountered: