diff --git a/packages/mobile-app/app/(drawer)/app-settings/network/index.tsx b/packages/mobile-app/app/(drawer)/app-settings/network/index.tsx index 9b60bad..6429d4f 100644 --- a/packages/mobile-app/app/(drawer)/app-settings/network/index.tsx +++ b/packages/mobile-app/app/(drawer)/app-settings/network/index.tsx @@ -5,6 +5,7 @@ import { Text, View, ActivityIndicator, + TouchableOpacity, } from "react-native"; import { useState } from "react"; import { useFacade } from "@/data/facades"; @@ -15,6 +16,7 @@ import { AccountFormat } from "@ironfish/sdk"; export default function MenuNetwork() { const [modalVisible, setModalVisible] = useState(false); const [isChangingNetwork, setIsChangingNetwork] = useState(false); + const [pendingNetwork, setPendingNetwork] = useState(null); const facade = useFacade(); const setAppSetting = facade.setAppSetting.useMutation(); @@ -25,8 +27,13 @@ export default function MenuNetwork() { const currentNetwork = networkSetting.data?.[SettingsKey.Network] ?? Network.MAINNET; - const targetNetwork = - currentNetwork === Network.MAINNET ? Network.TESTNET : Network.MAINNET; + + const handleNetworkPress = (network: Network) => { + if (network !== currentNetwork) { + setPendingNetwork(network); + setModalVisible(true); + } + }; const handleNetworkChange = async (network: Network) => { setIsChangingNetwork(true); @@ -58,6 +65,7 @@ export default function MenuNetwork() { } finally { setIsChangingNetwork(false); setModalVisible(false); + setPendingNetwork(null); } }; @@ -72,59 +80,85 @@ export default function MenuNetwork() { return ( - - - {isChangingNetwork ? ( - <> - - - Changing network and re-importing accounts... - - - ) : ( - <> - Switch to {targetNetwork}? - - Switching networks will upload your accounts to the{" "} - {targetNetwork} server. It may take a few minutes for your - accounts to sync. - -