@react-native-community/netinfo
Version:
React Native Network Info API for iOS & Android
2 lines • 1.06 kB
JavaScript
import{Platform}from'react-native';import*as Types from'./types';export function convertState(input){var effectiveType='unknown';if(input.type==='cellular'){effectiveType=input.details.cellularGeneration||'unknown';}return{type:input.type,effectiveType:effectiveType};}export function isConnectionExpensive(input){if(Platform.OS==='android'){if(input.type!==Types.NetInfoStateType.none&&input.type!==Types.NetInfoStateType.unknown){return input.details.isConnectionExpensive;}else{return false;}}else{throw new Error('Currently not supported on iOS');}}export function isConnected(input){return input.isConnected;}var warned=false;export function warnOnce(){if(warned){return;}console.warn('Warning: RNCNetInfo - You are using the deprecated API. It will still work, but you must upgrade to the new API to receive the new features. The old API will be removed in the future');warned=true;}export default{convertState:convertState,isConnectionExpensive:isConnectionExpensive,isConnected:isConnected,warnOnce:warnOnce};
//# sourceMappingURL=deprecatedUtils.js.map