У меня есть требование показывать математические выражения в моем React
Нативное приложение, поэтому я использую response-native-mathjax v-2.2.0. Если
выражение в тексте с помощью flex:0
на View Я могу добиться этого, но
когда я рендерим выражения с использованием MathJax, содержимое не
изменение размера в соответствии с содержанием.
Я предоставляю изображение относительно этой проблемы: -
Теперь я предоставляю свой код здесь: -
<View style={styles.container}>
<View style={styles.qsNo}>
<Text>Question {this.state.questions[this.state.currentQuestion].id} of 3</Text>
</View>
<View style={styles.testType}>
<Text style={{fontWeight:'bold',fontSize:18}}>Normal Text</Text>
</View>
<View style={styles.question}>
<Text>{this.state.questions[this.state.currentQuestion].text}</Text>
</View>
<View style={styles.testType}>
<Text style={{fontWeight:'bold',fontSize:18}}>Mathjax Text</Text>
</View>
<View style={styles.question}>
<MathJax
html={
this.state.questions[this.state.currentQuestion].text
}
/>
</View>
<TouchableWithoutFeedback onPress={this.changequestion}>
<View style={[styles.button,styles.makeCenter]}>
<Text style={{ textAlign: 'center' }}>Change</Text>
</View>
</TouchableWithoutFeedback>
</View>
Раздел стилей: -
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#F5FCFF',
},
testType: {
flex:.1,
backgroundColor:'pink',
justifyContent: 'center',
paddingLeft: 10
},
qsNo: {
flex: .1,
backgroundColor: 'yellow',
justifyContent: 'center',
paddingLeft: 10
},
makeCenter:{
alignContent: 'center',
alignItems: 'center',
justifyContent:'center'
},
question:{
flex:0,
backgroundColor:'#c5d1e3',
padding: 10,
},
button: {
width: 100,
height: 50,
backgroundColor: '#eb6117',
alignSelf: 'center',
marginTop: 15,
}
});
В основном Mathjax рендерит веб-просмотр, я думаю, что это
невозможно изменить размер. Пожалуйста, помогите мне решить это. я
действительно в большой проблеме.
Заранее спасибо.