Skip to content

Commit 5ba2a59

Browse files
committed
NEW PROP: maxCharTextStyle
1 parent ddea863 commit 5ba2a59

3 files changed

Lines changed: 301 additions & 18418 deletions

File tree

lib/RNTextArea.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type CustomTextStyleProp = StyleProp<TextStyle> | Array<StyleProp<TextStyle>>;
1919
export interface IRNTextAreaProps extends TextInputProps {
2020
style?: CustomStyleProp;
2121
textInputStyle?: CustomTextStyleProp;
22+
maxCharTextStyle?: CustomTextStyleProp;
2223
defaultCharCount?: number;
2324
maxCharLimit?: number;
2425
charCountColor?: string;
@@ -34,6 +35,7 @@ const RNTextArea: React.FC<IRNTextAreaProps> = ({
3435
charCountColor = "#ccc",
3536
exceedCharCountColor = "red",
3637
onChangeText,
38+
maxCharTextStyle,
3739
...rest
3840
}) => {
3941
const [charCount, setCharCount] = React.useState(defaultCharCount || 0);
@@ -48,9 +50,12 @@ const RNTextArea: React.FC<IRNTextAreaProps> = ({
4850

4951
return (
5052
<Text
51-
style={_charCountStyle(
52-
charCount > maxCharLimit ? exceedCharCountColor : charCountColor,
53-
)}
53+
style={[
54+
_charCountStyle(
55+
charCount > maxCharLimit ? exceedCharCountColor : charCountColor,
56+
),
57+
maxCharTextStyle,
58+
]}
5459
>{`${charCount}/${maxCharLimit}`}</Text>
5560
);
5661
};

0 commit comments

Comments
 (0)