<?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: How to extend MapView class? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138197#M76142</link>
    <description>&lt;P&gt;The views/View class is the base class, it doesn't do anything useful like draw.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You want the views/MapView class. Out of curiosity, what are you trying to accomplish extending the MapView?&lt;/P&gt;</description>
    <pubDate>Fri, 28 Jan 2022 00:06:07 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2022-01-28T00:06:07Z</dc:date>
    <item>
      <title>How to extend MapView class?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138178#M76139</link>
      <description>&lt;P&gt;Hello, apologies in advance, I'm a fairly fresh Esri JS developer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create a custom class extending the MapView class in a React application using the arcgis/core package.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I use the standard MapView class it works fine, if I create a custom subclass (even with no constructor/super at all), it just displays a blank white page. The same method worked fine for the Map class, but the MapView is giving me trouble.&amp;nbsp;I'm not sure how much of this code I can share, so for the time being I'm hoping someone can confirm that it is indeed possible to extend the MapView class like I would any other?&lt;/P&gt;&lt;P&gt;In summary, the code is being called in the top-level app component, and sends the map/mapview to the mapframe window. I'm sending it from there because I need to share it with a sibling component (side bar).&lt;/P&gt;&lt;P&gt;Here's my cMapView (the extended class)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import View from "@arcgis/core/views/MapView";

export default class cMapView extends MapView {
  constructor({ map, extent }) {
    super();
    this.map = map;
    this.extent = extent;
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here's the top level cApp.jsx component:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import React, { useState } from "react";
import cMap from "../js/cMap";
import cMapFrame from "./cMapFrame";
import cMapView from "../js/cMapView";
import { startingExtent as extent } from "../constants/Constants";

const cApp = () =&amp;gt; {
  const [map] = useState(new cMap());

  const cMapView = new cMapView({
    map,
    extent,
  });

  return (
    &amp;lt;&amp;gt;
      &amp;lt;cMapFrame mapView={cMapView} /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

export default cApp;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And here's the MapFrame.jsx:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import React, { useEffect, useRef } from "react";

const cMapFrame = ({ mapView }) =&amp;gt; {
  const mapRef = useRef(null);

  useEffect(() =&amp;gt; {
    if (mapRef.current) {
      mapView.container = mapRef.current;
    }
  }, []);

  return (
    &amp;lt;&amp;gt;
      &amp;lt;div ref={mapRef} className="viewDiv" /&amp;gt;
    &amp;lt;/&amp;gt;
  );
};

export default cMapFrame;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Thanks in advance for any help anyone can provide, it's been a steep learning curve.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 00:21:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138178#M76139</guid>
      <dc:creator>succip</dc:creator>
      <dc:date>2022-01-28T00:21:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to extend MapView class?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138197#M76142</link>
      <description>&lt;P&gt;The views/View class is the base class, it doesn't do anything useful like draw.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;You want the views/MapView class. Out of curiosity, what are you trying to accomplish extending the MapView?&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 00:06:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138197#M76142</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-01-28T00:06:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to extend MapView class?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138203#M76143</link>
      <description>&lt;P&gt;Hi Rene, thanks for your help.&lt;/P&gt;&lt;P&gt;Sorry that's a typo, I am in fact using the MapView class.&lt;/P&gt;&lt;P&gt;I have to set custom events like the mapview.on("layerview-create") and I thought I'd want to keep that in the mapview class instead of in my &amp;lt;App /&amp;gt; component but maybe I should rethink this approach?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 00:26:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138203#M76143</guid>
      <dc:creator>succip</dc:creator>
      <dc:date>2022-01-28T00:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to extend MapView class?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138206#M76144</link>
      <description>&lt;P&gt;It's not usually a class people extend. Most custom classes are Layers. It's an edge case, but usually you can accomplish stuff like that with specific property watching and updating app state as needed.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/programming-patterns/#properties" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/programming-patterns/#properties&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can definitely try, and see if it meets your needs. Exciting stuff!&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 00:34:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138206#M76144</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-01-28T00:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to extend MapView class?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138208#M76145</link>
      <description>&lt;P&gt;I tried extending it and same result. I don't think it's going to work as expected. Could need the TypeScript decorators too, but not sure. I would avoid this approach.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 00:38:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138208#M76145</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2022-01-28T00:38:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to extend MapView class?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138391#M76152</link>
      <description>&lt;P&gt;Okay well that confirms it. Thanks again for your help.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jan 2022 16:14:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-extend-mapview-class/m-p/1138391#M76152</guid>
      <dc:creator>succip</dc:creator>
      <dc:date>2022-01-28T16:14:04Z</dc:date>
    </item>
  </channel>
</rss>

