Browse Source

Improve autosize textarea scrollbar style, close #6609

pull/6646/head
afc163 8 years ago
parent
commit
726541ae08
  1. 4
      components/input/calculateNodeHeight.tsx

4
components/input/calculateNodeHeight.tsx

@ -119,6 +119,7 @@ export default function calculateNodeHeight(
let minHeight = -Infinity;
let maxHeight = Infinity;
let height = hiddenTextarea.scrollHeight;
let overflowY;
if (boxSizing === 'border-box') {
// border-box: add border, since height = content + padding + border
@ -144,8 +145,9 @@ export default function calculateNodeHeight(
if (boxSizing === 'border-box') {
maxHeight = maxHeight + paddingSize + borderSize;
}
overflowY = height > maxHeight ? '' : 'hidden';
height = Math.min(maxHeight, height);
}
}
return { height, minHeight, maxHeight };
return { height, minHeight, maxHeight, overflowY };
}

Loading…
Cancel
Save