【发布时间】:2018-05-07 13:47:37
【问题描述】:
我在 react-native 中有一个谷歌地图。在该视图的顶部,我在地图上有图标,这些图标彼此重叠放置,而不是放置在地图的任一侧。我尝试了许多不同的设置,但结果总是相同。另一件事是,当我不点击它时,按钮会做出反应。
我有容器,然后容器内有 mapview。代码如下:
container: {
flex: 1,
flexDirection: 'column'
},
map:{
height: 90+ "%",
flexDirection: 'column'
},
profileBtn:{
position: 'absolute',
top: 25,
right: 30,
width: 25,
height: 15,
borderRadius: 25/2,
},
homeBtn:{
position: 'absolute',
top: 20,
left: 5,
width: 200,
height: 100,
borderRadius: 25/2,
},
<MapView
style={styles.map}
initialRegion={{
latitude:this.state.latitude,
longitude:this.state.longitude,
latitudeDelta: 0.0043,
longitudeDelta: 0.0034
}}
ref={c => this.mapView = c}
onPress={this.onMapPress}
loadingEnabled={true}
>
<View style ={styles.topMap}>
<TouchableOpacity
style={styles.profileBtn}
onPress={()=>{ this.handleClickProfile() }}
>
<Image
source={profile}
borderRadius={17}
/>
</TouchableOpacity>
<TouchableOpacity
style={styles.homeBtn}
onPress={()=>{ this.handleClickFavourite() }}
>
<Image
source={require("./home.png")}
borderRadius={49}
/>
</TouchableOpacity>
</View>
{markers}
【问题讨论】:
-
你也可以添加
MapView的代码吗? -
添加到 op.谢谢!
标签: javascript css reactjs react-native