diff --git a/package.json b/package.json index 82794b2..2004f91 100644 --- a/package.json +++ b/package.json @@ -76,7 +76,7 @@ "react-dom": "^0.14.0 || ^15.0.0 || ^16.0.0" }, "dependencies": { - "autosize": "^3.0.15", + "autosize": "^4.0.0", "line-height": "^0.3.1", "prop-types": "^15.5.6" } diff --git a/src/TextareaAutosize.js b/src/TextareaAutosize.js index e6c518e..a24ecd0 100644 --- a/src/TextareaAutosize.js +++ b/src/TextareaAutosize.js @@ -32,9 +32,21 @@ export default class TextareaAutosize extends React.Component { this.updateLineHeight(); // this trick is needed to force "autosize" to activate the scrollbar - setTimeout(() => autosize(this.textarea)); + setTimeout(() => { + try { + autosize(this.textarea); + } catch (e) { + // window.getComputedStyle throws Access is denied on IE + // console.error('Autosize Error:', e); + } + }); } else { - autosize(this.textarea); + try { + autosize(this.textarea); + } catch (e) { + // window.getComputedStyle throws Access is denied on IE + // console.error('Autosize Error:', e); + } } if (onResize) {