ShaMan123 / react-native-math-view

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

How do you wrap the content ? #21

Closed sumesh1993 closed 4 years ago

sumesh1993 commented 4 years ago

I have big question, it is rendering in one line. How do i wrap it such that it comes on the next line

Screenshot 2019-12-24 at 9 11 26 PM
ShaMan123 commented 4 years ago

Well, that's a question. A very complicated one. The simplest approach would be to render this math into 3 MathViews, then apply styling on the parent container view.

sumesh1993 commented 4 years ago

i figured out a way, but \begin{flushleft} and \end{flushright} doesnt seem to be working

ShaMan123 commented 4 years ago

Try looking into mathjax docs

sumesh1993 commented 4 years ago

Does your library use mathjax under the hood for iOS and Android ? Because on web the latex is rendering perfectly using mathjax, but on iOS its not working as expected. This is the latex When $a \ne 0$, there are two solutions to \(ax^2 + bx + c = 0\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$

ShaMan123 commented 4 years ago

On the web it surely wraps content with no issues. MathJax is designed mainly for web and not long ago they started supporting nodejs rendering. This library is an adaption of the node version, therefore lacking a true renderer, defaulting to svg. This is why you can't wrap content, it's svg. iOS might manage this once rendering will be done by a native library (=no svg, can't say yet, haven't had the time to test) and there might be a very complex way to do this with svg (or component mirroring from web to RN) but it isn't on the roadmap. PRs are welcome.

ShaMan123 commented 4 years ago

BTW the android version has a resizeMode prop that might help in some manner.

ShaMan123 commented 4 years ago

A final thought: If it's crucial you could use a WebView and some internals of the mathjax adaptor to render html string. This should work

ShaMan123 commented 4 years ago

22