import React, { Component } from 'react'; import type { ImageSourcePropType, ImageStyle, StyleProp, TextStyle, ViewStyle } from 'react-native'; import { Animated } from 'react-native'; export interface AccordionProps { /** * Duration of the icon spin animation */ animationDuration?: number; /** * Arrow icon to use; should be oriented facing right (>) */ arrowIconImage?: ImageSourcePropType; /** * Range of rotation for open/closed arrows */ arrowRange?: string[]; /** * Icon to use when open if icon format is 'image' */ openIconImage?: ImageSourcePropType; /** * Icon to use when closed if icon format is 'image' */ closedIconImage?: ImageSourcePropType; /** * Whether to disable the animation (default false) */ disableAnimation?: boolean; /** * Whether to display the icon as an image w open/closed options, * an arrow which rotates on open/close, or plus/minus (default is plus/minus) */ iconFormat?: 'arrow' | 'image' | 'plusminus'; /** * Bottom padding * * @deprecated Put the padding on the accordion contents instead */ padding?: number; /** * Whether to initialize as open or closed */ state?: 'closed' | 'open'; /** * Color of the title touch highlight */ titleUnderlayColor?: string; /** * Left and right padding (has defaults) */ paddingHorizontal?: number; /** * Styles for the arrow icon */ arrowIconStyle?: StyleProp; /** * Styles for open icon image */ openIconStyle?: StyleProp; /** * Styles for open icon image */ closedIconStyle?: StyleProp; /** * Content of the accordion * * @deprecated Make the contents a child instead */ content?: JSX.Element | JSX.Element[]; /** * Styles for the accordion content container */ contentStyle?: StyleProp; /** * Styles for the accordion container when open */ openStyle?: StyleProp; /** * Styles for the accordion title when open */ openTitleStyle?: StyleProp; /** * Styles for the plus minus icon */ plusMinusStyle?: StyleProp; /** * Function to be invoked when the accordion is opened. Animation will be disabled! */ renderContent?: () => React.ReactNode; /** * Styles for the accordion container */ style?: StyleProp; /** * Content of the accordion title */ title: JSX.Element | string; /** * Styles for the accordion title container */ titleContainerStyle?: StyleProp; /** * Image to include on left side of title */ titleImage?: ImageSourcePropType; /** * Styles for the title image */ titleImageStyle?: StyleProp; /** * Styles for the accordion title */ titleStyle?: StyleProp; /** * Styles for the accordion title text */ titleTextStyle?: StyleProp; /** * Height of title touch highlight (has default) */ titleTouchStyle?: StyleProp; dataSet?: Record; liftPropsForm?: JSX.Element; } export interface AccordionState { arrowTranslateAnimation: Animated.Value; contentHeightAnimation: Animated.Value; contentHeight: number; isOpen: boolean; } /** * Component for a single accordion with a title that will show/hide the contents * via a slide animation when tapped. The default state can be 'open' or 'closed' * via the state property. The default is closed. * * Because of how padding and flexed items are handled, the dimensions of the * accordion can be customized via two props: padding and paddingHorizontal. The padding * prop controls the height of the contents, and the paddingHorizontal prop controls the size of * the left and right padding for the title as well as the padding around the contents. * This is because on iOS padding does not affect the height of a flexed container; the * height of said container is determined solely based on the height of its children. (On * web the height is the padding + height of the children.) */ export declare class Accordion extends Component { static defaultProps: Partial; constructor(props: AccordionProps); /** * Animates the content to a given height and rotates the disclosure indicator. * * @param height The height to which to animate the accordion. * @param shouldOpen Whether to set the diclosure indicator to an open or closed state. */ private readonly animateContent; /** * On first layout, get the height of the contents so we can determine how high we should expand * the container when we animate. * * @param event The layout event. */ private readonly contentOnLayout; /** * Returns whether or not the accordion should animate opening. * * @return Returns true if the accordion should animate opening. */ private readonly shouldEnableAnimation; /** * Renders the accordion disclosure icon as an arrow. * * @return The accordion disclosure icon. */ private renderArrowIcon; /** * Renders the accordion disclosure icon. * * @return The accordion disclosure icon. */ private renderIcon; /** * Toggles the accordion open or closed. */ private readonly toggleAccordion; render(): JSX.Element; }