diff --git a/package.json b/package.json index 5cdfcdcd..a68c1d35 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-offline", - "version": "3.12.0", + "version": "3.13.0", "description": "Handy toolbelt to deal with offline mode in React Native applications. Cross-platform, provides a smooth redux integration.", "main": "./src/index.js", "author": "Raul Gomez Acuña (https://github.com/rgommezz)", @@ -12,7 +12,7 @@ "flow": "flow", "format": "eslint --fix js/**/", "prettier": "prettier --single-quote --trailing-comma all --write \"src/**/*.js\"", - "jest:coverage": "node --harmony_proxies node_modules/.bin/jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", + "jest:coverage": "node --harmony node_modules/.bin/jest --coverage && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js", "precommit": "yarn run lint" }, "repository": { diff --git a/src/sagas.js b/src/sagas.js index 31769851..0b2bc69f 100644 --- a/src/sagas.js +++ b/src/sagas.js @@ -144,14 +144,12 @@ function* handleConnectivityChange( * @param withExtraHeadRequest * @param checkConnectionInterval */ -export default function* networkEventsListenerSaga( - { - timeout = 3000, - pingServerUrl = 'https://www.google.com/', - withExtraHeadRequest = true, - checkConnectionInterval = 0, - }: Arguments = {}, -): Generator<*, *, *> { +export default function* networkEventsListenerSaga({ + timeout = 3000, + pingServerUrl = 'https://www.google.com/', + withExtraHeadRequest = true, + checkConnectionInterval = 0, +}: Arguments = {}): Generator<*, *, *> { yield fork(netInfoChangeSaga, timeout, pingServerUrl, withExtraHeadRequest); if (checkConnectionInterval) { yield fork( diff --git a/src/withNetworkConnectivity.js b/src/withNetworkConnectivity.js index c966a130..bd5800c5 100644 --- a/src/withNetworkConnectivity.js +++ b/src/withNetworkConnectivity.js @@ -28,18 +28,16 @@ type State = { isConnected: boolean, }; -const withNetworkConnectivity = ( - { - withRedux = false, - timeout = 3000, - pingServerUrl = 'http://www.google.com/', - withExtraHeadRequest = true, - checkConnectionInterval = 0, - checkIntervalOfflineOnly = false, - checkInBackground = false, - httpMethod = 'HEAD', - }: Arguments = {}, -) => (WrappedComponent: ReactClass<*>) => { +const withNetworkConnectivity = ({ + withRedux = false, + timeout = 3000, + pingServerUrl = 'http://www.google.com/', + withExtraHeadRequest = true, + checkConnectionInterval = 0, + checkIntervalOfflineOnly = false, + checkInBackground = false, + httpMethod = 'HEAD', +}: Arguments = {}) => (WrappedComponent: ReactClass<*>) => { if (typeof withRedux !== 'boolean') { throw new Error('you should pass a boolean as withRedux parameter'); } @@ -51,7 +49,9 @@ const withNetworkConnectivity = ( } class EnhancedComponent extends PureComponent { - static displayName = `withNetworkConnectivity(${WrappedComponent.displayName})`; + static displayName = `withNetworkConnectivity(${ + WrappedComponent.displayName + })`; static contextTypes = { store: PropTypes.shape({ @@ -112,13 +112,11 @@ const withNetworkConnectivity = ( if (checkInBackground === false && AppState.currentState !== 'active') { return; // <-- Return early as we dont care about connectivity if apps' not in foreground. } - checkInternetAccess( - timeout, - pingServerUrl, - httpMethod, - ).then((hasInternetAccess: boolean) => { - this.handleConnectivityChange(hasInternetAccess); - }); + checkInternetAccess(timeout, pingServerUrl, httpMethod).then( + (hasInternetAccess: boolean) => { + this.handleConnectivityChange(hasInternetAccess); + }, + ); }; handleConnectivityChange = (isConnected: boolean) => {