Skip to content

Commit

Permalink
Merge pull request #4 from SrBrahma/master
Browse files Browse the repository at this point in the history
Add checkboxProps prop and fix id type
  • Loading branch information
WrathChaos authored Aug 26, 2022
2 parents f5ae51a + ab22b29 commit cd61b1a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,13 @@ should work of the example project.
| -------- | :---------------: | :-------: | --------------------------------------------------------- |
| data | ICheckboxButton[] | undefined | set the checkboxes as a data |
| onChange | function | undefined | set your own logic when the group of checkbox is selected |
| checkboxProps | IBouncyCheckboxProps | undefined | default props for all checkboxes |

## Customization (Optionals)

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

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.
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.

## Future Plans

Expand Down
5 changes: 4 additions & 1 deletion lib/BouncyCheckboxGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@ import useStateWithCallback from "./helpers/useStateWithCallback";
type CustomStyleProp = StyleProp<ViewStyle> | Array<StyleProp<ViewStyle>>;

export interface ICheckboxButton extends IBouncyCheckboxProps {
id: number;
id: string | number;
}

interface IBouncyCheckboxGroupProps {
style?: CustomStyleProp;
initial?: number;
data: ICheckboxButton[];
onChange: (selectedItem: ICheckboxButton) => void;
checkboxProps?: IBouncyCheckboxProps;
}

const BouncyCheckboxGroup: React.FC<IBouncyCheckboxGroupProps> = ({
style,
checkboxProps,
initial,
data,
onChange,
Expand All @@ -44,6 +46,7 @@ const BouncyCheckboxGroup: React.FC<IBouncyCheckboxGroupProps> = ({
item.id === (selectedItem ? selectedItem?.id : initial);
return (
<BouncyCheckbox
{...checkboxProps}
{...item}
key={item.id}
disableBuiltInState
Expand Down

0 comments on commit cd61b1a

Please sign in to comment.