React Native: Latex nicht ordnungsgemäß unter Verwendung von React-Native-Math-View / React-Native-Mathjax-SVG Rendern
Posted: 16 Mar 2025, 16:19
Ich versuche, Latex -Mathematikgleichungen in meiner nativen React -Anwendung anzuzeigen. Zunächst habe ich versucht, React-Native-Mathjax-Svg und React-Native-Math-View zu verwenden, aber keiner von ihnen scheint die Mathematik richtig zu machen.import React from 'react';
import { View } from 'react-native';
import MathJaxSvg from 'react-native-mathjax-svg';
const App = () => {
return (
);
};
export default App;
< /code>
Ausgabe: Nichts rendert auf dem Bildschirm und ich sehe wiederholte Protokolle von: < /p>
(NOBRIDGE) LOG MathJaxSvg [Function MathJax]
It seems like the component is not bridging properly.
< /code>
Verwendung von React-Native-Math-View
JSX < /p>
import React from 'react';
import { View, Text } from 'react-native';
import MathView from 'react-native-math-view';
const App = () => {
return (
Testing MathJax:
);
};
< /code>
Standard -App;
Problem: Die Komponente macht nichts. Die Fehlerprotokolle werden angezeigt: < /p>
Warning: React.jsx: type is invalid -- expected a string or function but got: undefined.
< /code>
Was funktioniert (aber nicht ideal)
Verwenden von React-Native-WebView mit Mathjax: < /p>
import React from 'react';
import { View, Text } from 'react-native';
import { WebView } from 'react-native-webview';
const mathJaxHTML = `
Testing MathJax
\\( E = mc^2 \\)
`;
const App = () => {
return (
Testing MathJax in WebView:
);
};
< /code>
Standard-App; Build.gradle oder manuell verlinken)?React Native Version: 0.73.3
react-native-mathjax-svg: 0.9.9
react-native-math-view: 3.9.5
Platform: Android & iOS
JavaScript Runtime: Hermes enabled
< /code>
Alle Erkenntnisse oder Korrekturen wären sehr geschätzt!
import { View } from 'react-native';
import MathJaxSvg from 'react-native-mathjax-svg';
const App = () => {
return (
);
};
export default App;
< /code>
(NOBRIDGE) LOG MathJaxSvg [Function MathJax]
It seems like the component is not bridging properly.
< /code>
JSX < /p>
import React from 'react';
import { View, Text } from 'react-native';
import MathView from 'react-native-math-view';
const App = () => {
return (
Testing MathJax:
);
};
< /code>
Standard -App;
Warning: React.jsx: type is invalid -- expected a string or function but got: undefined.
< /code>
Verwenden von React-Native-WebView mit Mathjax: < /p>
import React from 'react';
import { View, Text } from 'react-native';
import { WebView } from 'react-native-webview';
const mathJaxHTML = `
Testing MathJax
\\( E = mc^2 \\)
`;
const App = () => {
return (
Testing MathJax in WebView:
);
};
< /code>
Standard-App; Build.gradle oder manuell verlinken)?React Native Version: 0.73.3
react-native-mathjax-svg: 0.9.9
react-native-math-view: 3.9.5
Platform: Android & iOS
JavaScript Runtime: Hermes enabled
< /code>
Alle Erkenntnisse oder Korrekturen wären sehr geschätzt!