import * as WebBrowser from 'expo-web-browser';
import * as React from 'react';
import { Dimensions, View } from 'react-native';
import { WebView } from 'react-native-webview';
import { useCreation } from '@umijs/hooks';

export default function MapScreen({ orderInfo }) {
  // console.log(orderInfo);

  const { location, merchant, status, merchantStatus, riderStatus } = orderInfo;

  const merchantLocation = useCreation(() => {
    if (merchant) {
      return `${merchant.longitude},${merchant.latitude}`;
    } else {
      return '';
    }
  }, [merchant]);

  return (
    <WebView
      source={{
        uri: `http://dingdong.izouma.com/map/home?location=${location}&merchantLocation=${merchantLocation}&status=${status}&merchantStatus=${merchantStatus}&riderStatus=${riderStatus}`,
      }}
    />
  );
}
