-
-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'react-textarea-autosize': patch | ||
--- | ||
|
||
`maxHeight` and `minHeight` has been disallowed as part of `TextareaAutosizeProps['style']`. The intention to do that was there since the v8 release but it was not implemented correctly and allowed those to slip into the mentioned type. |
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -4,17 +4,16 @@ import getSizingData, { SizingData } from './getSizingData'; | |||
import { useComposedRef, useWindowResizeListener } from './hooks'; | ||||
import { noop } from './utils'; | ||||
|
||||
type TextareaProps = React.TextareaHTMLAttributes<HTMLTextAreaElement>; | ||||
|
||||
type Style = Omit< | ||||
NonNullable<JSX.IntrinsicElements['textarea']['style']>, | ||||
NonNullable<TextareaProps['style']>, | ||||
'maxHeight' | 'minHeight' | ||||
> & { | ||||
height?: number; | ||||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Andarist
Author
Owner
|
node.style.height = `${height}px`; |
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
Andarist
Jun 5, 2020
Author
Owner
Well, a number pushes you to actually provide a meaningful value which should be the same one that we are going to calculate after mount. Allowing arbitrary string values (including auto
) has a higher chance of a consumer providing incorrect value - or to rephrase: one that might cause FOUC. This is at least the intention behind this, I'm happy to reconsider this.
This comment has been minimized.
This comment has been minimized.
Sorry, something went wrong.
kolking
Dec 1, 2023
The redefined height
type doesn't match CSSProperties
type, so when you try to pass a style
object of CSSProperties
type (which is correct), you'll get a typescript error because height
types are incompatible. Below is how to reproduce the issue:
const style: React.CSSProperties = { color: 'red' };
<TextareaAutosize style={style} />
I agree with @Haaxor1689 that the height
type should be left unchanged.
Why is the
height
prop redefined here? I don't see it being used anywhere in code and also shouldn't it be omitted just like min/max height?