Skip to content

Commit 7533fcb

Browse files
committed
Customizable style is added
1 parent 21f9ff7 commit 7533fcb

5 files changed

Lines changed: 17 additions & 12 deletions

File tree

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,14 @@ import TextArea from "react-native-text-area";
4747

4848
## Configuration - Props
4949

50-
| Property | Type | Default | Description |
51-
| -------------------- | :----: | :-------: | ----------------------------------------- |
52-
| backgroundColor | color | "#fbfbfb" | change the TextArea's background color |
53-
| charCount | number | 0 | set the current character count |
54-
| maxCharLimit | number | 200 | set the maximum character count limit |
55-
| charCountColor | color | "#ccc" | change character count's color |
56-
| exceedCharCountColor | color | "red" | change the exceeded character count color |
50+
| Property | Type | Default | Description |
51+
| -------------------- | :----: | :------------: | ----------------------------------------- |
52+
| styles | style | check the code | set your own style |
53+
| backgroundColor | color | "#fbfbfb" | change the TextArea's background color |
54+
| charCount | number | 0 | set the current character count |
55+
| maxCharLimit | number | 200 | set the maximum character count limit |
56+
| charCountColor | color | "#ccc" | change character count's color |
57+
| exceedCharCountColor | color | "red" | change the exceeded character count color |
5758

5859
## Author
5960

example/App.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import React, { Fragment } from "react";
22
import { SafeAreaView } from "react-native";
33

4-
import TextArea from "@freakycoder/react-native-text-area";
4+
// import TextArea from "@freakycoder/react-native-text-area";
5+
import TextArea from "./lib/src/TextArea";
56

67
const App = () => {
78
return (
89
<Fragment>
910
<SafeAreaView>
1011
<TextArea
1112
maxCharLimit={50}
13+
style={{ height: 350 }}
1214
placeholderTextColor="black"
1315
exceedCharCountColor="#990606"
1416
placeholder={"Write your review..."}

lib/src/TextArea.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default class TextArea extends Component {
3535

3636
render() {
3737
const {
38+
style,
3839
maxCharLimit,
3940
charCountColor,
4041
backgroundColor,
@@ -44,7 +45,7 @@ export default class TextArea extends Component {
4445
rest.maxCharLimit = maxCharLimit;
4546
}
4647
return (
47-
<View style={container(backgroundColor)}>
48+
<View style={container(style, backgroundColor)}>
4849
<TextInput
4950
multiline
5051
{...rest}

lib/src/TextArea.style.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ export function charCountStyle(charCountColor) {
88
};
99
}
1010

11-
export function container(backgroundColor) {
11+
export function container(style, backgroundColor) {
1212
return {
1313
width: "100%",
1414
height: 200,
1515
backgroundColor,
16-
textAlignVertical: "top"
16+
textAlignVertical: "top",
17+
...style
1718
};
1819
}
1920

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@freakycoder/react-native-text-area",
3-
"version": "0.0.1",
3+
"version": "0.0.11",
44
"description": "Simple and easy to use TextArea for React Native",
55
"keywords": [
66
"ios",

0 commit comments

Comments
 (0)