Increase hitSlop of menu icon and navigation arrows
This commit is contained in:
committed by
Maria Zadnepryanets
parent
59ee05eb1f
commit
3778c1454f
@@ -4,10 +4,7 @@
|
|||||||
"mocha": true,
|
"mocha": true,
|
||||||
"es6": true
|
"es6": true
|
||||||
},
|
},
|
||||||
"extends": [
|
"extends": ["eslint:recommended", "plugin:react/recommended"],
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:react/recommended"
|
|
||||||
],
|
|
||||||
"parser": "babel-eslint",
|
"parser": "babel-eslint",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"sourceType": "module",
|
"sourceType": "module",
|
||||||
@@ -16,31 +13,18 @@
|
|||||||
},
|
},
|
||||||
"ecmaVersion": 2018
|
"ecmaVersion": 2018
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": ["react"],
|
||||||
"react"
|
|
||||||
],
|
|
||||||
"settings": {
|
"settings": {
|
||||||
"react": {
|
"react": {
|
||||||
"version": require('./package.json').dependencies.react,
|
"version": require("./package.json").dependencies.react
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
"rules": {
|
"rules": {
|
||||||
"indent": [
|
"indent": ["error", 2],
|
||||||
"error",
|
"no-console": ["error", { "allow": ["warn", "error"] }],
|
||||||
2
|
|
||||||
],
|
|
||||||
"no-console": [
|
|
||||||
"error",
|
|
||||||
{ allow: ["warn", "error"] }
|
|
||||||
],
|
|
||||||
"space-before-function-paren": 0,
|
"space-before-function-paren": 0,
|
||||||
"semi": [
|
"semi": ["warn", "never"],
|
||||||
"warn",
|
"space-infix-ops": ["warn"],
|
||||||
"never"
|
|
||||||
],
|
|
||||||
"space-infix-ops": [
|
|
||||||
"warn"
|
|
||||||
],
|
|
||||||
"no-var": "error",
|
"no-var": "error",
|
||||||
"prefer-const": "error",
|
"prefer-const": "error",
|
||||||
"no-trailing-spaces": "error",
|
"no-trailing-spaces": "error",
|
||||||
@@ -53,6 +37,6 @@
|
|||||||
"ignoreTemplateLiterals": true
|
"ignoreTemplateLiterals": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"no-multi-spaces": 2,
|
"no-multi-spaces": 2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
#
|
#
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
|
# VSCode
|
||||||
|
.vscode/
|
||||||
|
|
||||||
# Xcode
|
# Xcode
|
||||||
#
|
#
|
||||||
build/
|
build/
|
||||||
|
|||||||
@@ -12,16 +12,17 @@ import {
|
|||||||
nextDate,
|
nextDate,
|
||||||
prevDate,
|
prevDate,
|
||||||
isTomorrowInFuture,
|
isTomorrowInFuture,
|
||||||
isYesterdayInFuture
|
isYesterdayInFuture,
|
||||||
} from '../helpers/cycle-day'
|
} from '../helpers/cycle-day'
|
||||||
import { Colors, Containers, Spacing, Typography } from '../../styles'
|
import { Colors, Containers, Spacing, Typography } from '../../styles'
|
||||||
|
import { HIT_SLOP } from '../../config'
|
||||||
|
|
||||||
const SymptomPageTitle = ({
|
const SymptomPageTitle = ({
|
||||||
date,
|
date,
|
||||||
reloadSymptomData,
|
reloadSymptomData,
|
||||||
setDate,
|
setDate,
|
||||||
subtitle,
|
subtitle,
|
||||||
title
|
title,
|
||||||
}) => {
|
}) => {
|
||||||
const rightArrowColor = isTomorrowInFuture(date) ? Colors.grey : Colors.orange
|
const rightArrowColor = isTomorrowInFuture(date) ? Colors.grey : Colors.orange
|
||||||
const leftArrowColor = isYesterdayInFuture(date) ? Colors.grey : Colors.orange
|
const leftArrowColor = isYesterdayInFuture(date) ? Colors.grey : Colors.orange
|
||||||
@@ -33,15 +34,15 @@ const SymptomPageTitle = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<TouchableOpacity onPress={() => navigate(false)}>
|
<TouchableOpacity onPress={() => navigate(false)} hitSlop={HIT_SLOP}>
|
||||||
<AppIcon name='chevron-left' color={leftArrowColor}/>
|
<AppIcon name='chevron-left' color={leftArrowColor} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
<View style={styles.textContainer}>
|
<View style={styles.textContainer}>
|
||||||
<AppText style={styles.title}>{title}</AppText>
|
<AppText style={styles.title}>{title}</AppText>
|
||||||
{subtitle && <AppText style={styles.subtitle}>{subtitle}</AppText>}
|
{subtitle && <AppText style={styles.subtitle}>{subtitle}</AppText>}
|
||||||
</View>
|
</View>
|
||||||
<TouchableOpacity onPress={() => navigate(true)}>
|
<TouchableOpacity onPress={() => navigate(true)} hitSlop={HIT_SLOP}>
|
||||||
<AppIcon name='chevron-right' color={rightArrowColor}/>
|
<AppIcon name='chevron-right' color={rightArrowColor} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
</View>
|
</View>
|
||||||
)
|
)
|
||||||
@@ -52,37 +53,34 @@ SymptomPageTitle.propTypes = {
|
|||||||
reloadSymptomData: PropTypes.func.isRequired,
|
reloadSymptomData: PropTypes.func.isRequired,
|
||||||
setDate: PropTypes.func.isRequired,
|
setDate: PropTypes.func.isRequired,
|
||||||
subtitle: PropTypes.string,
|
subtitle: PropTypes.string,
|
||||||
title: PropTypes.string
|
title: PropTypes.string,
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
height: (Spacing.base * 4),
|
height: Spacing.base * 4,
|
||||||
marginHorizontal: Spacing.base,
|
marginHorizontal: Spacing.base,
|
||||||
marginTop: Spacing.base,
|
marginTop: Spacing.base,
|
||||||
...Containers.rowContainer
|
...Containers.rowContainer,
|
||||||
},
|
},
|
||||||
textContainer: {
|
textContainer: {
|
||||||
alignItems: 'center'
|
alignItems: 'center',
|
||||||
},
|
},
|
||||||
title: {
|
title: {
|
||||||
...Typography.titleWithoutMargin
|
...Typography.titleWithoutMargin,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
const mapStateToProps = (state) => {
|
const mapStateToProps = (state) => {
|
||||||
return({
|
return {
|
||||||
date: getDate(state),
|
date: getDate(state),
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mapDispatchToProps = (dispatch) => {
|
const mapDispatchToProps = (dispatch) => {
|
||||||
return({
|
return {
|
||||||
setDate: (date) => dispatch(setDate(date)),
|
setDate: (date) => dispatch(setDate(date)),
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default connect(
|
export default connect(mapStateToProps, mapDispatchToProps)(SymptomPageTitle)
|
||||||
mapStateToProps,
|
|
||||||
mapDispatchToProps,
|
|
||||||
)(SymptomPageTitle)
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import MenuItem from './menu-item'
|
|||||||
|
|
||||||
import { Colors, Sizes } from '../../styles'
|
import { Colors, Sizes } from '../../styles'
|
||||||
import settingsLabels from '../../i18n/en/settings'
|
import settingsLabels from '../../i18n/en/settings'
|
||||||
|
import { HIT_SLOP } from '../../config'
|
||||||
|
|
||||||
const { menuItems } = settingsLabels
|
const { menuItems } = settingsLabels
|
||||||
|
|
||||||
@@ -16,7 +17,6 @@ const settingsMenuItems = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
export default class HamburgerMenu extends Component {
|
export default class HamburgerMenu extends Component {
|
||||||
|
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props)
|
super(props)
|
||||||
|
|
||||||
@@ -24,20 +24,20 @@ export default class HamburgerMenu extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
toggleMenu = () => {
|
toggleMenu = () => {
|
||||||
this.setState({ shouldShowMenu: !this.state.shouldShowMenu})
|
this.setState({ shouldShowMenu: !this.state.shouldShowMenu })
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { shouldShowMenu } = this.state
|
const { shouldShowMenu } = this.state
|
||||||
|
|
||||||
return(
|
return (
|
||||||
<React.Fragment>
|
<React.Fragment>
|
||||||
{!shouldShowMenu &&
|
{!shouldShowMenu && (
|
||||||
<TouchableOpacity onPress={this.toggleMenu}>
|
<TouchableOpacity onPress={this.toggleMenu} hitSlop={HIT_SLOP}>
|
||||||
<AppIcon name='dots-three-vertical' color={Colors.orange}/>
|
<AppIcon name='dots-three-vertical' color={Colors.orange} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
}
|
)}
|
||||||
{shouldShowMenu &&
|
{shouldShowMenu && (
|
||||||
<Modal
|
<Modal
|
||||||
animationType='fade'
|
animationType='fade'
|
||||||
onRequestClose={this.toggleMenu}
|
onRequestClose={this.toggleMenu}
|
||||||
@@ -47,29 +47,27 @@ export default class HamburgerMenu extends Component {
|
|||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={this.toggleMenu}
|
onPress={this.toggleMenu}
|
||||||
style={styles.blackBackground}
|
style={styles.blackBackground}
|
||||||
>
|
></TouchableOpacity>
|
||||||
</TouchableOpacity>
|
|
||||||
<View style={styles.menu}>
|
<View style={styles.menu}>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
onPress={this.toggleMenu}
|
onPress={this.toggleMenu}
|
||||||
style={styles.iconContainer}
|
style={styles.iconContainer}
|
||||||
>
|
>
|
||||||
<AppIcon name='cross' color='black'/>
|
<AppIcon name='cross' color='black' />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
{settingsMenuItems.map(item =>
|
{settingsMenuItems.map((item) => (
|
||||||
<MenuItem
|
<MenuItem
|
||||||
item={item}
|
item={item}
|
||||||
key={item.name}
|
key={item.name}
|
||||||
closeMenu={this.toggleMenu}
|
closeMenu={this.toggleMenu}
|
||||||
/>
|
/>
|
||||||
)}
|
))}
|
||||||
</View>
|
</View>
|
||||||
</Modal>
|
</Modal>
|
||||||
}
|
)}
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
@@ -80,7 +78,7 @@ const styles = StyleSheet.create({
|
|||||||
},
|
},
|
||||||
iconContainer: {
|
iconContainer: {
|
||||||
alignSelf: 'flex-end',
|
alignSelf: 'flex-end',
|
||||||
marginBottom: Sizes.base
|
marginBottom: Sizes.base,
|
||||||
},
|
},
|
||||||
menu: {
|
menu: {
|
||||||
alignSelf: 'flex-end',
|
alignSelf: 'flex-end',
|
||||||
@@ -88,6 +86,6 @@ const styles = StyleSheet.create({
|
|||||||
height: '100%',
|
height: '100%',
|
||||||
padding: Sizes.base,
|
padding: Sizes.base,
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
width: '60%'
|
width: '60%',
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const SYMPTOMS = [
|
|||||||
'desire',
|
'desire',
|
||||||
'pain',
|
'pain',
|
||||||
'mood',
|
'mood',
|
||||||
'note'
|
'note',
|
||||||
]
|
]
|
||||||
|
|
||||||
export const CHART_COLUMN_WIDTH = 32
|
export const CHART_COLUMN_WIDTH = 32
|
||||||
@@ -30,3 +30,5 @@ export const TEMP_SCALE_UNITS = 0.1
|
|||||||
export const TEMP_MAX = 40
|
export const TEMP_MAX = 40
|
||||||
export const TEMP_MIN = 34
|
export const TEMP_MIN = 34
|
||||||
export const TEMP_SLIDER_STEP = 0.5
|
export const TEMP_SLIDER_STEP = 0.5
|
||||||
|
|
||||||
|
export const HIT_SLOP = { top: 20, bottom: 20, left: 20, right: 20 }
|
||||||
|
|||||||
Reference in New Issue
Block a user