Merge commit '610f9c21ce7d8bb65c1871c98963fcd2f68fffb0' into feature/refactoring-inject-javascript

This commit is contained in:
harukin-OneMix4 2023-06-27 22:37:09 +09:00
commit 84efa42e57
2 changed files with 9 additions and 3 deletions

View File

@ -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 (
<ActionSheet

7
lib/getPdfViewURL.js Normal file
View File

@ -0,0 +1,7 @@
import { Platform } from "react-native";
export const getPDFViewURL = (url) => {
if (Platform.OS == "ios") return url;
else
return `https://docs.google.com/viewer?url=${encodeURI(url)}&embedded=true`;
};