Skip to content

Commit 59cfc0d

Browse files
committed
Wrap month and year picker buttons in View to fix flex layout
1 parent d094b4c commit 59cfc0d

1 file changed

Lines changed: 46 additions & 42 deletions

File tree

  • src/components/DatePicker/CalendarPicker

src/components/DatePicker/CalendarPicker/index.tsx

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -259,28 +259,30 @@ function CalendarPicker({
259259
direction={CONST.DIRECTION.LEFT}
260260
/>
261261
</PressableWithFeedback>
262-
<PressableWithFeedback
263-
onPress={() => {
264-
monthPressableRef?.current?.blur();
265-
setIsMonthPickerVisible(true);
266-
}}
267-
ref={monthPressableRef}
268-
style={[themeStyles.alignItemsCenter, {flex: 1}]}
269-
wrapperStyle={[themeStyles.alignItemsCenter, {flex: 1}]}
270-
hoverDimmingValue={1}
271-
testID="currentMonthButton"
272-
accessibilityLabel={`${monthNames.at(currentMonthView)}, ${translate('common.currentMonth')}`}
273-
role={CONST.ROLE.BUTTON}
274-
sentryLabel={CONST.SENTRY_LABEL.CALENDAR_PICKER.MONTH_PICKER}
275-
>
276-
<Text
277-
style={themeStyles.sidebarLinkTextBold}
278-
testID="currentMonthText"
279-
numberOfLines={1}
262+
<View style={[themeStyles.flex1, themeStyles.alignItemsCenter]}>
263+
<PressableWithFeedback
264+
onPress={() => {
265+
monthPressableRef?.current?.blur();
266+
setIsMonthPickerVisible(true);
267+
}}
268+
ref={monthPressableRef}
269+
style={[themeStyles.alignItemsCenter]}
270+
wrapperStyle={[themeStyles.alignItemsCenter]}
271+
hoverDimmingValue={1}
272+
testID="currentMonthButton"
273+
accessibilityLabel={`${monthNames.at(currentMonthView)}, ${translate('common.currentMonth')}`}
274+
role={CONST.ROLE.BUTTON}
275+
sentryLabel={CONST.SENTRY_LABEL.CALENDAR_PICKER.MONTH_PICKER}
280276
>
281-
{monthNames.at(currentMonthView)}
282-
</Text>
283-
</PressableWithFeedback>
277+
<Text
278+
style={themeStyles.sidebarLinkTextBold}
279+
testID="currentMonthText"
280+
numberOfLines={1}
281+
>
282+
{monthNames.at(currentMonthView)}
283+
</Text>
284+
</PressableWithFeedback>
285+
</View>
284286
<PressableWithFeedback
285287
shouldUseAutoHitSlop={false}
286288
testID="next-month-arrow"
@@ -310,28 +312,30 @@ function CalendarPicker({
310312
direction={CONST.DIRECTION.LEFT}
311313
/>
312314
</PressableWithFeedback>
313-
<PressableWithFeedback
314-
onPress={() => {
315-
pressableRef?.current?.blur();
316-
setIsYearPickerVisible(true);
317-
}}
318-
ref={pressableRef}
319-
style={[themeStyles.alignItemsCenter, {flex: 1}]}
320-
wrapperStyle={[themeStyles.alignItemsCenter, {flex: 1}]}
321-
hoverDimmingValue={1}
322-
disabled={years.length <= 1}
323-
testID="currentYearButton"
324-
accessibilityLabel={`${currentYearView}, ${translate('common.currentYear')}`}
325-
role={CONST.ROLE.BUTTON}
326-
sentryLabel={CONST.SENTRY_LABEL.CALENDAR_PICKER.YEAR_PICKER}
327-
>
328-
<Text
329-
style={themeStyles.sidebarLinkTextBold}
330-
testID="currentYearText"
315+
<View style={[themeStyles.flex1, themeStyles.alignItemsCenter]}>
316+
<PressableWithFeedback
317+
onPress={() => {
318+
pressableRef?.current?.blur();
319+
setIsYearPickerVisible(true);
320+
}}
321+
ref={pressableRef}
322+
style={[themeStyles.alignItemsCenter]}
323+
wrapperStyle={[themeStyles.alignItemsCenter]}
324+
hoverDimmingValue={1}
325+
disabled={years.length <= 1}
326+
testID="currentYearButton"
327+
accessibilityLabel={`${currentYearView}, ${translate('common.currentYear')}`}
328+
role={CONST.ROLE.BUTTON}
329+
sentryLabel={CONST.SENTRY_LABEL.CALENDAR_PICKER.YEAR_PICKER}
331330
>
332-
{currentYearView}
333-
</Text>
334-
</PressableWithFeedback>
331+
<Text
332+
style={themeStyles.sidebarLinkTextBold}
333+
testID="currentYearText"
334+
>
335+
{currentYearView}
336+
</Text>
337+
</PressableWithFeedback>
338+
</View>
335339
<PressableWithFeedback
336340
shouldUseAutoHitSlop={false}
337341
testID="next-year-arrow"

0 commit comments

Comments
 (0)