diff --git a/package.json b/package.json index e4cada2..bae9242 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "1.0.1", + "version": "1.0.2", "license": "MIT", "main": "dist/index.js", "typings": "dist/index.d.ts", diff --git a/src/OffScreen.tsx b/src/OffScreen.tsx index 01a9fe7..19bcd72 100644 --- a/src/OffScreen.tsx +++ b/src/OffScreen.tsx @@ -1,11 +1,9 @@ import React, { Suspense } from 'react'; import { Repeater } from './Repeater'; -import type { FC, ReactNode } from 'react'; +import type { FC } from 'react'; +import type { IProps } from './type'; -export const Offscreen: FC<{ - mode: 'visible' | 'hidden'; - children: ReactNode; -}> = (props) => { +export const Offscreen: FC = (props) => { const { mode, children } = props; return ( diff --git a/src/Repeater.tsx b/src/Repeater.tsx index d5101d6..2328e83 100644 --- a/src/Repeater.tsx +++ b/src/Repeater.tsx @@ -1,10 +1,8 @@ import React, { useRef, useEffect } from 'react'; -import type { FC, ReactNode } from 'react'; +import type { FC } from 'react'; +import type { IProps } from './type'; -export const Repeater: FC<{ - mode: 'visible' | 'hidden'; - children: ReactNode; -}> = (props) => { +export const Repeater: FC = (props) => { // props const { mode, children } = props; // refs diff --git a/src/index.ts b/src/index.ts index c459bb8..a7d11b5 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1 +1,3 @@ export { Offscreen } from './OffScreen'; + +export type { OffscreenMode } from './type'; \ No newline at end of file diff --git a/src/type.ts b/src/type.ts new file mode 100644 index 0000000..f53ce05 --- /dev/null +++ b/src/type.ts @@ -0,0 +1,8 @@ +import type { ReactNode } from 'react'; + +export type OffscreenMode = 'visible' | 'hidden'; + +export interface IProps { + mode: OffscreenMode; + children: ReactNode; +} \ No newline at end of file