react-final-form-hooks icon indicating copy to clipboard operation
react-final-form-hooks copied to clipboard

react-native, typescript and HTMLElement

Open nabati opened this issue 6 years ago • 0 comments

Either I'm misunderstanding something, or there seems to be some space for improvement for using this with react-native and typescript. The hickup I bumped into was

export interface FieldRenderProps<FieldValue, T extends HTMLElement> {
  input: FieldInputProps<FieldValue, T>;
  meta: FieldMetaState<FieldValue>;
}

.... 

interface FieldInputProps<FieldValue, T extends HTMLElement> {
  name: string;
  onBlur: (event?: React.FocusEvent<T>) => void;
  onChange: (event: React.ChangeEvent<T> | any) => void;
  onFocus: (event?: React.FocusEvent<T>) => void;
  type?: string;
  value: FieldValue;
  checked?: boolean;
  multiple?: boolean;
}

And, I'd venture, HTMLElement isn't something used in react-native. If you point me in the right direction, I would probably be able to put in the leg-work to make it work.

The library itself seems to be working fine.

Quick fix would be to use something like

 FieldRenderProps<string, HTMLElement>

nabati avatar Aug 06 '19 13:08 nabati