import React from "react";
import { View, Text, TouchableOpacity } from "react-native";
import { WebView } from "react-native-webview";
import StatusbarDetect from "../StatusbarDetect";
import { AS } from "../storageControl";
import { news } from "../config/newsUpdate";
var Status = StatusbarDetect();
export default function News(props) {
  const {
    navigation: { navigate },
  } = props;
  return (
    <View style={{ height: "100%", backgroundColor: "#0099CC" }}>
      <WebView
        useWebKit={true}
        source={{
          uri: `https://nexcloud.haruk.in/sites/press-harukin/JRShikokuApps/${news}`,
        }}
        mixedContentMode={"compatibility"}
        javaScriptEnabled={true}
      />
      <TouchableOpacity
        style={{
          padding: 10,
          flexDirection: "row",
          borderColor: "white",
          borderWidth: 1,
          margin: 10,
          borderRadius: 5,
          alignItems: "center",
        }}
        onPress={() => {
          AS.setItem("status", news);
          navigate("Apps");
        }}
      >
        <View style={{ flex: 1 }} />
        <Text style={{ fontSize: 25, fontWeight: "bold", color: "white" }}>
          更新情報を閉じる
        </Text>
        <View style={{ flex: 1 }} />
      </TouchableOpacity>
    </View>
  );
}
