File tree Expand file tree Collapse file tree 5 files changed +32
-7
lines changed Expand file tree Collapse file tree 5 files changed +32
-7
lines changed Original file line number Diff line number Diff line change @@ -3,14 +3,25 @@ import {
33 Text ,
44 View
55} from 'react-native'
6+ import { connect } from 'react-redux'
7+ import DLButton from '../../components/Button'
68import styles from '../../styles'
9+ import { changeStack } from '../../store/actions/login'
710
8- export default class Profile extends Component {
11+ class Profile extends Component {
912 render ( ) {
1013 return (
1114 < View style = { styles . container } >
12- < Text > Profile Page</ Text >
15+ < DLButton
16+ buttonStyle = { styles . logoutButton }
17+ title = 'Log out'
18+ onPress = { ( ) => this . props . switch ( ) }
19+ />
1320 </ View >
1421 )
1522 }
1623}
24+
25+ export default connect ( undefined , {
26+ switch : changeStack
27+ } ) ( Profile )
Original file line number Diff line number Diff line change @@ -106,11 +106,14 @@ AppStack = ({ isLaunching }) => (
106106 </ Stack . Navigator >
107107)
108108
109- const SwitchStack = ( { isLaunching } ) => (
110- < NavigationContainer >
111- < AppStack isLaunching = { isLaunching } />
112- </ NavigationContainer >
113- )
109+ const SwitchStack = ( { isLaunching } ) => {
110+ console . log ( '------' , isLaunching )
111+ return (
112+ < NavigationContainer >
113+ < AppStack isLaunching = { isLaunching } />
114+ </ NavigationContainer >
115+ )
116+ }
114117
115118export default connect ( ( state ) => ( {
116119 isLaunching : state . Login . isLaunching
Original file line number Diff line number Diff line change 33} from '../types/login'
44
55export function changeStack ( ) {
6+ console . log ( '--------' )
67 return {
78 type : CHNAGE_STACK
89 }
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const initialState = {
99export default function reducer ( state = initialState , action ) {
1010 switch ( action . type ) {
1111 case CHNAGE_STACK :
12+ console . log ( '--------state' , state . isLaunching )
1213 return {
1314 ...state ,
1415 isLaunching : ! state . isLaunching
Original file line number Diff line number Diff line change @@ -32,6 +32,9 @@ const styles = StyleSheet.create({
3232 resizeMode : 'cover'
3333 } ,
3434 buttonContainer : {
35+ display : 'flex' ,
36+ justifyContent : 'center' ,
37+ alignItems : 'center' ,
3538 width : 60 ,
3639 height : 30 ,
3740 borderRadius : 15 ,
@@ -143,6 +146,12 @@ const styles = StyleSheet.create({
143146 backgroundColor : '#6699ff' ,
144147 marginTop : 10 ,
145148 width : 130
149+ } ,
150+ logoutButton : {
151+ backgroundColor : '#6699ff' ,
152+ width : 150 ,
153+ height : 40 ,
154+ borderRadius : 20
146155 }
147156} )
148157
You can’t perform that action at this time.
0 commit comments