Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Fix: [TextFile] do not pass onChange when input prop is provided#43

Merged
nicosampler merged 1 commit intodevelopmentfrom
fix-textFile
Jul 22, 2020
Merged

Fix: [TextFile] do not pass onChange when input prop is provided#43
nicosampler merged 1 commit intodevelopmentfrom
fix-textFile

Conversation

@nicosampler
Copy link
Contributor

No description provided.

@nicosampler nicosampler requested review from fernandomg and mmv08 July 22, 2020 14:57
@ghost
Copy link

ghost commented Jul 22, 2020

Travis automatic deployment:
https://pr43--safereactcomponents.review.gnosisdev.com

Copy link
Contributor

@mmv08 mmv08 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicosampler
Copy link
Contributor Author

@mikheevm I'm trying something like this:

type ConditionalProps =
  | {
      input: React.InputHTMLAttributes<HTMLInputElement>; // added for compatibility with react-final-form
      onChange?: (event: React.ChangeEvent<HTMLInputElement>) => void;
    }
  | {
      onChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
    };

interface BaseProps extends React.InputHTMLAttributes<HTMLInputElement> {
  value: string;
  label: string;
  readOnly?: boolean;
  meta?: {
    error?: string;
  };
  startAdornment?: React.ReactElement;
  endAdornment?: React.ReactElement;
  className?: string;
}

type Props = BaseProps & ConditionalProps;

but it's not working, seems like we need to replicate all the keys. One with all keys but input and the other with all the types but onChange. Seems like overkill to me. wdyt?

@nicosampler nicosampler merged commit 7bb55de into development Jul 22, 2020
@nicosampler nicosampler deleted the fix-textFile branch August 19, 2020 18:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants