import { forwardRef } from 'react';
import { Pressable, Text, View } from 'react-native';
import type { RsSkinlessChipProps } from '../../types/props';

type ViewRef = View;

const RsChip = forwardRef<ViewRef, RsSkinlessChipProps>(
  ({ label, selected, onPress, disabled, style }, ref) => {
    return (
      <Pressable
        ref={ref}
        onPress={onPress}
        disabled={disabled}
        style={style}
        accessibilityRole="button"
        accessibilityState={{ selected, disabled }}
      >
        <Text>{label}</Text>
      </Pressable>
    );
  }
);

RsChip.displayName = 'RsChip';

export default RsChip;
