我正在开发一个带有React Native电子邮件收件箱的应用程序。我想在主题末尾显示主题标签。该主题有时可以包装,而我不知道如何使主题标签仍能正确显示。这是一些示例代码:
import * as React from 'react';
import { Text, View, StyleSheet } from 'react-native';
export default class App extends React.Component {
render() {
return (
<View style={{marginLeft:20, marginRight:20, marginTop: 50}}>
<Text style={{fontSize:18}}>
This is my really long subject line. Blah blah blah blah.
<View key='1' style={[styles.hashtagContainerStyle, { backgroundColor: 'grey' }]}>
<Text style={[styles.hashtagTextStyle, { backgroundColor: 'grey' }]}>
#Hashtag
</Text>
</View>
<View key='2' style={[styles.hashtagContainerStyle, { backgroundColor: 'grey' }]}>
<Text style={[styles.hashtagTextStyle, { backgroundColor: 'grey' }]}>
#Hashtag2
</Text>
</View>
</Text>
<Text style={{fontSize: 14}}>
Duis ut ut eiusmod ut cillum nisi non ea commodo eu et reprehenderit laboris minim incididunt consequat velit laborum sint eiusmod mollit consequat cillum proident est eiusmod duis.
</Text>
</View>
);
}
}
const styles = StyleSheet.create({
hashtagContainerStyle: {
marginTop: 2,
marginLeft: 4,
marginRight: 4,
marginBottom: 2,
borderRadius: 10,
alignItems: 'center',
justifyContent: 'center',
},
hashtagTextStyle: {
fontSize: 12,
color: 'white',
},
});