@prosperitainova/dumbo-react-native
Version:
Dumbo for React Native Library
44 lines • 1.71 kB
TypeScript
import React from 'react';
import { ViewProps, StyleProp, ViewStyle } from 'react-native';
import { TextTypes } from '../Text';
/** An item to pass to content switcher */
export type SwitcherItem = {
/** Text to render */
text: string;
/** Indicate if item is disabled */
disabled?: boolean;
/** Text type to render (Default is body-compact-01) */
textType?: TextTypes;
/** Any additional data needed to store for the callback */
data?: unknown;
};
/** Props for ContentSwitcher component */
export type ContentSwitcherProps = {
/** Items to render in the content switcher (should try and keep under 3. Anything larger gets hard to read on mobile) */
items: SwitcherItem[];
/** Callback when switcher is changed */
onChange?: (index: number, item: SwitcherItem) => void;
/** Selected index */
selectedIndex?: number;
/** Style to set on the item */
style?: 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?: ViewProps;
};
/**
* ContentSwitcher component for rendering the content switcher
*
* {@link https://github.com/carbon-design-system/carbon-react-native/blob/main/example/src/Views/ContentSwitcher.tsx | Example code}
*/
export declare class ContentSwitcher extends React.Component<ContentSwitcherProps> {
state: {
currentIndex: number;
};
private get styles();
private changeItem;
private getSwitcher;
componentDidUpdate(previousProps: ContentSwitcherProps): void;
componentDidMount(): void;
render(): React.ReactNode;
}
//# sourceMappingURL=index.d.ts.map