| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- import { StackScreenProps } from '@react-navigation/stack';
- import * as React from 'react';
- import { Div, Button, Image, Text, Avatar } from 'react-native-magnus';
- import { ScrollView } from 'react-native-gesture-handler';
- import { WebView } from 'react-native-webview';
- import { useTranslation } from 'react-i18next';
- import { useMount } from 'ahooks';
- import * as Linking from 'expo-linking';
- import {
- toastShow,
- toastHide,
- toastInfo,
- toastSuccess,
- } from '../utils/SystemUtils';
- import useModel from 'flooks';
- import MapModel from './model';
- import { tengxunKey } from '../utils/MapUtils';
- export default function RoutePlanScreen({ navigation, route }) {
- const { t } = useTranslation();
- const { getNowLocation } = useModel(MapModel, []);
- const [mapUrl, setmapUrl] = React.useState<string>('');
- const { params } = route;
- const { toName, tocoord } = params;
- useMount(() => {
- toastShow();
- console.log(params);
- getNowLocation().then((res) => {
- let location = '';
- if (res.addressName !== '定位失败') {
- location = `${res.location.lat},${res.location.lng}`;
- }
- // setmapUrl(
- // `https://apis.map.qq.com/uri/v1/routeplan?type=drive&fromcoord=${location}&to=${toName}&tocoord=${tocoord}&policy=1&referer=${tengxunKey}`
- // );
- toastHide();
-
- });
- });
- return (
- <>
- {/* {!!mapUrl && (
- <WebView
- source={{
- uri: mapUrl,
- }}
- style={{ flexGrow: 1, width: '100%' }}
- />
- )} */}
- </>
- );
- }
|