Accessing element height in NativeScript
<p>I am trying to write a native script app which retrieves the rendered height of the <code>bottle</code> view/element in my xml. I have tried the following code, but unfortunately, I get an error (shown below). Any guidance would be much appreciated.</p>

<p>JS:</p>

<pre><code>var viewModule = require("ui/core/view");
var page;

exports.fabTap = function (args) {
      page = args.object;
      var bottle = page.getViewById("bottle");
      console.log("Height: " + bottle.height);
  }
</code></pre>

<p>XML:</p>

<pre><code>&lt;Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:FAB="nativescript-floatingactionbutton" actionBarHidden="true" loaded="pageLoaded"&gt;
  &lt;GridLayout columns="*, *, *, *" rows="15*, 5*, 20*, 5*, 5*, 5*, 5*, 20*, 20*" width="100%" height="100%" style.backgroundColor="white" &gt;
    &lt;Image src="res://logo" row="0" col="1" colSpan="2" stretch ="aspectFit" class="logo"/&gt;
    &lt;Image id="bottle" src="res://bottle_outline" row="2" col="0" rowSpan="6" colSpan="2" stretch="aspectFit"/&gt;
  &lt;/GridLayout&gt;
&lt;/Page&gt;
</code></pre>

<blockquote>
  <p>Cannot read property 'height' of undefined.</p>
</blockquote>