ShaMan123 / react-native-math-view

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

Content not rendering #28

Closed AIRLegend closed 4 years ago

AIRLegend commented 4 years ago

Hello,

My app does not render the LaTeX code, although it shows the component:

Captura de pantalla 2020-04-20 a las 15 53 44

This is the corresponding code:

import React from 'react';
import { StyleSheet, Text, View, ScrollView} from 'react-native';
import MathView from 'react-native-math-view';
import MathViewFallback from 'react-native-math-view/src/fallback';

const math = 'x=\\frac{-b\\pm\\sqrt{b^2-4ac}}{2a}';

export default function RankingScreen({navigation}) {
  return (
    <View style={styles.container}>
        <MathView math={math} config={{ ex: 50 }} style={{backgroundColor: 'red'}}/>
        <Text>Hello world</Text>
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'column',
    backgroundColor: '#555',
    justifyContent: 'center',
    alignContent: "center",
  },
});

I already tried setting different versions of "react-native-svg". Currently I'm using "react-native-svg": "^12.0.1" since all the others give me errors.

(Note: I'm using React Native 0.61.4).

Any ideas?

Thanks in advance.

ShaMan123 commented 4 years ago

try removing config={{ ex: 50 }}

AIRLegend commented 4 years ago

I've already tried. The effect is the same but the component becomes smaller...

ShaMan123 commented 4 years ago

how about this?

const styles = StyleSheet.create({
  container: {
    flex: 1,
    flexDirection: 'column',
    backgroundColor: '#555',
-    justifyContent: 'center',
-    alignContent: "center",
  },
});
AIRLegend commented 4 years ago

Removing the styles doesn't work either. Could it be related to the react-native-svg dependency?

ShaMan123 commented 4 years ago

The question is how if so. Look here Example/SvgXml I suggest you run the example and see if that works

AIRLegend commented 4 years ago

I managed to get the example app running correctly. However it does not work on my app. I installed it through npm install --save react-native-math-view and npm install react-native-svg (the versions above). This is right, isn't it?

ShaMan123 commented 4 years ago

The example app isn't included in the npm release. Pull from github.

AIRLegend commented 4 years ago

Yeah, I mean, I did it, ran it, and it works. The problem is related to my app. The process I followed for installing react-native-math-view was the above. Is it ok?

AIRLegend commented 4 years ago

I've managed to fix it. Simply deleted node_modules and reset metro's cache (rm -fr $TMPDIR/metro*). Now it works as expected. Thank you!