Skip to content

Commit

Permalink
feat: offscreenMode类型导出
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchuan committed Oct 20, 2023
1 parent bf42511 commit cc3ef7a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.1",
"version": "1.0.2",
"license": "MIT",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
Expand Down
8 changes: 3 additions & 5 deletions src/OffScreen.tsx
Original file line number Diff line number Diff line change
@@ -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<IProps> = (props) => {
const { mode, children } = props;
return (
<Suspense>
Expand Down
8 changes: 3 additions & 5 deletions src/Repeater.tsx
Original file line number Diff line number Diff line change
@@ -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<IProps> = (props) => {
// props
const { mode, children } = props;
// refs
Expand Down
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
export { Offscreen } from './OffScreen';

export type { OffscreenMode } from './type';
8 changes: 8 additions & 0 deletions src/type.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { ReactNode } from 'react';

export type OffscreenMode = 'visible' | 'hidden';

export interface IProps {
mode: OffscreenMode;
children: ReactNode;
}

0 comments on commit cc3ef7a

Please sign in to comment.