This repository was archived by the owner on Sep 5, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 33
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
How to make MathView content auto-split? #26
Copy link
Copy link
Open
Labels
Description
I just rendered some math content:
import React from 'react';
import { SafeAreaView, View, Text, StyleSheet } from 'react-native';
import MathView from 'react-native-math-view';
const math = 'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}';
const App: React.FC<{}> = () => {
return (
<SafeAreaView style={styles.container}>
<View style={styles.mathBox}>
<Text style={{ fontSize: 24, marginRight: 7 }}>Let</Text>
<MathView config={{ ex: 12 }} math={math} />
</View>
</SafeAreaView>
);
};
export default App;
const styles = StyleSheet.create({
container: {
flex: 1,
marginHorizontal: 5,
justifyContent: 'center',
},
mathBox: {
flexDirection: 'row',
alignItems: 'flex-end',
flexWrap: 'wrap',
},
});Then, I made the MathView content longer (I modified only the const math):
const math = 'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}+\\frac{1}{2}+\\frac{2}{3}+\\frac{3}{4}+\\frac{4}{5}+\\frac{5}{6}';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 if MathView could automatically split long expressions into multiple lines.

