Skip to content

Commit 4cb3fe0

Browse files
authored
Merge pull request #8 from Airbitz/fix/close-side-menu
Close side menu when pressing settings
2 parents 5859d5e + e7c783a commit 4cb3fe0

File tree

13 files changed

+34
-30
lines changed

13 files changed

+34
-30
lines changed

src/modules/UI/components/ControlPanel/Component/Main.android.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const SETTINGS_TEXT = sprintf(strings.enUS['settings_title'])
1717

1818
export default class Main extends Component {
1919
onLogout = () => {
20-
// console.log('logout')
20+
this.props.onPressOption()
2121
this.props.logout()
2222
}
2323

@@ -58,6 +58,7 @@ export default class Main extends Component {
5858
}
5959

6060
_handleOnPressRouting = (route) => () => {
61+
this.props.onPressOption()
6162
switch (route) {
6263
case 'settingsOverview':
6364
return Actions.settingsOverview({type: 'reset'})

src/modules/UI/components/ControlPanel/Component/Main.ios.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export default class Main extends Component {
5959
}
6060

6161
_handleOnPressRouting = (route) => () => {
62+
this.props.onPressOption()
6263
switch (route) {
6364
case 'settingsOverview':
6465
return Actions.settingsOverview({type: 'reset'})
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
import {connect} from 'react-redux'
2-
import {logoutRequest} from '../../../../Login/action'
32
import Main from './Main'
3+
import {logoutRequest} from '../../../../Login/action'
4+
import {closeSideMenu} from '../../SideMenu/action'
45

56
const mapStateToProps = (state) => ({
67
usersView: state.ui.scenes.controlPanel.usersView
78
})
89
const mapDispatchToProps = (dispatch) => ({
9-
logout: () => dispatch(logoutRequest())
10+
onPressOption: () => dispatch(closeSideMenu()),
11+
logout: () => dispatch(logoutRequest())
1012
})
1113

1214
export default connect(mapStateToProps, mapDispatchToProps)(Main)
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export const OPEN_SELECT_USER = 'OPEN_SELECT_USER'
22
export const CLOSE_SELECT_USER = 'CLOSE_SELECT_USER'
3-
export const LIST_USERS_SIDEBAR = 'LIST_USER_USER_SIDEBAR'
4-
export const SELECT_USERS_SIDEBAR = 'SELECT_USERS_SIDEBAR'
5-
export const REMOVE_USERS_SIDEBAR = 'REMOVE_USERS_SIDEBAR'
3+
export const LIST_USERS_SIDE_MENU = 'LIST_USER_USER_SIDE_MENU'
4+
export const SELECT_USERS_SIDE_MENU = 'SELECT_USERS_SIDE_MENU'
5+
export const REMOVE_USERS_SIDE_MENU = 'REMOVE_USERS_SIDE_MENU'
66

77
export const openSelectUser = () => ({
88
type: OPEN_SELECT_USER
@@ -13,11 +13,11 @@ export const closeSelectUser = () => ({
1313
})
1414

1515
export const selectUsersList = (name) => ({
16-
type: SELECT_USERS_SIDEBAR,
16+
type: SELECT_USERS_SIDE_MENU,
1717
name
1818
})
1919

2020
export const removeUsersList = (name) => ({
21-
type: REMOVE_USERS_SIDEBAR,
21+
type: REMOVE_USERS_SIDE_MENU,
2222
name
2323
})

src/modules/UI/components/ControlPanel/reducer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ const usersView = (state = false, action) => {
1414

1515
const selectedUser = (state = null, action) => {
1616
switch (action.type) {
17-
case ACTION.LIST_USERS_SIDEBAR :
17+
case ACTION.LIST_USERS_SIDE_MENU :
1818
return action.data[0]
19-
case ACTION.SELECT_USERS_SIDEBAR :
19+
case ACTION.SELECT_USERS_SIDE_MENU :
2020
return action.id
2121
default:
2222
return state
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import {connect} from 'react-redux'
22
import SideMenu from './SideMenu.ui'
3-
import {openSidebar, closeSidebar} from './action'
3+
import {openSideMenu, closeSideMenu} from './action'
44

55
const mapStateToProps = (state) => ({
66
view: state.ui.scenes.sideMenu.view
77
})
88
const mapDispatchToProps = (dispatch) => ({
9-
open: () => dispatch(openSidebar()),
10-
close: () => dispatch(closeSidebar())
9+
open: () => dispatch(openSideMenu()),
10+
close: () => dispatch(closeSideMenu())
1111
})
1212
export default connect(mapStateToProps, mapDispatchToProps)(SideMenu)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
export const OPEN_SIDEBAR = 'OPEN_SIDEBAR'
2-
export const CLOSE_SIDEBAR = 'CLOSE_SIDEBAR'
1+
export const OPEN_SIDE_MENU = 'OPEN_SIDE_MENU'
2+
export const CLOSE_SIDE_MENU = 'CLOSE_SIDE_MENU'
33

4-
export function openSidebar () {
4+
export function openSideMenu () {
55
return {
6-
type: OPEN_SIDEBAR
6+
type: OPEN_SIDE_MENU
77
}
88
}
99

10-
export function closeSidebar () {
10+
export function closeSideMenu () {
1111
return {
12-
type: CLOSE_SIDEBAR
12+
type: CLOSE_SIDE_MENU
1313
}
1414
}

src/modules/UI/components/SideMenu/reducer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ import {combineReducers} from 'redux'
33

44
const view = (state = false, action) => {
55
switch (action.type) {
6-
case ACTION.OPEN_SIDEBAR :
6+
case ACTION.OPEN_SIDE_MENU :
77
return true
8-
case ACTION.CLOSE_SIDEBAR :
8+
case ACTION.CLOSE_SIDE_MENU :
99
return false
1010
default:
1111
return state

src/modules/UI/components/TabBar/TabBar.ui.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {Actions} from 'react-native-router-flux'
66
import {Footer, FooterTab, Button} from 'native-base'
77
import Gradient from '../Gradient/Gradient.ui'
88
import {setTabBarHeight} from '../../dimensions/action'
9-
import {openSidebar, closeSidebar} from '../SideMenu/action'
9+
import {openSideMenu, closeSideMenu} from '../SideMenu/action'
1010
import T from '../FormattedText'
1111
import wallet from '../../../../assets/images/tabbar/wallets.png'
1212
import walletSelected from '../../../../assets/images/tabbar/wallets_selected.png'
@@ -22,12 +22,12 @@ import styles from './styles.js'
2222

2323
export default class TabBar extends Component {
2424

25-
_handleToggleSideBar = () => {
25+
_handleToggleSideMenu = () => {
2626
if (!this.props.sidemenu) {
27-
this.props.dispatch(openSidebar())
27+
this.props.dispatch(openSideMenu())
2828
}
2929
if (this.props.sidemenu) {
30-
this.props.dispatch(closeSidebar())
30+
this.props.dispatch(closeSideMenu())
3131
}
3232
}
3333

@@ -87,7 +87,7 @@ export default class TabBar extends Component {
8787
</Button>
8888

8989
<Button
90-
onPress={this._handleToggleSideBar}
90+
onPress={this._handleToggleSideMenu}
9191
active={this.props.sidemenu}>
9292
<Image
9393
style={[{width: 25, height: 25, marginTop: 3}]}

src/theme/variables/commonColor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export default {
117117
brandSuccess: '#5cb85c',
118118
brandDanger: '#d9534f',
119119
brandWarning: '#f0ad4e',
120-
brandSidebar: '#252932',
120+
brandSideMenu: '#252932',
121121

122122

123123
// Font

0 commit comments

Comments
 (0)