import React, { useEffect, useRef, useState } from "react"; import { View, Text, TouchableOpacity, Platform, Image, BackHandler, } from "react-native"; import { MaterialCommunityIcons } from "@expo/vector-icons"; import ActionSheet, { SheetManager } from "react-native-actions-sheet"; import { useSafeAreaInsets } from "react-native-safe-area-context"; import ViewShot from "react-native-view-shot"; import * as Sharing from "expo-sharing"; import icons from "../../assets/icons/icons"; import { getAppIconName } from "expo-alternate-app-icons"; import { AS } from "@/storageControl"; export const TrainIconUpdate = () => { const [iconList] = useState(icons()); const [currentIcon] = useState(getAppIconName()); const actionSheetRef = useRef(null); const insets = useSafeAreaInsets(); const viewShot = useRef(null); const onCapture = async () => { const url = await viewShot.current.capture(); const ok = await Sharing.isAvailableAsync(); if (ok) { await Sharing.shareAsync( "file://" + url, (options = { mimeType: "image/jpeg", dialogTitle: "Share this image" }) ); } }; return ( } onClose={() => { AS.setItem("isSetIcon", "false"); }} ref={actionSheetRef} isModal={Platform.OS == "ios"} containerStyle={ Platform.OS == "android" ? { paddingBottom: insets.bottom, } : {} } useBottomSafeAreaPadding={Platform.OS == "android"} > アイコンを変更しました! {currentIcon ? ( id == currentIcon)[0].icon} style={{ width: 50, height: 50, padding: 30, borderWidth: 1, borderRadius: 10, borderColor: "white", margin: 10, backgroundColor: "white", }} /> JR四国非公式アプリ ) : ( <> )} JR四国非公式アプリを更新して好きなアイコンに変更してみよう! 推しアイコンをシェア ); }; const Handler = () => { useEffect(() => { const backAction = () => { SheetManager.hide("JRSTraInfo"); return true; }; const backHandler = BackHandler.addEventListener( "hardwareBackPress", backAction ); return () => backHandler.remove(); }, []); return <>; };