我有以下几点:
import React from 'react';
import { StyleSheet, Text, View, TouchableOpacity } from "react-native";
function ActivationHelpText({onPress}) {
return (
<View style={styles.container}>
<Text style={styles.text}>Activation can take up-to 24hrs, once your profile is complete.
<Text style={styles.learnMoreButton}> Learn more.</Text>
</Text>
</View>
);
}
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
paddingVertical: 10,
},
text: {
color: 'black',
fontSize: 14,
paddingHorizontal:5,
},
learnMoreButton: {
fontWeight:'bold',
paddingTop: 20
}
})
export default ActivationHelpText
我想对Learn More
文本进行换行:
<Text style={styles.learnMoreButton}> Learn more.</Text>
在<Pressable>
或<TouchableOpacity>
中
示例:
<View style={styles.container}>
<Text style={styles.text}>Activation can take up-to 24hrs, once your profile is complete.
<TouchableOpacity onPress={onPress}>
<Text style={styles.learnMoreButton}> Learn more.</Text>
</TouchableOpacity>
</Text>
</View>
当我把它包装在<Pressable>
或<TouchableOpacity>
中时,样式都搞乱了:
在应用<Pressable>
或<TouchableOpacity>
之前
在应用<Pressable>
或<TouchableOpacity>
之后
我尝试过对<Text>
组件同时应用text
和learnMoreButton
样式,但是这些样式变得混乱了。
有什么建议吗?
发布于 2021-07-07 14:49:04
发布于 2021-07-07 22:10:36
此外,你需要小心,如果你在android的文本内包装文本,你会失去一些样式…
https://stackoverflow.com/questions/68288133
复制