react-mathlive icon indicating copy to clipboard operation
react-mathlive copied to clipboard

TypeError: Cannot read property 'makeMathField' of undefined

Open shundaime opened this issue 4 years ago • 14 comments

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 ?

shundaime avatar Aug 27 '21 07:08 shundaime

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

joaortizro avatar Aug 30 '21 17:08 joaortizro

Hello we are not using webpack, this is react standalone

shundaime avatar Sep 02 '21 09:09 shundaime

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.

arnog avatar Sep 02 '21 10:09 arnog

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

shundaime avatar Sep 06 '21 09:09 shundaime

@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!

reinvanimschoot avatar Sep 27 '21 14:09 reinvanimschoot

Which version of MathLive are you using?

arnog avatar Sep 27 '21 17:09 arnog

@arnog 0.59.0

reinvanimschoot avatar Sep 28 '21 07:09 reinvanimschoot

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

arnog avatar Sep 28 '21 14:09 arnog

I upgraded to 0.69.7 but I still get this error

Cannot read property 'makeMathField' of undefined

reinvanimschoot avatar Sep 29 '21 08:09 reinvanimschoot

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

reinvanimschoot avatar Oct 08 '21 08:10 reinvanimschoot

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 avatar Oct 15 '21 22:10 dobesv

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

dobesv avatar Oct 22 '21 17:10 dobesv

any solutions?

yurnery avatar Dec 03 '21 03:12 yurnery

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

dobesv avatar Dec 03 '21 05:12 dobesv