如何在react native中为png的图像后面添加文本



这是我真正想要的的链接

https://www.google.com/url?sa=i&url=https%3A%2F%2Fww.photosheessentials.com%2Fphoto effects%2F将文本放在对象photoshop%2F&psig=AOvVaw1hDtDiS8z1fcdcHG0YSX3e&ust=1585469975211000&source=图像&cd=vfe&ved=0CAIQjRxqFwoTCKCzh4nevOgCFQAAAAAdAAAAABAD

伙计们,我想在react native中的图像(.png(后面添加一个文本?有ImageBackground。我只需要ImageForeground。

renderContactsItem = ({ item}) => {
return (
<View style={styles.container}>
<TouchableOpacity style={styles.itemContainer}
onPress={() => this.props.navigation.navigate('Modal',{selectedItem:item},)}
>
<View style={[styles.card,{backgroundColor:item.color}]}>
<Image
style={styles.avatar}
source={ item.picture }
/>
</View>
</TouchableOpacity>
</View> 
)

};

<View>
<Text style={{ position: 'absolute', fontSize: 50 }}>
Your Text to display
</Text>
<Image style={{ position: 'absolute' }} source={require('../yourImagePath')} />
</View>

你需要围绕这一点来设计你的风格。我希望这对你有用,只要根据你的要求设计组件的样式,以备你需要更多的东西。

您应该使用ImageBackground而不是Image

<View style={styles.container}>
<ImageBackground source={image} style={styles.image}>
<Text style={styles.text}>Inside</Text>
</ImageBackground>
</View>

请浏览官方文件-这里是

最新更新