我正在尝试将图像放置在视图中的文本上。我试图这样定位它:
我只是在视图中将图像居中时遇到了一些麻烦。这是代码:
<View style={styles.trackerBox}>
<Text style={styles.trackerName}>Test</Text>
<Image
source={{
uri: "https://imageLink.png"
}}
style={styles.logo}
/>
{this.props.user.test_trackers
.map(x => x.type)
.includes("test") ? (
<Icon
name="check-circle"
color={"#00FF00"}
size={25}
style={styles.linked}
/>
) : null}
</View>
和风格:
trackerBox: {
width: width * 0.3,
borderRadius: 20,
backgroundColor: "#19405D",
height: width * 0.3,
justifyContent: "center"
},
trackerName: {
textAlign: 'center',
color: "white",
fontSize: 20,
},
logo: {
height: 25,
width: 25,
position: "absolute",
top: 10,
right: 0,
left: 0
},