Skip to content

Commit

Permalink
NEW PROP: maxCharTextStyle
Browse files Browse the repository at this point in the history
  • Loading branch information
WrathChaos committed Jul 13, 2021
1 parent ddea863 commit 5ba2a59
Show file tree
Hide file tree
Showing 3 changed files with 301 additions and 18,418 deletions.
11 changes: 8 additions & 3 deletions lib/RNTextArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type CustomTextStyleProp = StyleProp<TextStyle> | Array<StyleProp<TextStyle>>;
export interface IRNTextAreaProps extends TextInputProps {
style?: CustomStyleProp;
textInputStyle?: CustomTextStyleProp;
maxCharTextStyle?: CustomTextStyleProp;
defaultCharCount?: number;
maxCharLimit?: number;
charCountColor?: string;
Expand All @@ -34,6 +35,7 @@ const RNTextArea: React.FC<IRNTextAreaProps> = ({
charCountColor = "#ccc",
exceedCharCountColor = "red",
onChangeText,
maxCharTextStyle,
...rest
}) => {
const [charCount, setCharCount] = React.useState(defaultCharCount || 0);
Expand All @@ -48,9 +50,12 @@ const RNTextArea: React.FC<IRNTextAreaProps> = ({

return (
<Text
style={_charCountStyle(
charCount > maxCharLimit ? exceedCharCountColor : charCountColor,
)}
style={[
_charCountStyle(
charCount > maxCharLimit ? exceedCharCountColor : charCountColor,
),
maxCharTextStyle,
]}
>{`${charCount}/${maxCharLimit}`}</Text>
);
};
Expand Down
Loading

0 comments on commit 5ba2a59

Please sign in to comment.