<?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 Unable to use sketch class on Jimumapview in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-use-sketch-class-on-jimumapview/m-p/1237545#M79543</link>
    <description>&lt;P&gt;i am getting this error when try to add a sketch on jimuMapview widget,&lt;BR /&gt;&lt;STRONG&gt;error&lt;/STRONG&gt;: "[esri.support.LayersMixin] #add() The item being added is not a Layer or a Promise that resolves to a Layer."".&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Aim&lt;/STRONG&gt;: to enable a sketch tool on the map(jimuMapview) so as i can drawn a shape and do ascreen shot and save, so now i can not implement sketch with jimuMapview class.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;here is my codes:&lt;BR /&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;EM&gt;/&lt;STRONG&gt; @jsx jsx / import { React, AllWidgetProps, jsx } from "jimu-core"; import { JimuMapViewComponent, JimuMapView } from "jimu-arcgis"; import Sketch from "@arcgis/core/widgets/Sketch"; import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer"; export default class Widget extends React.PureComponent&amp;lt;AllWidgetProps&amp;lt;any&amp;gt;, any&amp;gt; {&lt;BR /&gt;&lt;BR /&gt;state = { jimuMapView: null, }; activeViewChangeHandler = (jmv: JimuMapView) =&amp;gt; { let graphicsLayer = new GraphicsLayer(); if (jmv) { this.setState({ jimuMapView: jmv }); jmv.view.when(() =&amp;gt; { const sketch = new Sketch({ layer: graphicsLayer, view: jmv.view, creationMode: "update", }); jmv.view.ui.add(sketch, "top-right"); // this.state.jimuMapView.view.map.add(this.graphicsLayer); }); }}; render() { return &amp;lt;div className="widget-starter jimu-widget"&amp;gt; {/ *&lt;/STRONG&gt; ADD **/} {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; ) } &amp;lt;/div&amp;gt;; } }&lt;/EM&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 03 Dec 2022 12:13:09 GMT</pubDate>
    <dc:creator>StephanoWamlyoma</dc:creator>
    <dc:date>2022-12-03T12:13:09Z</dc:date>
    <item>
      <title>Unable to use sketch class on Jimumapview</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-use-sketch-class-on-jimumapview/m-p/1237545#M79543</link>
      <description>&lt;P&gt;i am getting this error when try to add a sketch on jimuMapview widget,&lt;BR /&gt;&lt;STRONG&gt;error&lt;/STRONG&gt;: "[esri.support.LayersMixin] #add() The item being added is not a Layer or a Promise that resolves to a Layer."".&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;Aim&lt;/STRONG&gt;: to enable a sketch tool on the map(jimuMapview) so as i can drawn a shape and do ascreen shot and save, so now i can not implement sketch with jimuMapview class.&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;here is my codes:&lt;BR /&gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;EM&gt;/&lt;STRONG&gt; @jsx jsx / import { React, AllWidgetProps, jsx } from "jimu-core"; import { JimuMapViewComponent, JimuMapView } from "jimu-arcgis"; import Sketch from "@arcgis/core/widgets/Sketch"; import GraphicsLayer from "@arcgis/core/layers/GraphicsLayer"; export default class Widget extends React.PureComponent&amp;lt;AllWidgetProps&amp;lt;any&amp;gt;, any&amp;gt; {&lt;BR /&gt;&lt;BR /&gt;state = { jimuMapView: null, }; activeViewChangeHandler = (jmv: JimuMapView) =&amp;gt; { let graphicsLayer = new GraphicsLayer(); if (jmv) { this.setState({ jimuMapView: jmv }); jmv.view.when(() =&amp;gt; { const sketch = new Sketch({ layer: graphicsLayer, view: jmv.view, creationMode: "update", }); jmv.view.ui.add(sketch, "top-right"); // this.state.jimuMapView.view.map.add(this.graphicsLayer); }); }}; render() { return &amp;lt;div className="widget-starter jimu-widget"&amp;gt; {/ *&lt;/STRONG&gt; ADD **/} {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; ) } &amp;lt;/div&amp;gt;; } }&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 03 Dec 2022 12:13:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/unable-to-use-sketch-class-on-jimumapview/m-p/1237545#M79543</guid>
      <dc:creator>StephanoWamlyoma</dc:creator>
      <dc:date>2022-12-03T12:13:09Z</dc:date>
    </item>
  </channel>
</rss>

