Download react-page/packages/editor/src/ui/AutoformControls/AutoFieldContext.tsx from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 814 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-page/packages/editor/src/ui/AutoformControls/AutoFieldContext.tsx
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/react-page/packages/editor/src/ui/AutoformControls/AutoFieldContext.tsx
-
curl -L -o AutoFieldContext.tsx https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/react-page/packages/editor/src/ui/AutoformControls/AutoFieldContext.tsx
814 Bytes
| import type { FC, PropsWithChildren } from 'react'; | |
| import React from 'react'; | |
| import { AutoField } from '../uniform-mui'; | |
| const AutofieldContextProvider: FC<PropsWithChildren> = ({ children }) => ( | |
| <AutoField.componentDetectorContext.Provider | |
| value={(props, uniforms) => { | |
| const show = props.showIf?.(uniforms.model) ?? true; | |
| if (!show) return () => null; | |
| // see https://github.com/react-page/react-page/issues/1187 | |
| // we remap props.component to props._customComponent to avoid the underlying issue in uniforms | |
| if (props._customComponent) { | |
| return props._customComponent; | |
| } | |
| return AutoField.defaultComponentDetector(props, uniforms); | |
| }} | |
| > | |
| {children} | |
| </AutoField.componentDetectorContext.Provider> | |
| ); | |
| export default AutofieldContextProvider; | |