diff --git a/src/component/truncated_text_view.tsx b/src/component/truncated_text_view.tsx index 1edbc32..6960a84 100644 --- a/src/component/truncated_text_view.tsx +++ b/src/component/truncated_text_view.tsx @@ -25,7 +25,13 @@ if ( } export const TruncatedTextView = (props: TruncatedTextViewProps) => { - const { style, tailTextStyle, containerStyle } = props; + const { + style, + tailTextStyle, + containerStyle, + textPropsRoot, + textPropsChild, + } = props; const { text: fullText, lineHeight = DEFAULT_LINE_HEIGHT, @@ -129,6 +135,7 @@ export const TruncatedTextView = (props: TruncatedTextViewProps) => { style={[style, { lineHeight }]} numberOfLines={isExpanded ? 0 : numberOfLines} onTextLayout={_handleTextLayout} + {...textPropsRoot} > {fullText} {_shouldShowTailView && '\n'} @@ -149,6 +156,7 @@ export const TruncatedTextView = (props: TruncatedTextViewProps) => { {isExpanded ? expandedText : collapsedText} diff --git a/src/types/types.ts b/src/types/types.ts index ba2f9ad..dd86771 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -1,4 +1,4 @@ -import type { StyleProp, TextStyle, ViewStyle } from 'react-native'; +import type { StyleProp, TextStyle, TextProps, ViewStyle } from 'react-native'; export type TruncatedTextViewProps = { /** @@ -60,4 +60,14 @@ export type TruncatedTextViewProps = { * Whether to enable layout animation, default value is true */ enableLayoutAnimation?: boolean; + + /** + * Apply text props to root text + */ + textPropsRoot?: TextProps; + + /** + * Apply text props to child text + */ + textPropsChild?: TextProps; };