File tree 9 files changed +109
-7
lines changed
mobile/ReactNativeTutorial
9 files changed +109
-7
lines changed Original file line number Diff line number Diff line change 2
2
import React from 'react' ;
3
3
import { Provider } from 'react-redux' ;
4
4
import store from './setup/store' ;
5
- import Comments from './bundles/comments/Comments ' ;
5
+ import Router from './setup/Router ' ;
6
6
7
- type PropsType = {
8
-
9
- }
10
-
11
- const App = ( props : PropsType ) => (
7
+ const App = ( ) => (
12
8
< Provider store = { store } >
13
- < Comments />
9
+ < Router />
14
10
</ Provider >
15
11
) ;
16
12
Original file line number Diff line number Diff line change
1
+ // @flow
2
+ import React from 'react' ;
3
+ import { View , Text } from 'react-native' ;
4
+
5
+ import styles from './FooterStyle' ;
6
+
7
+ type PropsType = {
8
+
9
+ }
10
+
11
+ const Footer = ( props : PropsType ) => (
12
+ < View style = { styles . container } >
13
+ </ View >
14
+ ) ;
15
+
16
+ export default Footer ;
Original file line number Diff line number Diff line change
1
+ import { StyleSheet } from 'react-native' ;
2
+
3
+ const styles = StyleSheet . create ( {
4
+ container : {
5
+ height : 50 ,
6
+ backgroundColor : '#EFEFF2'
7
+ } ,
8
+ } ) ;
9
+
10
+ export default styles ;
Original file line number Diff line number Diff line change
1
+ // @flow
2
+ import React from 'react' ;
3
+ import { View } from 'react-native' ;
4
+ import List from './List/List' ;
5
+ import Footer from './Footer/Footer' ;
6
+
7
+ import styles from './IndexStyle' ;
8
+
9
+ type PropsType = {
10
+
11
+ }
12
+
13
+ const Index = ( props : PropsType ) => (
14
+ < View style = { styles . container } >
15
+ < List { ...props } />
16
+ < Footer />
17
+ </ View >
18
+ ) ;
19
+
20
+ export default Index ;
Original file line number Diff line number Diff line change
1
+ import { StyleSheet } from 'react-native' ;
2
+
3
+ const styles = StyleSheet . create ( {
4
+ container : {
5
+ flex : 1 ,
6
+ } ,
7
+ } ) ;
8
+
9
+ export default styles ;
Original file line number Diff line number Diff line change
1
+ // @flow
2
+ import React from 'react' ;
3
+ import { ListView } from 'react-native' ;
4
+
5
+ import styles from './ListStyle' ;
6
+
7
+ type PropsType = {
8
+
9
+ }
10
+
11
+ const List = ( props : PropsType ) => (
12
+ < ListView
13
+ style = { styles . container }
14
+ dataSource = { new ListView . DataSource ( { rowHasChanged : ( r1 , r2 ) => r1 !== r2 } ) }
15
+ renderRow = { ( ) => null }
16
+ >
17
+ </ ListView >
18
+ ) ;
19
+
20
+ export default List ;
21
+
Original file line number Diff line number Diff line change
1
+ import { StyleSheet } from 'react-native' ;
2
+
3
+ const styles = StyleSheet . create ( {
4
+ container : {
5
+ } ,
6
+ } ) ;
7
+
8
+ export default styles ;
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import Add from '../bundles/comments/components/Add/Add' ;
3
+ import Index from '../bundles/comments/components/Index/Index' ;
4
+ import { Scene , Router , Reducer } from 'react-native-router-flux'
5
+
6
+ const reducerCreate = params => {
7
+ const defaultReducer = Reducer ( params ) ;
8
+ return ( state , action ) => {
9
+ console . log ( `Executing navigation action %c${ action . type } ` , 'color: #519C00' ) ;
10
+ return defaultReducer ( state , action ) ;
11
+ }
12
+ } ;
13
+
14
+ export default ( ) => (
15
+ < Router createReducer = { reducerCreate } sceneStyle = { { backgroundColor :'#F7F7F7' , paddingTop : 66 } } >
16
+ < Scene key = "root" >
17
+ < Scene key = "comments/index" component = { Index } title = "Comments" initial = { true } />
18
+ < Scene key = "comments/add" component = { Add } title = "Add Comments" />
19
+ </ Scene >
20
+ </ Router >
21
+ )
Original file line number Diff line number Diff line change 12
12
"react" : " 15.3.2" ,
13
13
"react-native" : " 0.37.0" ,
14
14
"react-native-elements" : " ^0.6.3" ,
15
+ "react-native-router-flux" : " ^3.37.0" ,
15
16
"react-native-vector-icons" : " ^2.1.0" ,
16
17
"react-redux" : " ^4.4.6" ,
17
18
"redux" : " ^3.6.0" ,
You can’t perform that action at this time.
0 commit comments