Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
| import React, { Component } from 'react'; | |
| import { | |
| StyleSheet, | |
| Text, | |
| View, | |
| } from 'react-native'; | |
| import { ApolloProvider } from 'react-apollo'; | |
| import { createStore, combineReducers, applyMiddleware } from 'redux'; | |
| import { composeWithDevTools } from 'redux-devtools-extension'; | |
| import ApolloClient, { createNetworkInterface } from 'apollo-client'; | |
| const networkInterface = createNetworkInterface({ uri: 'http://localhost:8080/graphql' }); | |
| const client = new ApolloClient({ | |
| networkInterface, | |
| }); | |
| const store = createStore( | |
| combineReducers({ | |
| apollo: client.reducer(), | |
| }), | |
| {}, // initial state | |
| composeWithDevTools( | |
| applyMiddleware(client.middleware()), | |
| ), | |
| ); | |
| const styles = StyleSheet.create({ | |
| container: { | |
| flex: 1, | |
| justifyContent: 'center', | |
| alignItems: 'center', | |
| backgroundColor: '#F5FCFF', | |
| }, | |
| welcome: { | |
| fontSize: 20, | |
| textAlign: 'center', | |
| margin: 10, | |
| }, | |
| instructions: { | |
| textAlign: 'center', | |
| color: '#333333', | |
| marginBottom: 5, | |
| }, | |
| }); | |
| export default class App extends Component { | |
| render() { | |
| return ( | |
| <ApolloProvider store={store} client={client}> | |
| <View style={styles.container}> | |
| <Text style={styles.welcome}> | |
| Welcome to React Native! | |
| </Text> | |
| <Text style={styles.instructions}> | |
| To get started, edit index.ios.js | |
| </Text> | |
| <Text style={styles.instructions}> | |
| Press Cmd+R to reload,{'\n'} | |
| Cmd+D or shake for dev menu | |
| </Text> | |
| </View> | |
| </ApolloProvider> | |
| ); | |
| } | |
| } |