Skip to content

Commit b14e98c

Browse files
committed
fix: Typescript type fixes with better coding
1 parent e3c9f97 commit b14e98c

File tree

4 files changed

+20
-12
lines changed

4 files changed

+20
-12
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ import BouncyCheckbox from "react-native-bouncy-checkbox";
7979
| Property | Type | Default | Description |
8080
| -------------------- | :-------: | :--------------: | ------------------------------------------------------------------------------------------------------------------------------------------ |
8181
| text | string | undefined | set the checkbox's text |
82-
| textComponent | component | undefined | set the checkbox's text by a React Component |
82+
| textComponent | component | undefined | set the checkbox's text by a React Component |
8383
| onPress | function | null | set your own onPress functionality after the bounce effect, callback receives the next `isChecked` boolean if disableBuiltInState is false |
8484
| disableText | boolean | false | if you want to use checkbox without text, you can enable it |
8585
| size | number | 25 | size of `width` and `height` of the checkbox |
@@ -188,7 +188,6 @@ export default App;
188188
189189
We have also this library's checkbox group library as well :) Please take a look
190190
191-
192191
## FAQ
193192
194193
<b>How to disable strikethrough?</b>
@@ -200,6 +199,7 @@ textStyle={{
200199
textDecorationLine: "none",
201200
}}
202201
```
202+
203203
<b>How to make square checkbox?</b>
204204
205205
- Simply use the `iconStyle` prop and set the `borderRadius` to `0`
@@ -209,6 +209,7 @@ iconStyle={{
209209
borderRadius: 0, // to make it a little round increase the value accordingly
210210
}}
211211
```
212+
212213
### Future Plans
213214
214215
- [x] ~~LICENSE~~
@@ -217,6 +218,7 @@ iconStyle={{
217218
- [x] ~~Synthetic Press Functionality~~
218219
- [x] ~~Disable built-in check state~~
219220
- [x] ~~React Native Bouncy Checkbox Group Library Extension~~
221+
- [ ] Better Documentation | Separation of Documentation
220222
- [ ] Write an article about the lib on Medium
221223
222224
## Author

example/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ export default class App extends React.Component {
3131
iconStyle={{ borderColor: "blue", borderRadius: 10 }}
3232
textStyle={{ fontFamily: "JosefinSans-Regular" }}
3333
unfillColor="white"
34-
borderRadius={10}
3534
text="Custom Disabled Checkbox Example"
3635
onPress={(isChecked: boolean) => {}}
3736
/>

lib/BouncyCheckbox.tsx

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,39 @@ import {
99
ViewStyle,
1010
TextStyle,
1111
TouchableOpacity,
12+
ImageSourcePropType,
13+
TouchableWithoutFeedbackProps,
1214
} from "react-native";
1315
import styles, { _textStyle, _iconContainer } from "./BouncyCheckbox.style";
1416

1517
type CustomStyleProp = StyleProp<ViewStyle> | Array<StyleProp<ViewStyle>>;
18+
type CustomTextStyleProp = StyleProp<TextStyle> | Array<StyleProp<TextStyle>>;
19+
type BaseTouchableProps = Pick<
20+
TouchableWithoutFeedbackProps,
21+
Exclude<keyof TouchableWithoutFeedbackProps, "onPress">
22+
>;
1623

17-
export interface IBouncyCheckboxProps {
18-
style?: StyleProp<ViewStyle>;
24+
export interface IBouncyCheckboxProps extends BaseTouchableProps {
1925
size?: number;
2026
text?: string;
21-
textComponent?: React.ElementType;
2227
iconStyle?: any;
23-
textStyle?: StyleProp<TextStyle>;
2428
fillColor?: string;
25-
iconComponent?: React.ReactNode;
2629
isChecked?: boolean;
2730
unfillColor?: string;
2831
disableText?: boolean;
2932
ImageComponent?: any;
30-
iconImageStyle?: StyleProp<ViewStyle>;
3133
bounceEffect?: number;
3234
bounceFriction?: number;
3335
useNativeDriver?: boolean;
3436
disableBuiltInState?: boolean;
35-
checkIconImageSource?: Image;
36-
textContainerStyle?: CustomStyleProp;
3737
TouchableComponent?: any;
38+
iconComponent?: React.ReactNode;
39+
textComponent?: React.ReactNode;
40+
style?: StyleProp<ViewStyle>;
41+
textStyle?: CustomTextStyleProp;
42+
iconImageStyle?: CustomStyleProp;
43+
textContainerStyle?: CustomStyleProp;
44+
checkIconImageSource?: ImageSourcePropType;
3845
onPress?: (checked: boolean) => void;
3946
}
4047

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

0 commit comments

Comments
 (0)