@geekyhawks/react-native-ui-components
Version:
A lightweight and reusable React Native UI components library with customizable Text, TextInput, FloatingLabelTextInput, Button, and more. Built with TypeScript, fully typed, and designed for easy integration into any React Native project.
45 lines • 1.67 kB
TypeScript
/**
* RadioGroup
*
* Provides a container for managing a group of `Radio` components.
* - Maintains the currently selected value in state (controlled or uncontrolled).
* - Passes down context (`RadioGroupContext`) so individual radios can update and reflect selection.
* - Ensures only one radio can be selected at a time within the group.
*
* Author: Geeky Hawks FZE LLC
*/
import React from "react";
import { ViewProps } from "react-native";
/**
* Props for the RadioGroup component
*
* - **children**: Radio buttons to render inside the group.
* - **onValueChange**: callback triggered when a different radio is selected.
* - **selectedValue**: currently selected radio value.
*/
export interface RadioGroupProps extends ViewProps {
/** Radio buttons to render inside the group */
children: React.ReactNode;
/** Callback triggered when a different radio is selected */
onValueChange: (val: string | number) => void;
/** Currently selected radio value */
selectedValue: string | number | undefined;
}
/**
* RadioGroup
*
* A container that manages a set of `Radio` components.
* - Provides the selected value and change handler through context.
* - Can operate in controlled (`value` + `onValueChange`) or uncontrolled (`defaultValue`) mode.
* - Ensures mutual exclusivity: only one `Radio` can be selected at a time.
*
* Example:
* ```tsx
* <RadioGroup value={selected} onValueChange={setSelected}>
* <Radio value="option1" label="Option 1" />
* <Radio value="option2" label="Option 2" />
* </RadioGroup>
* ```
*/
export declare const RadioGroup: React.FC<RadioGroupProps>;
//# sourceMappingURL=RadioGroup.d.ts.map