import React from "react";
import { View } from "react-native";
import { WebView } from "react-native-webview";
import { BigButton } from "./components/atom/BigButton";
import { useNavigation } from "@react-navigation/native";
export default ({ navigation: { navigate }, route }) => {
  if (!route.params) {
    return null
  }
  const { info, goTo, useShow } = route.params;
  const { goBack } = useNavigation();
  const onExit = () => {
    if (goTo != "NearTrainDiagramView") {
      //navigate(goTo || "Apps");
      useShow && useShow();
    }
    goBack();
  };
  return (
    <View style={styles}>
      <WebView
        useWebKit
        source={{ uri: info.replace("http://", "https://") }}
      />
      <BigButton onPress={onExit} string="閉じる" />
    </View>
  );
};
const styles = { height: "100%", backgroundColor: "#0099CC" };
