-
Notifications
You must be signed in to change notification settings - Fork 4
/
PageOne.js
45 lines (40 loc) · 1.09 KB
/
PageOne.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
import React, { Component } from 'react';
import {
Text,
View,
} from 'react-native';
import { Actions } from 'react-native-router-flux';
import Relay from 'react-relay';
class PageOne extends Component {
render() {
return (
<View style={{flex: 1, justifyContent: 'center', padding: 10}}>
<Text>Viewer ID: {this.props.viewer.id}</Text>
<Text>Total widgets: {this.props.viewer.widgets.edges.length}</Text>
<Text style={{fontSize: 20, paddingTop: 20}}>Widget list (items clickable!)</Text>
<View>
{this.props.viewer.widgets.edges.map(edge =>
<Text style={{padding: 10}} onPress={() => Actions.pageTwo({nodeID: edge.node.id})} key={edge.node.id}>{edge.node.name} (ID: {edge.node.id})</Text>
)}
</View>
</View>
)
}
}
export default Relay.createContainer(PageOne, {
fragments: {
viewer: () => Relay.QL`
fragment on User {
id,
widgets(first: 10) {
edges {
node {
id,
name,
},
},
},
}
`,
},
});