Skip to content

Commit cd61b1a

Browse files
authored
Merge pull request #4 from SrBrahma/master
Add checkboxProps prop and fix id type
2 parents f5ae51a + ab22b29 commit cd61b1a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,13 @@ should work of the example project.
104104
| -------- | :---------------: | :-------: | --------------------------------------------------------- |
105105
| data | ICheckboxButton[] | undefined | set the checkboxes as a data |
106106
| onChange | function | undefined | set your own logic when the group of checkbox is selected |
107+
| checkboxProps | IBouncyCheckboxProps | undefined | default props for all checkboxes |
107108

108109
## Customization (Optionals)
109110

110111
## [React Native Bouncy Checkbox Customizations](https://github.com/WrathChaos/react-native-bouncy-checkbox#configuration---props)
111112

112-
You can use all of the customiztion options from the rn bouncy checkbox. You NEED to add the styling and props into the `data`. Therefore, you can customize each of the checkboxes easly.
113+
You can use all of the customiztion options from the rn bouncy checkbox. You NEED to add the styling and props into the `data`. Therefore, you can customize each of the checkboxes easily.
113114

114115
## Future Plans
115116

lib/BouncyCheckboxGroup.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,20 @@ import useStateWithCallback from "./helpers/useStateWithCallback";
1212
type CustomStyleProp = StyleProp<ViewStyle> | Array<StyleProp<ViewStyle>>;
1313

1414
export interface ICheckboxButton extends IBouncyCheckboxProps {
15-
id: number;
15+
id: string | number;
1616
}
1717

1818
interface IBouncyCheckboxGroupProps {
1919
style?: CustomStyleProp;
2020
initial?: number;
2121
data: ICheckboxButton[];
2222
onChange: (selectedItem: ICheckboxButton) => void;
23+
checkboxProps?: IBouncyCheckboxProps;
2324
}
2425

2526
const BouncyCheckboxGroup: React.FC<IBouncyCheckboxGroupProps> = ({
2627
style,
28+
checkboxProps,
2729
initial,
2830
data,
2931
onChange,
@@ -44,6 +46,7 @@ const BouncyCheckboxGroup: React.FC<IBouncyCheckboxGroupProps> = ({
4446
item.id === (selectedItem ? selectedItem?.id : initial);
4547
return (
4648
<BouncyCheckbox
49+
{...checkboxProps}
4750
{...item}
4851
key={item.id}
4952
disableBuiltInState

0 commit comments

Comments
 (0)