Skip to content

Commit

Permalink
Upgrading redux-offline and netinfo dependencies for react native (#551)
Browse files Browse the repository at this point in the history
* Upgrading redux-offline and netinfo dependencies for react native

* update peerdependencies & readme

Co-authored-by: Alex Hinson <alexmhinson@gmail.com>
  • Loading branch information
Ashish-Nanda and amhinson committed Jul 8, 2020
1 parent 499dbf7 commit d6a99d9
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 17 deletions.
24 changes: 12 additions & 12 deletions README.md
Expand Up @@ -8,10 +8,10 @@
![npm](https://img.shields.io/npm/dm/aws-appsync.svg)


package | version
--- | ---
aws-appsync | ![npm](https://img.shields.io/npm/v/aws-appsync.svg)
aws-appsync-react | ![npm](https://img.shields.io/npm/v/aws-appsync-react.svg)
| package | version |
| ----------------- | ---------------------------------------------------------- |
| aws-appsync | ![npm](https://img.shields.io/npm/v/aws-appsync.svg) |
| aws-appsync-react | ![npm](https://img.shields.io/npm/v/aws-appsync-react.svg) |


## Installation
Expand All @@ -34,23 +34,23 @@ For version <= 2.x.x, the selection set for the subscription will be the mutatio
When using this library with React Native, you need to ensure you are using the correct version of the library based on your version of React Native. Take a look at the table below to determine what version to use.


| `aws-appsync` version | Required React Native Version
| ----------------------------------------- | -------------------------------------------------------------------------------- |
| `2.x.x` | `>= 0.60`
| `1.x.x` | `<= 0.59`
| `aws-appsync` version | Required React Native Version |
| --------------------- | ----------------------------- |
| `2.x.x` | `>= 0.60` |
| `1.x.x` | `<= 0.59` |

If you are using React Native `0.60` and above, you also need to install `@react-native-community/netinfo`:
If you are using React Native `0.60` and above, you also need to install `@react-native-community/netinfo` and `@react-native-community/async-storage`:

```
npm install --save @react-native-community/netinfo@4.7.0
npm install --save @react-native-community/netinfo@5.9.4 @react-native-community/async-storage
```
or
```
yarn add @react-native-community/netinfo@4.7.0
yarn add @react-native-community/netinfo@5.9.4 @react-native-community/async-storage
```
If you are using React Native `0.60+` for iOS, run the following command as an additional step:
```
cd ios && pod install && cd ..
npx pod-install
```
## Usage

Expand Down
5 changes: 2 additions & 3 deletions packages/aws-appsync-react/package.json
Expand Up @@ -21,13 +21,12 @@
"prop-types": "^15.6.0"
},
"peerDependencies": {
"@react-native-community/netinfo": "4.x.x",
"aws-appsync": "3.x.x",
"react": "0.14.x || 15.* || ^15.0.0 || ^16.0.0",
"react-apollo": "2.x"
},
"devDependencies": {
"@react-native-community/netinfo": "^4.1.3",
"@react-native-community/netinfo": "^5.0.0",
"@types/react": "^16.0.25",
"aws-appsync": "^3.0.4",
"react": "^16.1.1",
Expand All @@ -38,4 +37,4 @@
"react-native": {
"./lib/rehydrated": "./lib/rehydrated-rn"
}
}
}
2 changes: 1 addition & 1 deletion packages/aws-appsync-react/src/rehydrated-rn.tsx
Expand Up @@ -58,7 +58,7 @@ export default class Rehydrated extends React.Component<RehydratedProps, Rehydra

async componentDidMount() {
await this.context.client.hydrated();
await NetInfo.isConnected.fetch();
await NetInfo.fetch();

this.setState({
rehydrated: true
Expand Down
7 changes: 6 additions & 1 deletion packages/aws-appsync/package.json
Expand Up @@ -19,7 +19,7 @@
"test-watch": "jest --watch"
},
"dependencies": {
"@redux-offline/redux-offline": "2.5.2-native.0",
"@redux-offline/redux-offline": "2.5.2-native.3",
"apollo-cache-inmemory": "1.3.12",
"apollo-client": "2.4.6",
"apollo-link": "1.2.3",
Expand All @@ -36,5 +36,10 @@
"setimmediate": "^1.0.5",
"url": "^0.11.0",
"uuid": "3.x"
},
"devDependencies": {},
"peerDependencies": {
"@react-native-community/async-storage": "^1.11.0",
"@react-native-community/netinfo": "^5.0.0"
}
}

0 comments on commit d6a99d9

Please sign in to comment.