import {
    type FC
} from "react";
import {
    Text as NativeText,
    type TextStyle
} from "react-native";
import type ITextProps from "./type";
import {
    NCoreUIKitTheme
} from "../../core/hooks";

const Text: FC<ITextProps> = ({
    variant = "bodyMediumSize",
    color = "mid",
    customColor,
    customTheme,
    children,
    style,
    ...props
}) => {
    const {
        typography,
        colors
    } = NCoreUIKitTheme.useContext(customTheme);

    return (
        <NativeText
            {...props}
            style={[
                style,
                {
                    ...typography[variant],
                    color: customColor ? customColor : color ? colors.content.text[color] : colors.content.text.mid
                } as TextStyle
            ]}
        >
            {children}
        </NativeText>
    );
};
export default Text;
