Skip to content

Commit

Permalink
fix: 🐛 react-is replace isReactElement
Browse files Browse the repository at this point in the history
  • Loading branch information
charlzyx committed Jan 23, 2024
1 parent 85da4ec commit 127bc92
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 5 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"@types/qs": "^6.9.11",
"@types/react": "^18.2.47",
"@types/react-dom": "^18.2.18",
"@types/react-is": "^18.2.4",
"@types/react-resizable": "^3.0.7",
"china-location": "^2.1.0",
"father": "^4.3.8",
Expand Down
2 changes: 0 additions & 2 deletions src/__builtins__/checkers.ts

This file was deleted.

5 changes: 2 additions & 3 deletions src/shadow-form/shadow-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
useFieldSchema,
} from "@formily/react";
import React, { useContext, useMemo } from "react";
import { isReactElement } from "../__builtins__";
import ReactIs from "react-is";

export const useShadowSchemaField = (
schemaFieldOptions?: Parameters<ReturnType<typeof createSchemaField>>[0],
Expand Down Expand Up @@ -73,14 +73,13 @@ export const ShadowForm: React.FC<React.PropsWithChildren<IShadowFormOptions>> =
field.data = field.data ?? {};
field.data._form = form;
}

const child = // at x-component
im === "component" ? (
<FormProvider form={form}>
<SchemaField schema={schema}></SchemaField>
</FormProvider>
) : // at x-decorator
isReactElement(children) ? (
ReactIs.isElement(children) ? (
React.cloneElement(children, {
...children.props,
form,
Expand Down

0 comments on commit 127bc92

Please sign in to comment.