This repository was archived by the owner on Oct 23, 2018. It is now read-only.
File tree 8 files changed +762
-715
lines changed
8 files changed +762
-715
lines changed Original file line number Diff line number Diff line change 1
1
node_modules /
2
2
.expo /
3
3
npm-debug. *
4
+ .DS_Store
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
+ import { Platform } from 'react-native' ;
2
3
import { ApolloProvider } from 'react-apollo' ;
3
4
import { ApolloClient , HttpLink , InMemoryCache } from 'apollo-client-preset' ;
4
5
import Home from './Home' ;
5
6
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' ;
7
13
8
14
const client = new ApolloClient ( {
9
- link : httpLink ,
15
+ link : new HttpLink ( { uri : SERVER_URL } ) ,
10
16
cache : new InMemoryCache ( )
11
17
} ) ;
12
18
Original file line number Diff line number Diff line change @@ -5,16 +5,25 @@ import gql from 'graphql-tag';
5
5
6
6
class Home extends React . Component {
7
7
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 ) {
9
17
return (
10
18
< View style = { styles . container } >
11
19
< Text > Loading...</ Text >
12
20
</ View >
13
21
) ;
22
+ }
14
23
15
24
return (
16
25
< View style = { styles . container } >
17
- < Text > { this . props . helloQuery . hello } </ Text >
26
+ < Text > { this . props . data . hello } </ Text >
18
27
</ View >
19
28
) ;
20
29
}
@@ -35,5 +44,7 @@ const HELLO_QUERY = gql`
35
44
` ;
36
45
37
46
export default graphql ( HELLO_QUERY , {
38
- name : 'helloQuery'
47
+ options : {
48
+ fetchPolicy : 'network-only'
49
+ }
39
50
} ) ( Home ) ;
Original file line number Diff line number Diff line change 1
1
{
2
2
"expo" : {
3
- "sdkVersion" : " 24 .0.0"
3
+ "sdkVersion" : " 25 .0.0"
4
4
}
5
5
}
Original file line number Diff line number Diff line change 3
3
"version" : " 0.1.0" ,
4
4
"private" : true ,
5
5
"devDependencies" : {
6
- "jest-expo" : " 24.0 .0" ,
6
+ "jest-expo" : " 25.1 .0" ,
7
7
"react-native-scripts" : " 1.8.1" ,
8
8
"react-test-renderer" : " 16.0.0"
9
9
},
19
19
"preset" : " jest-expo"
20
20
},
21
21
"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" ,
27
27
"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"
29
29
}
30
30
}
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " minimal-server" ,
3
3
"scripts" : {
4
- "start" : " node index.js" ,
5
- "deploy" : " now --public && now alias && now rm --yes --safe graphql-template-node"
4
+ "start" : " node index.js"
6
5
},
7
6
"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"
15
8
}
16
9
}
You can’t perform that action at this time.
0 commit comments