Skip to content

Instantly share code, notes, and snippets.

@gorkemozkan
Created April 11, 2025 08:01
Show Gist options
  • Save gorkemozkan/3912380ca505409c95fbb3087734e1c8 to your computer and use it in GitHub Desktop.
Save gorkemozkan/3912380ca505409c95fbb3087734e1c8 to your computer and use it in GitHub Desktop.
Read More With Library
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