UNPKG

@prosperitainova/dumbo-react-native

Version:
44 lines 1.66 kB
import React from 'react'; import { StyleProp, SwitchProps, ViewStyle } from 'react-native'; /** Props for Toggle component */ export type ToggleProps = { /** Text to render */ label: string; /** Helper text to render */ helperText?: string; /** Indicate if toggled */ toggled: boolean; /** Indicate if disabled */ disabled?: boolean; /** Indicate if label should be hidden (label is used for accessibility even when hidden) */ hideLabel?: boolean; /** Selected label text (if not set will not show) */ selectedLabelText?: { on: string; off: string; }; /** onPress event returns the current value */ onChange: (value: boolean) => void; /** Style to set on the item */ style?: StyleProp<ViewStyle>; /** Style to set on the toggle wrapper itself */ toggleWrapperStyle?: StyleProp<ViewStyle>; /** Direct props to set on the React Native component (including iOS and Android specific props). Most use cases should not need this. */ componentProps?: SwitchProps; }; /** * Toggle component for rendering a boolean toggle switch * This component utilizes Native Switch from iOS and Android. * It is styled to be similar to Carbon. * But relies on the final styling from the OS. * * {@link https://github.com/carbon-design-system/carbon-react-native/blob/main/example/src/Views/Toggle.tsx | Example code} */ export declare class Toggle extends React.Component<ToggleProps> { private get styles(); private get textInputStyles(); private get trackColor(); private onChange; render(): React.ReactNode; } //# sourceMappingURL=index.d.ts.map