import { useContext } from "react";
import { Pressable } from "react-native";
import { AppContext } from "../../utils";

export default function MyPressable({
  children,
  onPress,
  disabled,
  style,
  backgroundColor,
}) {
  const appContext = useContext(AppContext);

  return (
    <Pressable
      onPress={onPress}
      disabled={disabled}
      style={({ pressed }) => [
        {
          backgroundColor: pressed
            ? appContext.appTheme.modal.pressedPickerItemColor
            : backgroundColor === undefined
            ? appContext.appTheme.backgroundColor
            : backgroundColor,
        },
        style,
      ]}
    >
      {children}
    </Pressable>
  );
}
