iOSでのトレインビューの挙動修正

This commit is contained in:
harukin-DeskMini 2022-09-28 07:15:02 +09:00
parent 2a3fd7774d
commit 209568df4c
2 changed files with 22 additions and 8 deletions

View File

@ -67,7 +67,7 @@ export default function Setting(props) {
textAlignVertical: "center", textAlignVertical: "center",
}} }}
> >
内部バージョン: 4.3.2 内部バージョン: 4.3.3
</Text> </Text>
<View style={{ flex: 1 }} /> <View style={{ flex: 1 }} />
</View> </View>

View File

@ -1,18 +1,32 @@
const WEBVIEW = "WEBVIEW"; import React, { Component, useRef } from "react";
import React, { Component } from "react"; import { StatusBar, Platform, View } from "react-native";
import { StatusBar, View } from "react-native";
import { WebView } from "react-native-webview"; import { WebView } from "react-native-webview";
const jss = `document.getElementById('Footer').style.display = 'none';`;
export default function trainbase({ route, navigation }) { export default function TrainBase({ route }) {
const { info } = route.params; 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("ほげ")`;
console.log(info); console.log(info);
return ( return (
<View style={{ height: "100%" }}> <View style={{ height: "100%" }}>
<WebView <WebView
//useWebKit={true}
ref={webview}
source={{ uri: "https://train.jr-shikoku.co.jp/" + info }} source={{ uri: "https://train.jr-shikoku.co.jp/" + info }}
useWebKit={true} originWhitelist={[
originWhitelist={["https://train.jr-shikoku.co.jp"]} "https://train.jr-shikoku.co.jp",
"https://train.jr-shikoku.co.jp/sp.html",
]}
mixedContentMode={"compatibility"}
javaScriptEnabled={true}
injectedJavaScript={jss} injectedJavaScript={jss}
setSupportMultipleWindows={false}
onMessage={(event) => {}}
/> />
</View> </View>
); );