Skip to content

react-native, typescript and HTMLElement #54

Description

@nabati

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>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions