我正在尝试添加
hiện hữu
.应该看起来像这样 -
这是我的代码 -
<>
mapType='standard'
style={styles.map}
region={{
latitude: selectedLoc.location.latitude,
longitude: selectedLoc.location.longitude,
latitudeDelta: 0.005,
longitudeDelta: 0.005
}}
onRegionChange={() => { } }
onRegionChangeComplete={() => { } }
showsUserLocation={false}
zoomEnabled={false}
draggable={false}
annotations={[{
longitude: selectedLoc.location.latitude,
latitude: selectedLoc.location.longitude,
title: selectedLoc.title
}]}
initialRegion={{
latitude: selectedLoc.location.latitude,
longitude: selectedLoc.location.longitude
}}>
<>
style={{
width: 50,
height: 50,
}}
resizeMode={"contain"}
source={{ uri: 'https://unsplash.it/50/50/?random' }}
/>
我没有从这段代码中获得任何顶部 View 。请告诉我
首先,你必须了解一些关于react-native View 配置的规则。在 iOS 上,重叠 View 以渲染方法中指定的相同顺序呈现(如果您有两个 View ,第二个将是最可见的)。在 Android 上,重叠的 View 、超出范围的 View 将被切断。
无论如何,在您的情况下,您不能只添加具有高度和宽度的图像。你必须提供这个的配置。
我建议你添加一些样式:
{ position: 'absolute',
bottom: 10,
right: 10,
width: 50,
height: 50 }
使用此样式,您的图像应显示在 map 的右下角。
Tôi là một lập trình viên xuất sắc, rất giỏi!