import { forwardRef } from 'react';
import { Text } from 'react-native';
import type { RsSkinlessTextProps } from '../../types/props';

type TextRef = Text;

const RsText = forwardRef<TextRef, RsSkinlessTextProps>(
  ({ text, children, style, numberOfLines, selectable }, ref) => {
    return (
      <Text
        ref={ref}
        style={style}
        numberOfLines={numberOfLines}
        selectable={selectable}
      >
        {children ?? text}
      </Text>
    );
  }
);

RsText.displayName = 'RsText';

export default RsText;
