diff --git a/src/components/CalendarPicker/index.js b/src/components/CalendarPicker/index.js index 39762a10d1d9..7038d69d4b06 100644 --- a/src/components/CalendarPicker/index.js +++ b/src/components/CalendarPicker/index.js @@ -1,6 +1,6 @@ import _ from 'underscore'; import React from 'react'; -import {View, TouchableOpacity, Pressable} from 'react-native'; +import {View} from 'react-native'; import moment from 'moment'; import Str from 'expensify-common/lib/str'; import Text from '../Text'; @@ -14,6 +14,8 @@ import ROUTES from '../../ROUTES'; import CONST from '../../CONST'; import getButtonState from '../../libs/getButtonState'; import * as StyleUtils from '../../styles/StyleUtils'; +import PressableWithFeedback from '../Pressable/PressableWithFeedback'; +import PressableWithoutFeedback from '../Pressable/PressableWithoutFeedback'; class CalendarPicker extends React.PureComponent { constructor(props) { @@ -101,9 +103,12 @@ class CalendarPicker extends React.PureComponent { return ( - - + {monthNames[currentMonthView]} - - - + - + @@ -164,25 +173,27 @@ class CalendarPicker extends React.PureComponent { const isSelected = moment(this.props.value).isSame(moment([currentYearView, currentMonthView, day]), 'day'); return ( - this.onDayPressed(day)} style={styles.calendarDayRoot} accessibilityLabel={day ? day.toString() : undefined} + focusable={Boolean(day)} + accessible={Boolean(day)} > {({hovered, pressed}) => ( {day} )} - + ); })} diff --git a/src/components/Pressable/PressableWithFeedback.js b/src/components/Pressable/PressableWithFeedback.js index 9e475b7169cf..281492568867 100644 --- a/src/components/Pressable/PressableWithFeedback.js +++ b/src/components/Pressable/PressableWithFeedback.js @@ -12,7 +12,17 @@ const omittedProps = ['style', 'pressStyle', 'hoverStyle', 'focusStyle', 'wrappe const PressableWithFeedbackPropTypes = { ..._.omit(GenericPressablePropTypes.pressablePropTypes, omittedProps), + /** + * Determines what opacity value should be applied to the underlaying view when Pressable is pressed. + * To disable dimming, pass 1 as pressDimmingValue + * @default variables.pressDimValue + */ pressDimmingValue: propTypes.number, + /** + * Determines what opacity value should be applied to the underlaying view when pressable is hovered. + * To disable dimming, pass 1 as hoverDimmingValue + * @default variables.hoverDimValue + */ hoverDimmingValue: propTypes.number, };