From 9525581591d08f5dfa9b1f7195cd9f699412c8fe Mon Sep 17 00:00:00 2001 From: Thomas Dimson Date: Fri, 14 Jan 2022 09:49:11 -0500 Subject: [PATCH 1/3] Declare the typing file in package.json --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 835920c..02317da 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": { @@ -54,5 +54,6 @@ "react", "navigation", "animations" - ] + ], + "types": "./types.d.ts" } From 90b0db258c7afdaa248d96fa4252cb53cad12d90 Mon Sep 17 00:00:00 2001 From: Thomas Dimson Date: Fri, 14 Jan 2022 10:28:57 -0500 Subject: [PATCH 2/3] Use correct types --- types.d.ts => index.d.ts | 16 ++++++++-------- package.json | 3 +-- 2 files changed, 9 insertions(+), 10 deletions(-) rename types.d.ts => index.d.ts (57%) diff --git a/types.d.ts b/index.d.ts similarity index 57% rename from types.d.ts rename to index.d.ts index 8bffbab..01cadce 100644 --- a/types.d.ts +++ b/index.d.ts @@ -4,21 +4,21 @@ 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<{ +export const 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 const createLayer: (children: React.ReactChildren, config?: LayerTransitionConfig) => Layer; -export type usePushLayer = () => (children: React.ReactChildren, config: LayerTransitionConfig) => void; -export type usePopLayer = () => (config?: LayerTransitionConfig) => void; +export const usePushLayer: () => (children: React.ReactChildren, config: LayerTransitionConfig) => void; +export const usePopLayer: () => (config?: LayerTransitionConfig) => void; -export type useWillFocusListener = EventListenerHook; -export type useDidFocusListener = EventListenerHook; -export type useWillBlurListener = EventListenerHook; -export type useDidBlurListener = EventListenerHook; +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 02317da..e0f1eed 100644 --- a/package.json +++ b/package.json @@ -54,6 +54,5 @@ "react", "navigation", "animations" - ], - "types": "./types.d.ts" + ] } From 346fd0f64c813928a668f1d1989187209585eaff Mon Sep 17 00:00:00 2001 From: Thomas Dimson Date: Fri, 14 Jan 2022 10:46:28 -0500 Subject: [PATCH 3/3] Fix child type --- index.d.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.d.ts b/index.d.ts index 01cadce..efc2aca 100644 --- a/index.d.ts +++ b/index.d.ts @@ -5,15 +5,15 @@ export type LayerTransitionConfig = { keyframes: Keyframe[], timing: KeyframeAni export type EventListenerHook = (listener: () => any, deps?: readonly any[]) => void; export const Stack: React.FunctionComponent<{ - layersState?: [Layer[], React.SetStateAction]; - style?: React.CSSProperties, - className?: string, - children?: React.ReactChildren | ((stack: React.ReactChildren) => React.ReactChildren); + layersState?: [Layer[], React.Dispatch>]; + style?: React.CSSProperties, + className?: string, + children?: React.ReactChild | ((stack: React.ReactChild) => React.ReactChild); }>; -export const createLayer: (children: React.ReactChildren, config?: LayerTransitionConfig) => Layer; +export const createLayer: (children: React.ReactChild, config?: LayerTransitionConfig) => Layer; -export const usePushLayer: () => (children: React.ReactChildren, config: LayerTransitionConfig) => void; +export const usePushLayer: () => (children: React.ReactChild, config: LayerTransitionConfig) => void; export const usePopLayer: () => (config?: LayerTransitionConfig) => void; export const useWillFocusListener: EventListenerHook;