verdnatura-chat/app/containers/TextInput/ControlledFormTextInput.tsx

18 lines
535 B
TypeScript
Raw Permalink Normal View History

import React from 'react';
import { Control, Controller } from 'react-hook-form';
import { FormTextInput, IRCTextInputProps } from './FormTextInput';
interface IControlledFormTextInputProps extends IRCTextInputProps {
control: Control<any>;
name: string;
}
export const ControlledFormTextInput = ({ control, name, ...props }: IControlledFormTextInputProps) => (
<Controller
control={control}
name={name}
render={({ field: { onChange, value } }) => <FormTextInput onChangeText={onChange} value={value} {...props} />}
/>
);