-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
55 lines (48 loc) · 1.04 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
'use strict'
import Person from 'Person';
import PersonRoute from 'PersonRoute';
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
StatusBar,
Image,
Text,
View
} from 'react-native';
import Relay, {
DefaultNetworkLayer,
RootContainer,
} from 'react-relay';
Relay.injectNetworkLayer(new DefaultNetworkLayer('http://localhost:5000/graphql'))
export default class ZeroToGraphQl extends Component {
constructor() {
super();
this.state = {
personId: '1',
};
}
render() {
let props = {
person: this.props.person,
changePersonID: this._changePersonId.bind(this)
};
return (
<View style={styles.container}>
<RootContainer
Component={Person}
route={new PersonRoute({personId: this.state.personId})}
renderFetched={(data) => <Person {...props} {...data} />}
/>
</View>
);
}
_changePersonId(id, name) {
this.setState({personId: id});
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
},
});