import React, { memo, useCallback, useMemo } from 'react';
import { Image, Pressable, StyleSheet, useColorScheme, View } from 'react-native';
import { useCalendarContext } from '../../calendar-context';
import { YEAR_PAGE_SIZE } from '../../utils';
import { isEqual } from 'lodash';
import { COLORS } from '../../theme';
const arrow_right = require('../../assets/images/arrow_right.png');
const NextButton = ({
  style,
  imageStyle,
  className,
  imageClassName
}) => {
  const {
    currentYear,
    onChangeMonth,
    onChangeYear,
    calendarView,
    components = {}
  } = useCalendarContext();
  const colorScheme = useColorScheme();
  const theme = colorScheme ?? 'light';
  const onPress = useCallback(() => {
    switch (calendarView) {
      case 'day':
        return onChangeMonth(1);
      case 'month':
        return onChangeYear(currentYear + 1);
      case 'year':
        return onChangeYear(currentYear + YEAR_PAGE_SIZE);
      default:
        return {};
    }
  }, [calendarView, currentYear, onChangeMonth, onChangeYear]);
  const iconStyle = useMemo(() => ({
    ...defaultStyles.icon,
    tintColor: COLORS[theme].foreground,
    ...imageStyle
  }), [imageStyle, theme]);
  return /*#__PURE__*/React.createElement(Pressable, {
    disabled: calendarView === 'time',
    onPress: onPress,
    testID: "btn-next",
    accessibilityRole: "button",
    accessibilityLabel: "Next"
  }, /*#__PURE__*/React.createElement(View, {
    style: [defaultStyles.iconContainer, defaultStyles.next, style],
    className: className
  }, components.IconNext || /*#__PURE__*/React.createElement(Image, {
    source: arrow_right,
    style: iconStyle,
    className: imageClassName
  })));
};
const customComparator = (prev, next) => {
  const areEqual = prev.className === next.className && isEqual(prev.style, next.style) && isEqual(prev.imageStyle, next.imageStyle) && isEqual(prev.imageClassName, next.imageClassName);
  return areEqual;
};
export default /*#__PURE__*/memo(NextButton, customComparator);
const defaultStyles = StyleSheet.create({
  iconContainer: {
    padding: 4
  },
  next: {
    marginLeft: 3
  },
  icon: {
    width: 14,
    height: 14
  }
});
//# sourceMappingURL=next-button.js.map