Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6480

Button to reload the screen when the WiFi is off

$
0
0

I have a screen that I verify if the WiFi is connected. If the WiFi is off I show in the screen a message and a button Try Again but I would like to click in this button and refresh the screen.

WiFiError Component

import React, { useCallback } from 'react';import { useNavigation } from '@react-navigation/native';import Title from '../Title';import Description from '../Description';import { View, Button, Text } from './styles';interface IWifiErrorProps {  text: string;  navigateTo: string;}const WifiError: React.FC<IWifiErrorProps> = ({ text, navigateTo  }) => {  const navigation = useNavigation();  const handleRefreshTheScreen = useCallback((navigateTo) => {    navigation.navigate(navigateTo);  }, [navigation]);  return (<View><Title title='Ocorreu um erro.' /><Description description={`Não foi possível se conectar ao banco de ${text}.`} /><Button onPress={() => handleRefreshTheScreen(navigateTo)}><Text>TENTAR NOVAMENTE</Text></Button></View>  );}export default WifiError;

When I turn off the WiFi at Dashboard and I navigate to "Ações" appear this as a warning "Possible Unhandled Promise Rejection".


Viewing all articles
Browse latest Browse all 6480

Trending Articles


FLASHBACK WITH SIRASA FM AT GALGAMUWA 2022


Mp3 Download: Mdu - Mazola


Imitation gun was fired at motorist in Leicester road-rage incident


Ndebele names


MCKINNEY EMALINE “EMMA” OF WES...


Okra & Motia — The Workshop (Prod by Hammer)


Skint TV teen to be sentenced


Moondru Mudichu 19-09-2017 – Polimer tv Serial


YOSVANI JAMES Arrested by Miami-Dade County Corrections on Jan 10, 2017


Stories • Goddess Stepmom