@@ -11,12 +11,11 @@ import {
1111import { Button , Input , Text , ListItem } from "react-native-elements" ;
1212import AWSAppSyncClient from "aws-appsync" ;
1313import { Rehydrated } from "aws-appsync-react" ;
14- import { ApolloProvider , Query , Mutation , Subscription } from "react-apollo" ;
14+ import { ApolloProvider , Query , Mutation } from "react-apollo" ;
1515import uuid from "uuid/v4" ;
1616
1717import CREATE_APP from "./src/mutations/CreateApp" ;
1818import LIST_APPS from "./src/queries/ListApps" ;
19- import NEW_APP from "./src/subscriptions/NewApp" ;
2019
2120import appSyncConfig from "./AppSync" ;
2221
@@ -29,6 +28,7 @@ const client = new AWSAppSyncClient({
2928 }
3029} ) ;
3130
31+ const negativeRandom = ( ) => Math . round ( Math . random ( ) * - 1000000 ) ;
3232const Loading = ( ) => < ActivityIndicator size = "large" color = "#fff" /> ;
3333const Error = ( { text } ) => (
3434 < Text h4 style = { [ styles . error , styles . centerText ] } >
@@ -96,7 +96,7 @@ class App extends React.Component {
9696 __typename : "AppConnection" ,
9797 createApp : {
9898 __typename : "App" ,
99- id : Math . round ( Math . random ( ) * - 1000000 ) ,
99+ id : negativeRandom ( ) ,
100100 name,
101101 link
102102 }
@@ -154,16 +154,6 @@ class App extends React.Component {
154154 return (
155155 < React . Fragment >
156156 { data . listApps . items . map ( renderLI ) }
157- < Subscription subscription = { NEW_APP } >
158- { ( { loading, error, data } ) => {
159- if ( loading ) return null ;
160- if ( error )
161- return (
162- < Error text = "Error subscribing to new app" />
163- ) ;
164- return renderLI ( data . onCreateApp , 0 ) ;
165- } }
166- </ Subscription >
167157 </ React . Fragment >
168158 ) ;
169159 } }
0 commit comments