答案 0 :(得分:0)
我建议您将注释字符串一分为二,然后很容易分开,这是一个非常简单的示例:
import React, { Component } from 'react';
import { Text, StyleSheet } from 'react-native';
export default class TextComponent extends Component {
constructor(props) {
super(props);
this.state = {
titleText: "Hi there,",
bodyText: 'Redmi 3S/Prime will receive the MIUI 9 stable UPdate in mid-late December. Stay...'
};
}
render() {
return (
<Text style={styles.baseText}>
<Text style={styles.titleText}>
{this.state.titleText}{'\n'}
</Text>
<Text numberOfLines={5}>
{this.state.bodyText}
</Text>
</Text>
);
}
}
const styles = StyleSheet.create({
baseText: {
fontFamily: 'Cochin',
},
titleText: {
fontWeight: 'bold',
},
});