diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..efc2aca --- /dev/null +++ b/index.d.ts @@ -0,0 +1,24 @@ +import * as React from 'react'; + +export type Layer = unknown; +export type LayerTransitionConfig = { keyframes: Keyframe[], timing: KeyframeAnimationOptions, mask?: CSSStyleDeclaration }; +export type EventListenerHook = (listener: () => any, deps?: readonly any[]) => void; + +export const Stack: React.FunctionComponent<{ + layersState?: [Layer[], React.Dispatch>]; + style?: React.CSSProperties, + className?: string, + children?: React.ReactChild | ((stack: React.ReactChild) => React.ReactChild); +}>; + +export const createLayer: (children: React.ReactChild, config?: LayerTransitionConfig) => Layer; + +export const usePushLayer: () => (children: React.ReactChild, config: LayerTransitionConfig) => void; +export const usePopLayer: () => (config?: LayerTransitionConfig) => void; + +export const useWillFocusListener: EventListenerHook; +export const useDidFocusListener: EventListenerHook; +export const useWillBlurListener: EventListenerHook; +export const useDidBlurListener: EventListenerHook; + +export default Stack; diff --git a/package.json b/package.json index 835920c..e0f1eed 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-layers-stack", "description": "Push and pop React view layers with transitions", - "version": "0.2.0", + "version": "0.2.1", "license": "MIT", "author": "DAB0mB", "repository": { diff --git a/types.d.ts b/types.d.ts deleted file mode 100644 index 8bffbab..0000000 --- a/types.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -import * as React from 'react'; - -export type Layer = unknown; -export type LayerTransitionConfig = { keyframes: Keyframe[], timing: KeyframeAnimationOptions, mask?: CSSStyleDeclaration }; -export type EventListenerHook = (listener: () => any, deps?: readonly any[]) => void; - -export type Stack = React.FunctionComponent<{ - layersState?: [Layer[], React.SetStateAction]; - style?: React.CSSProperties, - className?: string, - children?: React.ReactChildren | ((stack: React.ReactChildren) => React.ReactChildren); -}>; - -export type createLayer = (children: React.ReactChildren, config?: LayerTransitionConfig) => Layer; - -export type usePushLayer = () => (children: React.ReactChildren, config: LayerTransitionConfig) => void; -export type usePopLayer = () => (config?: LayerTransitionConfig) => void; - -export type useWillFocusListener = EventListenerHook; -export type useDidFocusListener = EventListenerHook; -export type useWillBlurListener = EventListenerHook; -export type useDidBlurListener = EventListenerHook; - -export default Stack;