index.tsx 674 Bytes
Newer Older
silver47gin's avatar
silver47gin committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
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;