Skip to content
This repository was archived by the owner on Oct 23, 2018. It is now read-only.

Commit a0c6dc4

Browse files
committed
Update depdencies.
Adds pseudocode for handling localhost issues.
1 parent 12ee427 commit a0c6dc4

File tree

8 files changed

+762
-715
lines changed

8 files changed

+762
-715
lines changed

minimal/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
.expo/
33
npm-debug.*
4+
.DS_Store

minimal/App.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import React from 'react';
2+
import { Platform } from 'react-native';
23
import { ApolloProvider } from 'react-apollo';
34
import { ApolloClient, HttpLink, InMemoryCache } from 'apollo-client-preset';
45
import Home from './Home';
56

6-
const httpLink = new HttpLink({ uri: 'http://localhost:4000' });
7+
const SERVER_URL = __DEV__
8+
? Platform.select({
9+
ios: 'http://10.0.1.23:4000',
10+
android: 'http://10.0.2.2:4000'
11+
})
12+
: 'INSERT_PRODUCTION_URL';
713

814
const client = new ApolloClient({
9-
link: httpLink,
15+
link: new HttpLink({ uri: SERVER_URL }),
1016
cache: new InMemoryCache()
1117
});
1218

minimal/Home.js

+14-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,25 @@ import gql from 'graphql-tag';
55

66
class Home extends React.Component {
77
render() {
8-
if (this.props.helloQuery.loading)
8+
if (this.props.data.error) {
9+
return (
10+
<View style={styles.container}>
11+
<Text>{JSON.stringify(this.props.data.error)}</Text>
12+
</View>
13+
);
14+
}
15+
16+
if (this.props.data.loading) {
917
return (
1018
<View style={styles.container}>
1119
<Text>Loading...</Text>
1220
</View>
1321
);
22+
}
1423

1524
return (
1625
<View style={styles.container}>
17-
<Text>{this.props.helloQuery.hello}</Text>
26+
<Text>{this.props.data.hello}</Text>
1827
</View>
1928
);
2029
}
@@ -35,5 +44,7 @@ const HELLO_QUERY = gql`
3544
`;
3645

3746
export default graphql(HELLO_QUERY, {
38-
name: 'helloQuery'
47+
options: {
48+
fetchPolicy: 'network-only'
49+
}
3950
})(Home);

minimal/app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"expo": {
3-
"sdkVersion": "24.0.0"
3+
"sdkVersion": "25.0.0"
44
}
55
}

minimal/package.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"version": "0.1.0",
44
"private": true,
55
"devDependencies": {
6-
"jest-expo": "24.0.0",
6+
"jest-expo": "25.1.0",
77
"react-native-scripts": "1.8.1",
88
"react-test-renderer": "16.0.0"
99
},
@@ -19,12 +19,12 @@
1919
"preset": "jest-expo"
2020
},
2121
"dependencies": {
22-
"apollo-client-preset": "1.0.6",
23-
"expo": "24.0.2",
24-
"graphql": "0.12.3",
25-
"graphql-tag": "2.6.1",
26-
"react": "16.0.0",
22+
"apollo-client-preset": "^1.0.8",
23+
"expo": "25.0.0",
24+
"graphql": "^0.13.0",
25+
"graphql-tag": "^2.7.3",
26+
"react": "16.2.0",
2727
"react-apollo": "2.0.4",
28-
"react-native": "https://github.com/expo/react-native/archive/sdk-24.0.0.tar.gz"
28+
"react-native": "https://github.com/expo/react-native/archive/sdk-25.0.0.tar.gz"
2929
}
3030
}

minimal/server/package.json

+2-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
{
22
"name": "minimal-server",
33
"scripts": {
4-
"start": "node index.js",
5-
"deploy": "now --public && now alias && now rm --yes --safe graphql-template-node"
4+
"start": "node index.js"
65
},
76
"dependencies": {
8-
"graphql-yoga": "1.1.4"
9-
},
10-
"devDependencies": {
11-
"now": "9.0.1"
12-
},
13-
"now": {
14-
"alias": "graphql-template-node"
7+
"graphql-yoga": "^1.2.5"
158
}
169
}

0 commit comments

Comments
 (0)