Check out example codes for "html textarea auto height to amount of text". It will help you in understanding the concepts better.

Code Example 1

$('textarea').each(function () {
  this.setAttribute('style', 'height:' + (this.scrollHeight) + 'px;overflow-y:hidden;');
}).on('input', function () {
  this.style.height = 'auto';
  this.style.height = (this.scrollHeight) + 'px';
});

Learn ReactJs, React Native from akashmittal.com