Skip to content

Commit 849bacf

Browse files
committed
disableText prop is added
1 parent ec4d3a9 commit 849bacf

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ import BouncyCheckbox from "react-native-bouncy-checkbox";
104104
| checkImageWidth | number | 10 | change the check icon's width |
105105
| checkImageHeight | number | 10 | change the check icon's height |
106106
| ImageComponent | component | Image | set your own Image component instead of RN's default Image |
107+
| disableText | boolean | false | if you want to use checkbox without text, you can enable it |
107108

108109
### Future Plans
109110

lib/BouncyCheckbox.tsx

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export interface IBouncyCheckboxProps {
3131
unfillColor: string;
3232
borderColor: string;
3333
borderWidth: number;
34+
disableText: boolean;
3435
borderRadius: number;
3536
ImageComponent: any;
3637
checkImageSource: any;
@@ -127,6 +128,7 @@ class BouncyCheckbox extends React.Component<IBouncyCheckboxProps, IState> {
127128
fontFamily,
128129
fontSize = 16,
129130
textDecoration,
131+
disableText = false,
130132
color = "#757575",
131133
text = "Call my mom 😇",
132134
} = this.props;
@@ -136,22 +138,24 @@ class BouncyCheckbox extends React.Component<IBouncyCheckboxProps, IState> {
136138
onPress={this.spring.bind(this, Easing.bounce)}
137139
>
138140
{this.renderCheckIcon()}
139-
<View style={styles.textContainer}>
140-
<Text
141-
style={[
142-
_textStyle(
143-
this.state.checked,
144-
color,
145-
fontFamily,
146-
fontSize,
147-
textDecoration,
148-
),
149-
textStyle,
150-
]}
151-
>
152-
{text}
153-
</Text>
154-
</View>
141+
{!disableText && (
142+
<View style={styles.textContainer}>
143+
<Text
144+
style={[
145+
_textStyle(
146+
this.state.checked,
147+
color,
148+
fontFamily,
149+
fontSize,
150+
textDecoration,
151+
),
152+
textStyle,
153+
]}
154+
>
155+
{text}
156+
</Text>
157+
</View>
158+
)}
155159
</TouchableOpacity>
156160
);
157161
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-bouncy-checkbox",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Fully customizable animated bouncy checkbox for React Native",
55
"keywords": [
66
"bouncy",

0 commit comments

Comments
 (0)