For example:
<img width="1904" alt="Screen Shot 2021-11-05 at 11 59 05 AM" src="https://user-images.githubusercontent.com/29597/140540816-25d6d47b-7aea-4121-aeaa-565accc65b1f.png">

*/
  removeAllSubviews() {
    this.subviews.forEach(subview => (subview.superview = undefined));
    this.subviews = [];
  }
  /**
   * Executes the display flow if this view needs to be drawn.
   *
   * 1. Lays out subviews with `layoutSubviews`.
   * 2. Draws content with `draw`.
   */
  displayIfNeeded(context: CanvasRenderingContext2D, viewRefs: ViewRefs) {
    if (
      (this._needsDisplay || this._subviewsNeedDisplay) &&
      rectIntersectsRect(this.frame, this.visibleArea) &&
      !sizeIsEmpty(this.visibleArea.size)
    ) {
      this.layoutSubviews();
      if (this._needsDisplay) this._needsDisplay = false;
      if (this._subviewsNeedDisplay) this._subviewsNeedDisplay = false;
      
      const visibleArea = this.visibleArea;
      const region = new Path2D();
      region.rect(
        visibleArea.origin.x,
        visibleArea.origin.y,
        visibleArea.size.width,
        visibleArea.size.height,
      );
      context.save();