The resize method is invoked whenever the elements on the Qlik Sense client are resized. In technical terms, it listens to the resize() event invoked by the API by calling qlik.resize.
Using resize() allows you to separate the treatment of a change in size and change in the model (data, properties, and selections).
If resize() is implemented, paint() is not called! Hence, you need to call paint() in your resize() function:
resize: function ($element, layout) {
this.paint($element, layout);
},