Skip to content

Commit 69284db

Browse files
committed
Add maxHeight prop
1 parent a48482f commit 69284db

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/input.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
export default class Input extends Component {
77
static defaultProps = {
88
defaultHeight: 0,
9+
maxHeight: null,
910
}
1011

1112
constructor() {
@@ -27,8 +28,9 @@ export default class Input extends Component {
2728

2829
setHeight(newHeight){
2930
// Add some extra margin to prevent flickering
31+
const { defaultHeight, maxHeight = newHeight} = this.props
3032
this.setState({
31-
height: Math.max(this.props.defaultHeight, newHeight) + 25,
33+
height: Math.max(defaultHeight, newHeight > maxHeight ? maxHeight : newHeight) + 10,
3234
});
3335
}
3436

0 commit comments

Comments
 (0)