UNPKG

react-native-bouncy-checkbox-group

Version:

Fully customizable bouncy checkbox group for React Native

43 lines (42 loc) 1.39 kB
import * as React from "react"; import { StyleProp, ViewStyle } from "react-native"; import { BouncyCheckboxProps } from "react-native-bouncy-checkbox"; export interface CheckboxItem extends Omit<BouncyCheckboxProps, "id"> { id: string | number; } export type SelectionID = string | number; export type InitialSelection = SelectionID | SelectionID[]; export interface BouncyCheckboxGroupProps { style?: StyleProp<ViewStyle>; initial?: InitialSelection; data: CheckboxItem[]; onChange: (selectedItem: CheckboxItem | CheckboxItem[]) => void; checkboxProps?: BouncyCheckboxProps; /** * Allow multiple checkboxes to be selected simultaneously * @default false */ multiple?: boolean; /** * Ensures one checkbox is always selected (works only in single select mode) * If trying to unselect the only selected item, it will remain selected * @default false */ alwaysSelect?: boolean; /** * Custom animation duration for bounce effect * @default 300 */ animationDuration?: number; /** * Custom spacing between checkboxes * @default 0 */ spacing?: number; /** * Custom container style for each checkbox */ itemContainerStyle?: StyleProp<ViewStyle>; } declare const BouncyCheckboxGroup: React.FC<BouncyCheckboxGroupProps>; export default BouncyCheckboxGroup;