concludio / react-mathlive

A react wrapper-component for mathlive.js
MIT License
25 stars 16 forks source link

TypeError: Cannot read property 'makeMathField' of undefined #39

Open shundaime opened 3 years ago

shundaime commented 3 years ago

I was trying to use your package the simple way as i could with this part of code to start :

render() {
  return <MathfieldComponent
    initialLatex="f(x)=\\log _10 x"
    onChange={this.onMathChange}
  />;
}

onMathChange(mathText) {
  console.log(mathText);
}

But i get this : Capture d’écran du 2021-08-27 09-57-13

I don't understand why, can you help please ?

joaortizro commented 3 years ago

Hello this is due to some webpack configurations, see arnog/mathlive#1123

shundaime commented 3 years ago

Hello we are not using webpack, this is react standalone

arnog commented 3 years ago

This is not specifically a problem with webpack. In the case of the react toolchain, there is an intermediary tool (whose name I forget) that doesn't know how to parse optional chaining. Anyhoo... The latest version of Mathlive has reverted to not using optional chaining to accommodate those toolchains.

shundaime commented 3 years ago

Hello, what is for you the latest version of Mathlive ? Here is our : "react-mathlive": "^3.0.5-preview.1",

reinvanimschoot commented 2 years ago

@arnog We tried updating to the latest version of react-mathlive and mathlive but we still get the same error. Are we missing something? Cheers!

arnog commented 2 years ago

Which version of MathLive are you using?

reinvanimschoot commented 2 years ago

@arnog 0.59.0

arnog commented 2 years ago

That's the problem. The current version is 0.69.7.

reinvanimschoot commented 2 years ago

I upgraded to 0.69.7 but I still get this error

Cannot read property 'makeMathField' of undefined
reinvanimschoot commented 2 years ago

Is it possible that react-mathlive is not compatible with the latest version of mathlive?

dobesv commented 2 years ago

I have the same issue. Any idea which version of mathlive can be used with react-mathlive?

$ grep mathlive package.json
    "mathlive": "^0.69.7",
    "react-mathlive": "^3.0.5-preview.1",
dobesv commented 2 years ago

I wonder if this is a duplicate of https://github.com/concludio/react-mathlive/issues/34

yurnery commented 2 years ago

any solutions?

dobesv commented 2 years ago

Just have you make your own mathlive react component, it's not that hard to do TBH.