import { MapView, MapType } from "react-native-amap3d"; import { View, Button } from "@tarojs/components"; import { useAmap, useAmapGeoLocation } from "../../hooks/useAmap"; const Sign = () => { useAmap(); const getCurrentPosition = useAmapGeoLocation(); return ( <View> <Button onClick={async () => console.log(await getCurrentPosition())}> 获取定位地址 </Button> <MapView mapType={MapType.Standard} initialCameraPosition={{ target: { latitude: 39.91095, longitude: 116.37296, }, zoom: 8, }} ></MapView> </View> ); }; export default Sign;