/** * Copyright (c) Paymium. * * This source code is licensed under the MIT license found in the * LICENSE file in the root of this projects source tree. */ import { forwardRef, useContext, useEffect } from 'react'; import { Text, type TextProps } from '../../typography/Text'; import { buttonContext } from './context'; import { composeStyles } from '@crossed/styled'; import { buttonErrorStyles, buttonPrimaryStyles, buttonSecondaryStyles, buttonSuccessStyles, buttonTertiaryStyles, textStyles, } from './styles'; import { Text as TextNative } from 'react-native'; type ButtonTextProps = TextProps; const ButtonText = forwardRef((props, ref) => { const { variant, state, disabled, setTextId, textId, size } = useContext(buttonContext); const { hover, active } = state || {}; useEffect(() => { if (props.id && textId !== props.id) { setTextId(props.id); } }, [props.id, textId, setTextId]); return ( ); }); ButtonText.displayName = 'Button.Text'; export { ButtonText, type ButtonTextProps };