This repository was archived by the owner on Oct 23, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 8 files changed +762
-715
lines changed Expand file tree Collapse file tree 8 files changed +762
-715
lines changed Original file line number Diff line number Diff line change 11node_modules /
22.expo /
33npm-debug. *
4+ .DS_Store
Original file line number Diff line number Diff line change 11import React from 'react' ;
2+ import { Platform } from 'react-native' ;
23import { ApolloProvider } from 'react-apollo' ;
34import { ApolloClient , HttpLink , InMemoryCache } from 'apollo-client-preset' ;
45import 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
814const client = new ApolloClient ( {
9- link : httpLink ,
15+ link : new HttpLink ( { uri : SERVER_URL } ) ,
1016 cache : new InMemoryCache ( )
1117} ) ;
1218
Original file line number Diff line number Diff line change @@ -5,16 +5,25 @@ import gql from 'graphql-tag';
55
66class 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
3746export default graphql ( HELLO_QUERY , {
38- name : 'helloQuery'
47+ options : {
48+ fetchPolicy : 'network-only'
49+ }
3950} ) ( Home ) ;
Original file line number Diff line number Diff line change 11{
22 "expo" : {
3- "sdkVersion" : " 24 .0.0"
3+ "sdkVersion" : " 25 .0.0"
44 }
55}
Original file line number Diff line number Diff line change 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 },
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}
Original file line number Diff line number Diff line change 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}
You can’t perform that action at this time.
0 commit comments