UNPKG

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

40 lines 1.54 kB
/** * SwitchContext * * Provides a React Context for managing a group of Switch components. * - Stores the currently selected values (multi-select array). * - Exposes a callback to update the selected values. * - Used internally by `SwitchGroup` and consumed by individual `Switch` components * via the `useSwitchGroupContext` hook. * * Author: Geeky Hawks FZE LLC */ import React from "react"; /** * Shape of the Switch group context value. * - **selectedValues**: array of currently selected switch values. * - **onValueChange**: callback to update selected values when a switch is toggled. */ export interface SwitchGroupContextType { /** Array of selected switch values */ selectedValues: Array<string | number>; /** * Callback to update selected values * @param value - switch value that was toggled * @param selected - true if switch is turned on, false if turned off */ onValueChange: (value: string | number, selected: boolean) => void; } /** * React Context for managing switch group state. * Provides `selectedValues` and `onValueChange` to nested Switch components. */ export declare const SwitchGroupContext: React.Context<SwitchGroupContextType>; /** * Hook to access the current `SwitchGroupContext`. * Should only be used inside components wrapped by a `SwitchGroup`. * * @returns The current switch group context or `null` if not inside a group. */ export declare const useSwitchGroupContext: () => SwitchGroupContextType; //# sourceMappingURL=SwitchContext.d.ts.map