Created
April 11, 2025 08:01
-
-
Save gorkemozkan/3912380ca505409c95fbb3087734e1c8 to your computer and use it in GitHub Desktop.
Read More With Library
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { FC } from 'react'; | |
import theme from '@/theme'; | |
import clip from 'text-clipper'; | |
import { Dimensions, } from 'react-native' | |
import { TEXT_STYLES } from '@/lib/typography'; | |
import ReadMoreFawaz from '@fawazahmed/react-native-read-more'; | |
interface Props { | |
text: string | |
} | |
const ReadMore: FC<Props> = (props) => { | |
const screenWidth = Dimensions.get('window').width; | |
return ( | |
<ReadMoreFawaz | |
seeMoreStyle={{ | |
color: theme.colorText.Active, | |
fontSize: TEXT_STYLES["md/Regular"].fontSize, | |
lineHeight: TEXT_STYLES["md/Regular"].lineHeight, | |
}} | |
seeLessStyle={{ | |
color: theme.colorText.Primary, | |
fontSize: TEXT_STYLES["md/Semibold"].fontSize, | |
lineHeight: TEXT_STYLES["md/Semibold"].lineHeight, | |
}} | |
seeMoreText='Read More' | |
seeLessText='Read Less' | |
numberOfLines={3} | |
style={{ | |
color: theme.colorText.Secondary, | |
fontSize: TEXT_STYLES["md/Regular"].fontSize, | |
lineHeight: TEXT_STYLES["md/Regular"].lineHeight, | |
}}> | |
{clip((props.text), screenWidth, { html: true, stripTags: true })} | |
</ReadMoreFawaz> | |
) | |
} | |
export default ReadMore; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment