From f815b317203b33c719e053857c8df6bfbe6e82fd Mon Sep 17 00:00:00 2001 From: harukin-OneMix4 Date: Mon, 26 Jun 2023 00:34:51 +0900 Subject: [PATCH] =?UTF-8?q?pdf=E3=82=92iOS=E3=81=A8Android=E3=81=A7?= =?UTF-8?q?=E3=82=A2=E3=83=89=E3=83=AC=E3=82=B9=E5=A4=89=E6=8F=9B=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/ActionSheetComponents/StationDeteilView.js | 5 ++--- lib/getPdfViewURL.js | 7 +++++++ 2 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 lib/getPdfViewURL.js diff --git a/components/ActionSheetComponents/StationDeteilView.js b/components/ActionSheetComponents/StationDeteilView.js index b9dcc6e..4817bc2 100644 --- a/components/ActionSheetComponents/StationDeteilView.js +++ b/components/ActionSheetComponents/StationDeteilView.js @@ -20,6 +20,7 @@ import { heightPercentageToDP as hp, } from "react-native-responsive-screen"; import lineColorList from "../../assets/originData/lineColorList"; +import { getPDFViewURL } from "../../lib/getPdfViewURL"; export const StationDeteilView = (props) => { const { @@ -46,9 +47,7 @@ export const StationDeteilView = (props) => { const info = currentStation && (currentStation[0].StationTimeTable.match(".pdf") - ? `https://docs.google.com/viewer?url=${encodeURI( - currentStation[0].StationTimeTable - )}&embedded=true` + ? getPDFViewURL(currentStation[0].StationTimeTable) : currentStation[0].StationTimeTable); return ( { + if (Platform.OS == "ios") return url; + else + return `https://docs.google.com/viewer?url=${encodeURI(url)}&embedded=true`; +};