Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-offline",
"version": "4.3.1",
"version": "4.4.0-compat1",
"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 <raulgdeveloper@gmail.com> (https://github.com/rgommezz)",
Expand Down Expand Up @@ -63,16 +63,15 @@
"react-native": "^0.57.8",
"react-native-testing-library": "^1.5.0",
"react-test-renderer": "^16.6.3",
"redux": "^4.0.1",
"redux-mock-store": "^1.5.3",
"redux-saga-test-plan": "4.0.0-beta.2",
"redux-thunk": "^2.3.0"
},
"dependencies": {
"lodash": "^4.17.11",
"react-redux": "^6.0.0",
"redux": "4.x",
"redux-saga": "^1.0.2"
"@react-native-community/netinfo": "~2.0.10",
"react-redux": "^5.1.1",
"redux": "~4.0"
},
"jest": {
"collectCoverage": true,
Expand Down
3 changes: 2 additions & 1 deletion src/components/NetworkConnectivity.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */
import * as React from 'react';
import { AppState, NetInfo, Platform } from 'react-native';
import { AppState, Platform } from 'react-native';
import NetInfo from '@react-native-community/netinfo';
import type { HTTPMethod, State } from '../types';
import * as connectivityInterval from '../utils/checkConnectivityInterval';
import checkInternetAccess from '../utils/checkInternetAccess';
Expand Down
9 changes: 9 additions & 0 deletions src/components/ReduxNetworkProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ class ReduxNetworkProvider extends React.Component<Props> {
httpMethod: DEFAULT_HTTP_METHOD,
};

shouldComponentUpdate({ isConnected }) {
const { isConnected: wasConnected } = this.props;
if (isConnected !== wasConnected) {
return false;
}

return true;
}

handleConnectivityChange = (isConnected: boolean) => {
const { isConnected: wasConnected, dispatch } = this.props;
if (isConnected !== wasConnected) {
Expand Down
3 changes: 0 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ module.exports = {
get offlineActionTypes() {
return require('./redux/actionTypes').default;
},
get networkSaga() {
return require('./redux/sagas').default;
},
get checkInternetConnection() {
return require('./utils/checkInternetConnection').default;
},
Expand Down
256 changes: 0 additions & 256 deletions src/redux/sagas.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/utils/checkInternetConnection.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* @flow */

import { NetInfo } from 'react-native';
import NetInfo from '@react-native-community/netinfo';
import checkInternetAccess from './checkInternetAccess';
import { DEFAULT_PING_SERVER_URL, DEFAULT_TIMEOUT } from './constants';

Expand Down
2 changes: 1 addition & 1 deletion test/checkInternetConnection.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { NetInfo } from 'react-native';
import NetInfo from '@react-native-community/netinfo';
import checkInternetConnection from '../src/utils/checkInternetConnection';
import checkInternetAccess from '../src/utils/checkInternetAccess';
import {
Expand Down
2 changes: 1 addition & 1 deletion test/sagaChannels.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { eventChannel } from 'redux-saga';
import { NetInfo } from 'react-native';
import NetInfo from '@react-native-community/netinfo';
import {
createNetInfoConnectionChangeChannel,
netInfoEventChannelFn,
Expand Down
3 changes: 2 additions & 1 deletion test/sagas.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* @flow */
import { testSaga } from 'redux-saga-test-plan';
import { Platform, NetInfo, AppState } from 'react-native';
import { Platform, AppState } from 'react-native';
import NetInfo from '@react-native-community/netinfo';
import networkSaga, {
netInfoChangeSaga,
connectionIntervalSaga,
Expand Down
Loading