ShaMan123 / react-native-math-view

Math view for react native! No WebView!
https://github.com/ShaMan123/react-native-math-view
MIT License
77 stars 24 forks source link

can't find variable require #71

Closed arifsuheyl closed 2 years ago

arifsuheyl commented 2 years ago

While importing MathText and Mathview, im getting the error in the picture. There is no error in install. How can I fix this?

Ekran Resmi 2022-05-24 00 36 27
ShaMan123 commented 2 years ago

I don't know. Try using resolutions field in package.json for react-native.

kabonKoda commented 2 years ago

Just fix this here too .... in your node modules go to mathjax-full/components/version.js

"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.VERSION = void 0; exports.VERSION = (typeof PACKAGE_VERSION === 'undefined' ? (function () { return require('../../package.json').version; })() : PACKAGE_VERSION); //# sourceMappingURL=version.js.map

paste this there

arifsuheyl commented 2 years ago

Thanks. It worked!

ShaMan123 commented 2 years ago

@kabonKoda what does it fix? What is broken?

arifsuheyl commented 2 years ago

@kabonKoda what does it fix? What is broken?

there was a problem In node_modules/mathjax-full/components/version.js file.

var load = eval('require'); var dirname = eval('__dirname'); var path = load('path'); return load(path.resolve(dirname, '..', '..', 'package.json')).version; In this code eval('require') gives an error about require and linking package.json manually worked.

pkra commented 2 years ago

If this is related to v3.2.1, then https://github.com/mathjax/MathJax-src/issues/818 is probably worth a read.

ShaMan123 commented 2 years ago

@pkra thanks for the intel. You guys can do as suggested in that link until this is resolved. You can use some patching mechanism like yarn patch instead. I'd appreciate checking in or PRing if someone has a valid solution

ShaMan123 commented 2 years ago

https://github.com/apache/openmeetings/blob/master/openmeetings-web/src/main/front/wb/src/wb-tool-stat-math.js#L5

ShaMan123 commented 2 years ago

I have pushed a commit, hopefully is fixes this issue until mathjax fixes it upstream. My android studio is not letting me load the emulator. I'd appreciate if you guys could clone the repo and test locally that everything works. I'll release a version once the fix is confirmed.