jrshikoku/trainbaseview.js
2022-11-05 19:11:14 +09:00

34 lines
1.1 KiB
JavaScript

import React, { Component, useRef } from "react";
import { StatusBar, Platform, View } from "react-native";
import { WebView } from "react-native-webview";
export default function TrainBase({ route }) {
const { info } = route.params;
const webview = useRef();
const jss = `document.getElementById('Footer').style.display = 'none';
${
Platform.OS == "ios" &&
`document.getElementsByTagName("html")[0].style['font-size'] = '11px';`
}`;
//const jss = `alert("ほげ")`;
return (
<View style={{ height: "100%" }}>
{Platform.OS == "ios" && <StatusBar barStyle="dark-content" />}
<WebView
//useWebKit={true}
ref={webview}
source={{ uri: "https://train.jr-shikoku.co.jp/" + info }}
originWhitelist={[
"https://train.jr-shikoku.co.jp",
"https://train.jr-shikoku.co.jp/sp.html",
]}
mixedContentMode={"compatibility"}
javaScriptEnabled={true}
injectedJavaScript={jss}
setSupportMultipleWindows={false}
onMessage={(event) => {}}
/>
</View>
);
}