Skip to content

Commit cc3ef7a

Browse files
author
liuchuan
committed
feat: offscreenMode类型导出
1 parent bf42511 commit cc3ef7a

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "1.0.1",
2+
"version": "1.0.2",
33
"license": "MIT",
44
"main": "dist/index.js",
55
"typings": "dist/index.d.ts",

src/OffScreen.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import React, { Suspense } from 'react';
22
import { Repeater } from './Repeater';
3-
import type { FC, ReactNode } from 'react';
3+
import type { FC } from 'react';
4+
import type { IProps } from './type';
45

5-
export const Offscreen: FC<{
6-
mode: 'visible' | 'hidden';
7-
children: ReactNode;
8-
}> = (props) => {
6+
export const Offscreen: FC<IProps> = (props) => {
97
const { mode, children } = props;
108
return (
119
<Suspense>

src/Repeater.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import React, { useRef, useEffect } from 'react';
2-
import type { FC, ReactNode } from 'react';
2+
import type { FC } from 'react';
3+
import type { IProps } from './type';
34

4-
export const Repeater: FC<{
5-
mode: 'visible' | 'hidden';
6-
children: ReactNode;
7-
}> = (props) => {
5+
export const Repeater: FC<IProps> = (props) => {
86
// props
97
const { mode, children } = props;
108
// refs

src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
export { Offscreen } from './OffScreen';
2+
3+
export type { OffscreenMode } from './type';

src/type.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { ReactNode } from 'react';
2+
3+
export type OffscreenMode = 'visible' | 'hidden';
4+
5+
export interface IProps {
6+
mode: OffscreenMode;
7+
children: ReactNode;
8+
}

0 commit comments

Comments
 (0)