Skip to content

Commit 2add832

Browse files
committed
FontFamily bug is fixed. Example is updated with custom icon usage
1 parent 310ada9 commit 2add832

File tree

7 files changed

+82
-42
lines changed

7 files changed

+82
-42
lines changed

README.md

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,35 +55,53 @@ import BouncyCheckbox from "react-native-bouncy-checkbox";
5555
```
5656

5757

58-
## Customizable Usage
58+
## Basic Usage
5959

60-
```js
60+
```jsx
6161
<BouncyCheckbox
6262
isChecked
6363
textColor="#000"
6464
fillColor="red"
65-
iconComponent={your-own-component}
66-
fontFamily="JosefinSans-Regular"
6765
text="Buy tickets for concert 🎉 🎊"
6866
/>
6967
```
7068

7169

70+
## Advanced Custom Usage
71+
72+
```jsx
73+
<BouncyCheckbox
74+
isChecked={false}
75+
textColor="#000"
76+
unfillColor="white"
77+
fontFamily="JosefinSans-Regular"
78+
iconComponent={
79+
<Image
80+
style={{ height: 10, width: 10 }}
81+
source={require("./assets/checkmark.png")}
82+
/>
83+
}
84+
text="Custom Icon Example"
85+
/>
86+
```
87+
88+
7289
### Configuration - Props
7390

74-
| Property | Type | Default | Description |
75-
| ------------- | :-------: | :-----------------: | --------------------------------------------------------------------- |
76-
| text | string | Call my mom 😇 | set the checkbox's text |
77-
| textColor | color | #757575 | change the text's color |
78-
| fontFamily | string | JosefinSans-Regular | set your own font family |
79-
| fontSize | number | 16 | change the text's font size |
80-
| isChecked | boolean | false | set the default checkbox value |
81-
| checkboxSize | number | 25 | change the checkbox's size |
82-
| borderRadius | number | size/2 | change the checkbox's border radius if you do not want the circle one |
83-
| borderColor | color | #f09f48 | change the checkbox's border color |
84-
| fillColor | color | #f09f48 | change the checkbox's filled color |
85-
| unfillColor | color | transparent | change the checkbox's un-filled color when it's not checked |
86-
| iconComponent | component | Icon | set your own icon component |
91+
| Property | Type | Default | Description |
92+
| ------------- | :-------: | :------------: | --------------------------------------------------------------------- |
93+
| text | string | Call my mom 😇 | set the checkbox's text |
94+
| textColor | color | #757575 | change the text's color |
95+
| fontFamily | string | default | set your own font family |
96+
| fontSize | number | 16 | change the text's font size |
97+
| isChecked | boolean | false | set the default checkbox value |
98+
| checkboxSize | number | 25 | change the checkbox's size |
99+
| borderRadius | number | size/2 | change the checkbox's border radius if you do not want the circle one |
100+
| borderColor | color | #f09f48 | change the checkbox's border color |
101+
| fillColor | color | #f09f48 | change the checkbox's filled color |
102+
| unfillColor | color | transparent | change the checkbox's un-filled color when it's not checked |
103+
| iconComponent | component | Icon | set your own icon component |
104+
| onPress | function | null | set your own onPress functionality after the bounce effect |
87105

88106

89107
### Future Plans

example/App.js

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { View, StatusBar, SafeAreaView } from "react-native";
2+
import { View, Image, StatusBar, SafeAreaView } from "react-native";
33
import BouncyCheckbox from "react-native-bouncy-checkbox";
44
import { AppleHeader } from "@freakycoder/react-native-header-view";
55
import BottomSearchBar from "react-native-bottom-search-bar";
@@ -11,13 +11,47 @@ const App = () => {
1111
<SafeAreaView style={{ flex: 1 }}>
1212
<AppleHeader />
1313
<View style={{ margin: 16 }}>
14-
<BouncyCheckbox />
15-
<BouncyCheckbox text="Get groceries" />
16-
<BouncyCheckbox text="Pay the bills" isChecked />
17-
<BouncyCheckbox text="Take out of the trash 💩" />
18-
<BouncyCheckbox text="Buy tickets for concert 🎉 🎊" />
19-
<BouncyCheckbox text="Try new gym routine" isChecked />
20-
<BouncyCheckbox text="Do a load of laundry" isChecked />
14+
<BouncyCheckbox
15+
isChecked={false}
16+
textColor="#000"
17+
unfillColor="white"
18+
fontFamily="JosefinSans-Regular"
19+
iconComponent={
20+
<Image
21+
style={{ height: 10, width: 10 }}
22+
source={require("./assets/checkmark.png")}
23+
/>
24+
}
25+
text="Custom Icon Example"
26+
/>
27+
<BouncyCheckbox fontFamily="JosefinSans-Regular" />
28+
<BouncyCheckbox
29+
text="Get groceries"
30+
fontFamily="JosefinSans-Regular"
31+
/>
32+
<BouncyCheckbox
33+
isChecked
34+
text="Pay the bills"
35+
fontFamily="JosefinSans-Regular"
36+
/>
37+
<BouncyCheckbox
38+
fontFamily="JosefinSans-Regular"
39+
text="Take out of the trash 💩"
40+
/>
41+
<BouncyCheckbox
42+
fontFamily="JosefinSans-Regular"
43+
text="Buy tickets for concert 🎉 🎊"
44+
/>
45+
<BouncyCheckbox
46+
isChecked
47+
text="Try new gym routine"
48+
fontFamily="JosefinSans-Regular"
49+
/>
50+
<BouncyCheckbox
51+
isChecked
52+
text="Do a load of laundry"
53+
fontFamily="JosefinSans-Regular"
54+
/>
2155
</View>
2256
<BottomSearchBar />
2357
</SafeAreaView>

example/assets/checkmark.png

91.9 KB
Loading

example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"react": "16.9.0",
1515
"react-native": "0.61.2",
1616
"react-native-bottom-search-bar": "0.0.24",
17-
"react-native-bouncy-checkbox": "0.0.2",
17+
"react-native-bouncy-checkbox": "0.0.3",
1818
"react-native-dynamic-vector-icons": "^0.2.1",
1919
"react-native-iphone-x-helper": "^1.2.1",
2020
"react-native-vector-icons": "^6.6.0"

lib/src/BouncyCheckbox.js

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,7 @@ class BouncyCheckbox extends Component {
7373
};
7474

7575
render() {
76-
const {
77-
text,
78-
size,
79-
isChecked,
80-
borderColor,
81-
fillColor,
82-
unfillColor,
83-
onPress,
84-
textColor,
85-
fontFamily,
86-
fontSize
87-
} = this.props;
76+
const { text, textColor, fontFamily, fontSize } = this.props;
8877

8978
return (
9079
<TouchableOpacity
@@ -131,8 +120,7 @@ BouncyCheckbox.defaultProps = {
131120
textColor: "#757575",
132121
fillColor: "#ffc484",
133122
borderColor: "#ffc484",
134-
unfillColor: "transparent",
135-
fontFamily: "JosefinSans-Regular"
123+
unfillColor: "transparent"
136124
};
137125

138126
export default BouncyCheckbox;

lib/src/BouncyCheckbox.style.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export const iconContainer = (
2020

2121
export const textStyle = (checked, textColor, fontFamily, fontSize) => {
2222
return {
23+
fontFamily,
2324
fontSize: 16,
2425
color: "#757575",
25-
fontFamily: "JosefinSans-Regular",
2626
textDecorationLine: checked ? "line-through" : "none"
2727
};
2828
};

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": "0.0.2",
3+
"version": "0.0.3",
44
"description": "Fully customizable animated bouncy checkbox for React Native",
55
"keywords": [
66
"bouncy",

0 commit comments

Comments
 (0)