File tree 8 files changed +53
-7
lines changed
HackerNews.xcodeproj/project.xcworkspace/xcuserdata/simarsingh.xcuserdatad
8 files changed +53
-7
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ var React = require ( 'react-native' ) ;
4
+
5
+ var {
6
+ View,
7
+ Text,
8
+ } = React ;
9
+
10
+ var styles = require ( './style' ) ;
11
+
12
+ var Post = React . createClass ( {
13
+ render : function ( ) {
14
+ return (
15
+ < View >
16
+ < Text > Hello World!</ Text >
17
+ </ View >
18
+ ) ;
19
+ }
20
+ } ) ;
21
+
22
+ module . exports = Post ;
Original file line number Diff line number Diff line change @@ -4,22 +4,25 @@ var React = require('react-native');
4
4
5
5
var {
6
6
Text,
7
- View
7
+ View,
8
+ TouchableHighlight
8
9
} = React ;
9
10
10
11
var styles = require ( "./style" ) ;
11
12
12
13
var PostCell = React . createClass ( {
13
14
render : function ( ) {
14
15
return (
16
+ < TouchableHighlight onPress = { this . props . onSelect } >
15
17
< View style = { styles . container } >
16
18
< Text style = { styles . postCount } >
17
19
{ this . props . post . count }
18
20
</ Text >
19
- < Text style = { styles . postTitle } >
20
- { this . props . post . title . text }
21
- </ Text >
21
+ < Text style = { styles . postTitle } >
22
+ { this . props . post . title . text }
23
+ </ Text >
22
24
</ View >
25
+ </ TouchableHighlight >
23
26
) ;
24
27
}
25
28
} ) ;
Original file line number Diff line number Diff line change @@ -28,6 +28,6 @@ module.exports = StyleSheet.create({
28
28
marginTop : 10 ,
29
29
marginBottom : 10 ,
30
30
marginRight : 10 ,
31
- color : '#000000 '
31
+ color : '#FF6600 '
32
32
} ,
33
33
} ) ;
Original file line number Diff line number Diff line change 3
3
var React = require ( 'react-native' ) ;
4
4
5
5
var {
6
- AppRegistry,
7
6
Text,
8
7
View,
9
8
ListView,
@@ -15,6 +14,9 @@ var api = require("../../Network/api.js");
15
14
//View Elements
16
15
var PostCell = require ( "./Elements/PostCell" ) ;
17
16
17
+ //Views
18
+ var PostView = require ( "../Post" ) ;
19
+
18
20
var ViewReactClass = React . createClass ( {
19
21
getInitialState : function ( ) {
20
22
return {
@@ -60,9 +62,18 @@ var ViewReactClass = React.createClass({
60
62
} ,
61
63
renderPostCell : function ( post ) {
62
64
return (
63
- < PostCell post = { post } />
65
+ < PostCell
66
+ onSelect = { ( ) => this . selectPost ( post ) }
67
+ post = { post } />
64
68
) ;
65
69
} ,
70
+ selectPost : function ( post ) {
71
+ this . props . navigator . push ( {
72
+ title : "Top Story #" + post . count . substring ( 0 , post . count . length - 1 ) ,
73
+ component : PostView ,
74
+ passProps : { } ,
75
+ } ) ;
76
+ } ,
66
77
67
78
} ) ;
68
79
Original file line number Diff line number Diff line change
1
+ # HackerNews-React-Native
2
+
3
+ Made with React-Native.
4
+
5
+ ## Screenshot:
6
+ <center >
7
+ <img src =" http://i.imgur.com/vfvL9Mj.png " height =" 700 " width =" 250 " />
8
+ </center >
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ var HackerNews = React.createClass({
15
15
return (
16
16
< NavigatorIOS
17
17
style = { styles . container }
18
+ tintColor = '#FF6600'
18
19
initialRoute = { {
19
20
title : 'Hacker News - Top Stories' ,
20
21
component : PostsView ,
@@ -26,6 +27,7 @@ var HackerNews = React.createClass({
26
27
var styles = StyleSheet . create ( {
27
28
container : {
28
29
flex : 1 ,
30
+ backgroundColor : '#F6F6EF' ,
29
31
} ,
30
32
} ) ;
31
33
You can’t perform that action at this time.
0 commit comments