Closed ggunti closed 4 years ago
You can try styling the MathView
with flex: 1
or with width
and see how that goes.
const App: React.FC<{}> = () => {
return (
<SafeAreaView style={styles.container}>
<MathView math={'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}'}
+ style={styles.container}
/>
</SafeAreaView>
);
};
There's an option to control the font size, see example
Try changing style as well
const styles = StyleSheet.create({
container: {
flex: 1,
- alignItems: 'center',
- justifyContent: 'center',
},
});
style
for MathView
does not have effect, but config={{ ex: 50 }}
works well, I think it should be included in the readme. Thank you for your help!
I want to expose a prop for font size.
Styling should work though. Did you try changing styles.container
? Centering might be interfering.
This could be solved by wrapping MathView
with another view. Look at the example.
I removed centering from SafeAreaView
, but the actual size of math expression did not changed by styling the MathView
.
Also, I like this library so much. I did not saw another library for react native which is capable to render math without using a webview. If I can help you making this library better, please let me know, I am not a pro in how native math rendering actually works, but I'm really enthusiastic and love math, of course.
Happy to hear. I created this library exactly because what you said.
And now I know why resizing on iOS doesn't work. That is the behavior I implemented in native, so android resizes to fit the parent when resizeMode
is cover
. iOS is implemented with react-native-svg
because I didn't finish the standalone implementation yet.
If you want to contribute there's work to do on iOS. I want to move to the standalone implementation.
The first thing to do is to handle the measuring of the view in native. react-native
uses it's own layout flow and at the time I didn't figure it out.
After that it's all about exposing props.
If you're not an iOS dev you can try to fix this issue for the current implementation. This would require looking into react-native-svg
.
For android I have in mind for the next major version moving to this implementation if it's stable and good, retex, so you can look it to it as well.
style
forMathView
does not have effect, butconfig={{ ex: 50 }}
works well, I think it should be included in the readme. Thank you for your help!
This is amazing. works like a charm Bro thank you!
I am in "react-native-math-view": "^3.9.5", "react-native": "0.74.5", Android platform.
The config property does not work for me at all with MathView. I created a simple page with just the MathView but the fonts are too tiny. <MathView math={'\triangle x=\frac{-b\pm\sqrt{b^2-4ac}}{2a}'} config={{ ex: 50}} /> Please help. Am I missing anything?
Platform: iOS
I just rendered the example from readme:
But the problem is that the resulted math expression is too small. Is it possible to somehow make it bigger?: