Skip to content

Commit 6ec78e4

Browse files
authored
Merge pull request #264 from gluestack/feat/typings-formcontrol
feat: added formcontrol typings
2 parents 44374ef + e844f44 commit 6ec78e4

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

packages/form-control/src/FormControl.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import React, { forwardRef } from 'react';
22
import { useFormControlProvider, FormControlContext } from './useFormControl';
3+
import type { IFormControlProps } from './types';
34

4-
const FormControl = (StyledFormControlBox: any) =>
5-
forwardRef(({ ...props }: any, ref: any) => {
5+
const FormControl = <T,>(StyledFormControlBox: React.ComponentType<T>) =>
6+
forwardRef(({ ...props }: T & IFormControlProps, ref: any) => {
67
const { htmlProps, ...context } = useFormControlProvider(props);
78

89
const { isDisabled, isInvalid, ...remainingProps } = context;

packages/form-control/src/types.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export type IFormControlComponentType<
3535
LabelAstrick,
3636
Helper,
3737
HelperText
38-
> = ((props: Root) => JSX.Element) & {
38+
> = ((props: Root & InterfaceFormControlProps) => JSX.Element) & {
3939
Error: React.MemoExoticComponent<(props: Error) => JSX.Element> & {
4040
Text: React.MemoExoticComponent<(props: ErrorText) => JSX.Element>;
4141
Icon: React.MemoExoticComponent<(props: ErrorIcon) => JSX.Element>;
@@ -48,3 +48,4 @@ export type IFormControlComponentType<
4848
Text: React.MemoExoticComponent<(props: HelperText) => JSX.Element>;
4949
};
5050
};
51+
export type IFormControlProps = InterfaceFormControlProps;

yarn.lock

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2358,6 +2358,17 @@
23582358
"@react-native-aria/focus" "^0.2.7"
23592359
react-native-svg "13.4.0"
23602360

2361+
"@gluestack-ui/[email protected]":
2362+
version "0.1.0"
2363+
resolved "https://registry.yarnpkg.com/@gluestack-ui/select/-/select-0.1.0.tgz#d7c23cb027323ed971f1c54937edd98c2c6b32ab"
2364+
integrity sha512-I92KGTVF41Og6g22EraaCfoCSZ9hdjPs8lx2o+IGUKRelgdcDk0Mqp04wDaCLn4eSUeQgwpp2jNowpFQ46ZlEw==
2365+
dependencies:
2366+
"@gluestack-ui/hooks" latest
2367+
"@gluestack-ui/react-native-aria" latest
2368+
"@gluestack-ui/utils" latest
2369+
"@react-native-aria/focus" "^0.2.7"
2370+
react-native-svg "13.4.0"
2371+
23612372
"@gluestack-ui/[email protected]":
23622373
version "0.1.1"
23632374
resolved "https://registry.yarnpkg.com/@gluestack-ui/slider/-/slider-0.1.1.tgz#a3417195a6fea6f7cd2a6bdf8cfdf23ccd65481b"

0 commit comments

Comments
 (0)