Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

How to make MathView content auto-split? #26

@ggunti

Description

@ggunti

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',
  },
});

It looks really good:
Captură de ecran din 2020-04-03 la 01 46 42

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}';

Now, this is what I get:
Captură de ecran din 2020-04-03 la 02 04 49

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    mathjaxmathjax bugswontfixThis will not be worked on

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions