BikeApp_demoss/src/views/Home/MiniMap.tsx

48 lines
977 B
TypeScript
Raw Normal View History

2024-11-07 17:47:25 +08:00
import React from 'react';
import { View, StyleSheet } from 'react-native';
import { MapView, Marker } from 'react-native-amap3d';
import { rpx } from '../../utils/rpx';
const MiniMap = () => {
return (
<View style={styles.container}>
<MapView
style={styles.map}
initialCameraPosition={{
target: {
latitude: 39.9042,
longitude: 116.4074,
},
zoom: 15, // 缩放级别
}}
>
<Marker
position={{
latitude: 39.9042,
longitude: 116.4074,
}}
/>
</MapView>
</View>
);
};
// styles 保持不变
const styles = StyleSheet.create({
container: {
marginTop: rpx(44),
width: rpx(688),
height: rpx(380),
borderRadius: rpx(20),
overflow: 'hidden', // Ensure rounded corners are applied to the map
},
map: {
width: '100%',
height: '100%',
},
});
export default MiniMap;