-
-
Notifications
You must be signed in to change notification settings - Fork 25
How to make MathView content auto-split? #26
Comments
This is a major issue and is the reason why I want to move both android and iOS to different implementations as mentioned in #25. Behind the scenes this is virtually impossible because of rendering via svg.
|
OK. Good work. |
My approach was trying to handle it with |
The code: import React from 'react';
import MathView from 'react-native-math-view';
const math = 'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}';
const App: React.FC<{}> = () => <MathView config={{ ex: 12 }} resizeMode='contain' math={math} />;
export default App; |
First time I did not notice. Then, accidentally I observed that actually there is a math expression. :)) |
Supporting Other approachesThe problem with MathJax is that their documentation is a crazy, daunting labyrinth so it's a guessing game to try to achieve something from there. |
BTW the native approach is how and why android works |
Maybe the default ex config (8) is wrong for ios...? |
I also have a question, I don't understand completely: |
You are right. It is a native library. I refer to it this way because I intend on having an independent native implementation for this library. Which leads me to the fact that I failed to mention my favored approach. I didn't get the chance to finish up the native iOS code, if you're up for it. The major thing to do is to pass the measurements to react and the rest is relatively simple. Handling shrinking in such a case would be as simple as applying scale. |
Thanks for clarification, I understand. I wonder why |
Right again, it's not very configurable. But I read they want to work on it. |
import MathView, { MathText } from 'react-native-math-view'; var a = 'If\ 〖(1+x)〗^15=C_0+C_1x+C_2x^2+...+C_15x^15,\ then\ C_2+2C_3+3C_4+...+14C_15\ is\ equal\ to'; // latex string var b = a.match(/(.{1,4})/g); // by using specific length to split string <MathText resizeMode='cover' |
@znyrsukki Thanks! Interesting solution. |
Take a look at #30 |
I just rendered some math content:
It looks really good:
Then, I made the MathView content longer (I modified only the
const math
):Now, this is what I get:
As you can see, the 'Let' text was automatically moved on a separate line (because of
flexWrap: 'wrap'
), but the math expression is not fully visible (\\frac{5}{6}
is not visible at the end).So, is it possible to configure
MathView
such that automatically shows on multiple lines the math expressions which does not fit in a single line? I would like to get some math expressions from a server and just render them, but some of them may not fit in a single line on the screen, so it would be very useful ifMathView
could automatically split long expressions into multiple lines.The text was updated successfully, but these errors were encountered: