<?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 Custom widget error in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-error/m-p/1202759#M78288</link>
    <description>&lt;P&gt;Hi, I am new to ArcGIS JS and have been following your docs and tutorials. I have a problem with my custom widget which is made based off the Custom Widget docs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was not able to upload a post containing code here so I put my code to github:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/safarviktor/arcgisJS-widget-demo" target="_blank"&gt;https://github.com/safarviktor/arcgisJS-widget-demo&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is an error from Widget.js:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;TypeError: Cannot add property properties, object is not extensible&lt;BR /&gt;at s (Widget.js:5:1)&lt;BR /&gt;at g (tracking.js:5:1)&lt;BR /&gt;at M.render (Widget.js:5:1)&lt;BR /&gt;at h (projector.js:5:1)&lt;BR /&gt;at Object.merge (projector.js:5:1)&lt;BR /&gt;at l._attach (Widget.js:5:1)&lt;BR /&gt;at _internalHandles.add.initial (Widget.js:5:1)&lt;BR /&gt;at reactiveUtils.js:5:1&lt;BR /&gt;at m (reactiveUtils.js:5:1)&lt;BR /&gt;at f (reactiveUtils.js:5:1)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;There is a DIV element added to the DOM - likely a wrapper for the widget - but not the content of the widget:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ViktorSafar_0-1660558277823.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48612iAE881CC14DA184F1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ViktorSafar_0-1660558277823.png" alt="ViktorSafar_0-1660558277823.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 15 Aug 2022 10:12:36 GMT</pubDate>
    <dc:creator>ViktorSafar</dc:creator>
    <dc:date>2022-08-15T10:12:36Z</dc:date>
    <item>
      <title>Custom widget error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-error/m-p/1202759#M78288</link>
      <description>&lt;P&gt;Hi, I am new to ArcGIS JS and have been following your docs and tutorials. I have a problem with my custom widget which is made based off the Custom Widget docs.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was not able to upload a post containing code here so I put my code to github:&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/safarviktor/arcgisJS-widget-demo" target="_blank"&gt;https://github.com/safarviktor/arcgisJS-widget-demo&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is an error from Widget.js:&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;TypeError: Cannot add property properties, object is not extensible&lt;BR /&gt;at s (Widget.js:5:1)&lt;BR /&gt;at g (tracking.js:5:1)&lt;BR /&gt;at M.render (Widget.js:5:1)&lt;BR /&gt;at h (projector.js:5:1)&lt;BR /&gt;at Object.merge (projector.js:5:1)&lt;BR /&gt;at l._attach (Widget.js:5:1)&lt;BR /&gt;at _internalHandles.add.initial (Widget.js:5:1)&lt;BR /&gt;at reactiveUtils.js:5:1&lt;BR /&gt;at m (reactiveUtils.js:5:1)&lt;BR /&gt;at f (reactiveUtils.js:5:1)&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;There is a DIV element added to the DOM - likely a wrapper for the widget - but not the content of the widget:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ViktorSafar_0-1660558277823.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48612iAE881CC14DA184F1/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ViktorSafar_0-1660558277823.png" alt="ViktorSafar_0-1660558277823.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 10:12:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-error/m-p/1202759#M78288</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2022-08-15T10:12:36Z</dc:date>
    </item>
    <item>
      <title>Re: Custom widget error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-error/m-p/1202872#M78291</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/607319"&gt;@ViktorSafar&lt;/a&gt; you can't really mix React/TypeScript with our JS API Widget framework. To work around that try the following to allow the widget to parse correctly:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;// @ts-nocheck
/** @jsxRuntime classic */
/** @jsx tsx */
import Widget from "@arcgis/core/widgets/Widget";
import { subclass } from "@arcgis/core/core/accessorSupport/decorators";
import { renderable, tsx } from "@arcgis/core/widgets/support/widget";
// import React from 'react';

@subclass("esri.widgets.HelloWorld")
class HelloWorldWidget extends Widget {

    render() {
        console.log("rendering")
        return (
            &amp;lt;div id="myhello"&amp;gt;
                HELLO
            &amp;lt;/div&amp;gt;
        );
    }
}

export default HelloWorldWidget;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I also recommend updating your package.json browserslist to minimize transpiling:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="css"&gt;  "browserslist": {
    "production": [
      "last 1 Chrome version",
      "last 1 Firefox version",
      "last 2 Edge major versions",
      "last 2 Safari major versions",
      "last 2 iOS major versions",
      "Firefox ESR"
    ],
    "development": [
      "last 1 Chrome version",
      "last 1 Firefox version",
      "last 2 Edge major versions",
      "last 2 Safari major versions",
      "last 2 iOS major versions",
      "Firefox ESR"
    ]
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2022 15:05:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-error/m-p/1202872#M78291</guid>
      <dc:creator>AndyGup</dc:creator>
      <dc:date>2022-08-15T15:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Custom widget error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-error/m-p/1203923#M78330</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/180"&gt;@AndyGup&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;First of all, thanks for the above answer, it helped me to solve this issue.&lt;/P&gt;&lt;P&gt;As I said, the above solution worked when I use the native html markup, however, when I add Material UI for example, the error below occurs.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jefferson_bzp_0-1660765884297.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48859i2168728678099ACA/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jefferson_bzp_0-1660765884297.png" alt="jefferson_bzp_0-1660765884297.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Source code&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jefferson_bzp_1-1660765921238.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/48860i5413ABD25AF804D6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jefferson_bzp_1-1660765921238.png" alt="jefferson_bzp_1-1660765921238.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Is there a workaround?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2022 19:52:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-error/m-p/1203923#M78330</guid>
      <dc:creator>jefferson_bzp</dc:creator>
      <dc:date>2022-08-17T19:52:35Z</dc:date>
    </item>
    <item>
      <title>Re: Custom widget error</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-error/m-p/1233641#M79396</link>
      <description>&lt;P&gt;Tips to fix-&lt;/P&gt;&lt;P&gt;Launch the App. Widgets are extensions of an app installed on your phone.&amp;nbsp;&lt;BR /&gt;Restart Your Device.&amp;nbsp;&lt;BR /&gt;Remove and Re-Add the Widget.&amp;nbsp;&lt;BR /&gt;Disable Battery Optimization.&amp;nbsp;&lt;BR /&gt;Check for App Updates.&amp;nbsp;&lt;BR /&gt;Clear App Data and Cache.&amp;nbsp;&lt;BR /&gt;Update Your Phone.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greeting,&lt;/P&gt;&lt;P&gt;Rachel Gomez&lt;/P&gt;</description>
      <pubDate>Mon, 21 Nov 2022 06:02:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/custom-widget-error/m-p/1233641#M79396</guid>
      <dc:creator>RachelGomez</dc:creator>
      <dc:date>2022-11-21T06:02:21Z</dc:date>
    </item>
  </channel>
</rss>

