File tree 3 files changed +53
-3
lines changed
3 files changed +53
-3
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { StyleSheet , Text , View , Platform } from 'react-native' ;
3
3
import { TabNavigator , StackNavigator } from 'react-navigation' ;
4
+ import { Constants } from 'expo' ;
4
5
import DecksList from './components/DecksList' ;
5
6
import DeckDetail from './components/DeckDetail' ;
7
+ import AddCard from './components/AddCard' ;
6
8
import AddDeck from './components/AddDeck' ;
7
9
import { getCurrentRouteName } from './utils/helpers' ;
8
10
import { black , white } from './utils/colors' ;
@@ -49,6 +51,9 @@ const MainNavigator = StackNavigator({
49
51
} ,
50
52
DeckDetail : {
51
53
screen : DeckDetail
54
+ } ,
55
+ AddCard : {
56
+ screen : AddCard
52
57
}
53
58
} ) ;
54
59
@@ -75,6 +80,7 @@ export default class App extends React.Component {
75
80
76
81
const styles = StyleSheet . create ( {
77
82
container : {
78
- flex : 1
83
+ flex : 1 ,
84
+ paddingTop : Platform . OS === 'ios' ? 0 : Constants . statusBarHeight
79
85
}
80
86
} ) ;
Original file line number Diff line number Diff line change
1
+ import React from 'react' ;
2
+ import { StyleSheet , Text , View } from 'react-native' ;
3
+ import { black , white } from '../utils/colors' ;
4
+
5
+ export default class AddCard extends React . Component {
6
+ static navigationOptions = ( { navigation } ) => ( {
7
+ headerTintColor : white ,
8
+ headerStyle : {
9
+ backgroundColor : black
10
+ } ,
11
+ title : `Add Card for ${ navigation . state . params . deckId } `
12
+ } ) ;
13
+
14
+ render ( ) {
15
+ return (
16
+ < View style = { styles . container } >
17
+ < Text style = { styles . deckTitle } > Add Card { this . props . navigation . state . params . deckId } </ Text >
18
+ </ View >
19
+ ) ;
20
+ }
21
+ }
22
+
23
+ const styles = StyleSheet . create ( {
24
+ container : {
25
+ flex : 1 ,
26
+ justifyContent : 'center' ,
27
+ alignItems : 'center'
28
+ } ,
29
+ deckTitle : {
30
+ fontSize : 20
31
+ }
32
+ } ) ;
Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
- import { StyleSheet , Text , View } from 'react-native' ;
2
+ import { StyleSheet , Text , View , TouchableOpacity } from 'react-native' ;
3
3
import { black , white } from '../utils/colors' ;
4
4
5
5
export default class DeckDetail extends React . Component {
@@ -12,9 +12,15 @@ export default class DeckDetail extends React.Component {
12
12
} ) ;
13
13
14
14
render ( ) {
15
+ const id = this . props . navigation . state . params . deckId ;
15
16
return (
16
17
< View style = { styles . container } >
17
- < Text style = { styles . deckTitle } > Details - { this . props . navigation . state . params . deckId } </ Text >
18
+ < TouchableOpacity
19
+ onPress = { ( ) => this . props . navigation . navigate ( 'AddCard' , { deckId : id } ) }
20
+ >
21
+ < Text style = { styles . addCardBtn } > Add Card</ Text >
22
+ </ TouchableOpacity >
23
+ < Text style = { styles . deckTitle } > Details - { id } </ Text >
18
24
</ View >
19
25
) ;
20
26
}
@@ -28,5 +34,11 @@ const styles = StyleSheet.create({
28
34
} ,
29
35
deckTitle : {
30
36
fontSize : 20
37
+ } ,
38
+ addCardBtn : {
39
+ backgroundColor : black ,
40
+ color : white ,
41
+ fontWeight : 'bold' ,
42
+ padding : 20
31
43
}
32
44
} ) ;
You can’t perform that action at this time.
0 commit comments