@atlaskit/renderer
Version:
Renderer component
19 lines (18 loc) • 1.02 kB
TypeScript
import React from 'react';
declare const Provider: React.Provider<string | undefined>;
type Props = {
nestedHeaderIds: string[];
onNestedHeaderIdMatch: () => void;
};
/**
* We need to expose this abstraction on top of the native Consumer in order to control when
* The consumer will get notified when a match has happened. If we use the Consumer directly in
* Expand components without this inner state, everytime a new prop comes in, and the `newActiveHeaderId`
* is the same as before, we will set the expand to true forever, until the active header id changes.
* Thus, the user won't be able to collapse the expand.
*
* By exposing `onNestedHeaderIdMatch` here we can control when will consumers be notified:
* only when a `newActiveHeaderId` comes in from the Provider and the list of header ids includes it.
*/
declare const ActiveHeaderIdConsumer: ({ nestedHeaderIds, onNestedHeaderIdMatch, }: Props) => React.JSX.Element;
export { Provider as ActiveHeaderIdProvider, ActiveHeaderIdConsumer };