import { WebView } from "@tarojs/components";
import Taro, { FC, useRouter } from "@tarojs/taro";
import { useEffect } from "react";

const IframePage: FC = () => {
  const route = useRouter();

  useEffect(() => {
    if (route.params.title) {
      Taro.setNavigationBarTitle({
        title: route.params.title,
      });
    }
  }, []);

  return route.params.url ? (
    <WebView src={decodeURIComponent(route.params.url)} />
  ) : null;
};

export default IframePage;
