<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Passing on map properties from the parent to the children in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234387#M5815</link>
    <description>&lt;P&gt;THank you. I followed the first method I am almost there.&lt;/P&gt;&lt;P&gt;In the child component, I console log the&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LefterisKoumis_0-1669168484701.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56657i8735D0BCE93BE232/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LefterisKoumis_0-1669168484701.png" alt="LefterisKoumis_0-1669168484701.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and I get this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LefterisKoumis_1-1669168570327.png" style="width: 750px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56658iC39A4AA9F6C3967F/image-dimensions/750x250?v=v2" width="750" height="250" role="button" title="LefterisKoumis_1-1669168570327.png" alt="LefterisKoumis_1-1669168570327.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to access the this.props.mapView.view which it is a property because under it is the map module.&lt;/P&gt;&lt;P&gt;However, when I console log&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LefterisKoumis_3-1669168912538.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56661iF921BB2103E9807C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LefterisKoumis_3-1669168912538.png" alt="LefterisKoumis_3-1669168912538.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I get the red underline that the view is not a property of the mapView, however the console outputs the x coordinate. Why does it works? I was able to add a layer using the this.props.mapView.view.map.add&lt;/P&gt;&lt;P&gt;This is confusing. Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 23 Nov 2022 02:09:17 GMT</pubDate>
    <dc:creator>LefterisKoumis</dc:creator>
    <dc:date>2022-11-23T02:09:17Z</dc:date>
    <item>
      <title>Passing on map properties from the parent to the children</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234216#M5809</link>
      <description>&lt;P&gt;Hello. A React newbie here.&lt;/P&gt;&lt;P&gt;I have a long script and for the purpose of managing the code I split it to different components.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the widget (parent) component that I store the selected map in the jimuMapView.&lt;/P&gt;&lt;P&gt;Then, I have the children components that need to use the props of the jimuMapView so they add layers and graphics to that map, or other actions like zoom and so forth.&lt;/P&gt;&lt;P&gt;So, my question is how in the children components I can access the jimuMapView from the parent to add the layers?&lt;/P&gt;&lt;P&gt;None of the documentation or examples in ESRI address this scenario.&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1104"&gt;@RobertScheitlin__GISP&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/404038"&gt;@Grant-S-Carroll&lt;/a&gt;&amp;nbsp;or anyone else? Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; 
activeViewChangeHandler = (jmv: JimuMapView) =&amp;gt; {
    if (jmv) {this.setState({ jimuMapView: jmv }); }
  };


&amp;lt;div className="widget-addLayers jimu-widget p-2"&amp;gt;
        {this.props.hasOwnProperty("useMapWidgetIds") &amp;amp;&amp;amp;
          this.props.useMapWidgetIds &amp;amp;&amp;amp;
          this.props.useMapWidgetIds[0] &amp;amp;&amp;amp; (
            &amp;lt;JimuMapViewComponent
              useMapWidgetId={this.props.useMapWidgetIds?.[0]}
              onActiveViewChange={this.activeViewChangeHandler}
            /&amp;gt;
          )}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 18:45:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234216#M5809</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2022-11-22T18:45:46Z</dc:date>
    </item>
    <item>
      <title>Re: Passing on map properties from the parent to the children</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234235#M5810</link>
      <description>&lt;P&gt;Hi There&lt;/P&gt;&lt;P&gt;There are a couple of ways of achieving this, depending of what your are trying to do in your child component.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. You can simply pass the jimuMapView through in to your child component, by making the mapView a prop of the child component, see below.&lt;/P&gt;&lt;P&gt;In your child component, create an interface for the props.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrantSCarroll_0-1669144339330.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56599iC4B12BEEBAAE6851/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrantSCarroll_0-1669144339330.png" alt="GrantSCarroll_0-1669144339330.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Then reference these in the class/function depending on what pattern you are using.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrantSCarroll_1-1669144381068.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56600iA9114EEB770915CA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrantSCarroll_1-1669144381068.png" alt="GrantSCarroll_1-1669144381068.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can then access the map via this.props.mapView&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrantSCarroll_2-1669144471729.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56601i22F8F58C1498B15D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrantSCarroll_2-1669144471729.png" alt="GrantSCarroll_2-1669144471729.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. The second appropach is ito pass in functions from the parent component that act on the mapView.&lt;/P&gt;&lt;P&gt;As before within your props interface in your&amp;nbsp; child component, add in a reference to the function.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrantSCarroll_3-1669144568028.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56602i367FE3BF6D6B32D8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrantSCarroll_3-1669144568028.png" alt="GrantSCarroll_3-1669144568028.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Then when you need to call this function within the child, call this.props.&amp;lt;functionName&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrantSCarroll_4-1669144721094.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56603i2BE8EE569C01C15F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrantSCarroll_4-1669144721094.png" alt="GrantSCarroll_4-1669144721094.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Within the parent component, it looks like this.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrantSCarroll_5-1669144830107.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56604i9B87D2AECB54798D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrantSCarroll_5-1669144830107.png" alt="GrantSCarroll_5-1669144830107.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;In the example above, the parent component is actual a child component of widget.tsx, so I have passed the mapView down several times.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully that all makes sense?&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2022 19:21:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234235#M5810</guid>
      <dc:creator>Grant-S-Carroll</dc:creator>
      <dc:date>2022-11-22T19:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: Passing on map properties from the parent to the children</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234387#M5815</link>
      <description>&lt;P&gt;THank you. I followed the first method I am almost there.&lt;/P&gt;&lt;P&gt;In the child component, I console log the&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LefterisKoumis_0-1669168484701.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56657i8735D0BCE93BE232/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LefterisKoumis_0-1669168484701.png" alt="LefterisKoumis_0-1669168484701.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;and I get this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LefterisKoumis_1-1669168570327.png" style="width: 750px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56658iC39A4AA9F6C3967F/image-dimensions/750x250?v=v2" width="750" height="250" role="button" title="LefterisKoumis_1-1669168570327.png" alt="LefterisKoumis_1-1669168570327.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I want to access the this.props.mapView.view which it is a property because under it is the map module.&lt;/P&gt;&lt;P&gt;However, when I console log&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LefterisKoumis_3-1669168912538.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/56661iF921BB2103E9807C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LefterisKoumis_3-1669168912538.png" alt="LefterisKoumis_3-1669168912538.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;I get the red underline that the view is not a property of the mapView, however the console outputs the x coordinate. Why does it works? I was able to add a layer using the this.props.mapView.view.map.add&lt;/P&gt;&lt;P&gt;This is confusing. Thank you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 02:09:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234387#M5815</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2022-11-23T02:09:17Z</dc:date>
    </item>
    <item>
      <title>Re: Passing on map properties from the parent to the children</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234501#M5816</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/14521"&gt;@LefterisKoumis&lt;/a&gt;&amp;nbsp;looks like you are passing the jimuMapView to your component and not the jimuMapView.view. I use method one that Grant suggested in most of my custom components and pass the actual view object and don't have any problems.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 14:47:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234501#M5816</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2022-11-23T14:47:36Z</dc:date>
    </item>
    <item>
      <title>Re: Passing on map properties from the parent to the children</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234535#M5817</link>
      <description>&lt;P&gt;Yes, you are correct. What a novice mistake. Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Nov 2022 16:01:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1234535#M5817</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2022-11-23T16:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: Passing on map properties from the parent to the children</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1235709#M5826</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1104"&gt;@RobertScheitlin__GISP&lt;/a&gt;&amp;nbsp; After I was passing the&amp;nbsp; jimuMapView.view to the the child component&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; &amp;lt;div&amp;gt;{&amp;lt;ChildComponent mapView={this.state.jimuMapView.view} /&amp;gt;}&amp;lt;/div&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;I am getting the error "Cannot read properties of null (reading 'view')" at runtime. of the line above. It seems that there is async error. The 'this.state.jimuMapView' seems to be null.&lt;/P&gt;&lt;P&gt;To address it, I used this from the FeaturePanel, to no avail:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;activeViewChangeHandler = (jimuMapView: JimuMapView) =&amp;gt; {
    if (null === jimuMapView || undefined === jimuMapView) {
      this.setState({ jimuMapView: null });
      return; //skip null
    }
    this.setState({ jimuMapView: jimuMapView });
  };&lt;/LI-CODE&gt;&lt;P&gt;How can the rendering of the component be delayed until the jimuMapView is not null.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 23:45:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1235709#M5826</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2022-11-28T23:45:04Z</dc:date>
    </item>
    <item>
      <title>Re: Passing on map properties from the parent to the children</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1235711#M5827</link>
      <description>&lt;P&gt;Hi, apologies for lack of response, I'm in the throws of moving houses and islands. What you can do is store the actual mapView in state, not the jimuMapView, so in the onActiveViewChange do something like this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;  onActiveViewChange = (jimuMapView: JimuMapView) =&amp;gt; {
        if (!(jimuMapView &amp;amp;&amp;amp; jimuMapView.view)) {
            return;
        }
        this.setState({ mapView:jimuMapView.view });
 }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then within your child component, you will need to handle the case where the view is null, but it should prevent the issues you are facing with the null value, as the re-render will occur anytime the state is updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;</description>
      <pubDate>Mon, 28 Nov 2022 23:59:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1235711#M5827</guid>
      <dc:creator>Grant-S-Carroll</dc:creator>
      <dc:date>2022-11-28T23:59:08Z</dc:date>
    </item>
    <item>
      <title>Re: Passing on map properties from the parent to the children</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1235739#M5828</link>
      <description>&lt;P&gt;THank you.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I got this error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LefterisKoumis_0-1669686389622.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/57060i4A5630488B5C8DD8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LefterisKoumis_0-1669686389622.png" alt="LefterisKoumis_0-1669686389622.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Question. Should we use the componentDidMount to update the jimuMapView state to avoid async&amp;nbsp; errors?&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 02:22:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1235739#M5828</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2022-11-29T02:22:31Z</dc:date>
    </item>
    <item>
      <title>Re: Passing on map properties from the parent to the children</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1235742#M5829</link>
      <description>&lt;P&gt;You just need to make sure that you have declared the mapView as the right type. Its not a jimuMapView you are assigning the view property of the jimuMapView, which can either be a MapView or a SceneView.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GrantSCarroll_0-1669688823355.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/57065i4ABA66EF14986561/image-size/medium?v=v2&amp;amp;px=400" role="button" title="GrantSCarroll_0-1669688823355.png" alt="GrantSCarroll_0-1669688823355.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Component did mount will only fire once, when the component is mounted in to the DOM. At that stage, the map will most likely not have loaded, hence why using activeViewChange is the best place to capture when the map has loaded.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Nov 2022 02:29:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/passing-on-map-properties-from-the-parent-to-the/m-p/1235742#M5829</guid>
      <dc:creator>Grant-S-Carroll</dc:creator>
      <dc:date>2022-11-29T02:29:13Z</dc:date>
    </item>
  </channel>
</rss>

