From 0ed1fe9fa115571eb35953cbc96bd3405975190f Mon Sep 17 00:00:00 2001 From: Getabalew Tesfaye Date: Tue, 20 Feb 2024 22:11:45 +0300 Subject: [PATCH] fix: add check before accessing a value --- __mocks__/@react-native-community/netinfo.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__mocks__/@react-native-community/netinfo.ts b/__mocks__/@react-native-community/netinfo.ts index 0b7bdc9010a3..15f2aeb1cfd3 100644 --- a/__mocks__/@react-native-community/netinfo.ts +++ b/__mocks__/@react-native-community/netinfo.ts @@ -2,12 +2,12 @@ import {NetInfoCellularGeneration, NetInfoStateType} from '@react-native-communi import type {addEventListener, configure, fetch, NetInfoState, refresh, useNetInfo} from '@react-native-community/netinfo'; const defaultState: NetInfoState = { - type: NetInfoStateType.cellular, + type: NetInfoStateType?.cellular, isConnected: true, isInternetReachable: true, details: { isConnectionExpensive: true, - cellularGeneration: NetInfoCellularGeneration['3g'], + cellularGeneration: NetInfoCellularGeneration ? NetInfoCellularGeneration['3g'] : null, carrier: 'T-Mobile', }, };