calvinkei / react-native-mathjax

Render Mathjax content in React Native Webview
MIT License
34 stars 37 forks source link

Showing Mathjax Loading while rendering #3

Closed akashjai95 closed 6 years ago

akashjai95 commented 6 years ago

You can see Mathjax loading screenshot at below link https://drive.google.com/file/d/1A3EqrZVlnhkWyOSFGkEtTWjvNrXkHX-k/view?usp=sharing

Is any way to hide??

calvinkei commented 6 years ago

I have never experienced this before. What device/simulator are you using? Also, it might be due to the MathJax configurations which you can change by mathJaxOptions props. Try to read through MathJax documentation to see if there's a way to bypass this.

akashjai95 commented 6 years ago
wrapMathjax(content) {
        const options = JSON.stringify(
            {
                extensions: ["tex2jax.js","mml2jax.js","MathMenu.js","MathZoom.js", "fast-preview.js", "AssistiveMML.js", "a11y/accessibility-menu.js"],
                TeX: {
                    extensions: ["AMSmath.js","AMSsymbols.js","noErrors.js","noUndefined.js"]
                },
                tex2jax: {
                    inlineMath: [ ['(',')'], ['\\(','\\)'] ],
                }
            }
        );

        return `
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <script defer src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js"></script>
        <script defer src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/config/TeX-AMS-MML_HTMLorMML-full.js"></script>
        <script defer type="text/javascript">
            MathJax.Hub.Config(${options});
        </script>
      ${content}
    `;
    }

This is our code we are using additional scripts to support mathml expressions.

calvinkei commented 6 years ago

@akashjai95 refer to this: https://stackoverflow.com/questions/11372615/mathjax-hiding-mathjax-loading-process

i think you can try adding messageStyle: "none" to the option

akashjai95 commented 6 years ago

Thanks now it's working fine.