<?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 know if my widget is on screen ? in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/how-to-know-if-my-widget-is-on-screen/m-p/1116750#M3197</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;To do this, I add this part to my code (after render() is load) :&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;//Observer to know if the dom is on screen&lt;BR /&gt;var observer = new IntersectionObserver((entries) =&amp;gt; {&lt;BR /&gt;entries.forEach(entry =&amp;gt; {&lt;BR /&gt;if (entry.intersectionRatio &amp;gt; 0) {&lt;BR /&gt;console.log("Widget is on screen");&lt;BR /&gt;} else {&lt;BR /&gt;console.log("Widget is NOT on screen");&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;}, { root: document.documentElement });&lt;BR /&gt;//Launch it&lt;BR /&gt;if (this.rootNode) {&lt;BR /&gt;observer.observe(this.rootNode);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In a dom of my render i propose this ref :&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;render() {&lt;BR /&gt;return (&lt;BR /&gt;&amp;lt;React.Fragment&amp;gt;&lt;BR /&gt;&amp;lt;div className='text-primary widget_itineraire_root' ref={(f) =&amp;gt; { this.rootNode = f; }}&amp;gt;&lt;BR /&gt;As you want...&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/React.Fragment&amp;gt;&lt;BR /&gt;);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If something can be include directly in the state of widget it will be easier.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Guillaume&lt;/P&gt;</description>
    <pubDate>Mon, 15 Nov 2021 07:17:44 GMT</pubDate>
    <dc:creator>GuillaumeArnaud</dc:creator>
    <dc:date>2021-11-15T07:17:44Z</dc:date>
    <item>
      <title>How to know if my widget is on screen ?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/how-to-know-if-my-widget-is-on-screen/m-p/1115194#M3157</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I make a widget to complete the map with some graphics item (it search an adress and draw travel to go to a place). I need to place this widget will be place in a bookmarks.&lt;/P&gt;&lt;P&gt;I need to draw this graphics only when this bookmarks is visible. Is there a mean to know the state of visibility of it or to create an onhide function ?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Guillaume&lt;/P&gt;</description>
      <pubDate>Tue, 09 Nov 2021 08:16:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/how-to-know-if-my-widget-is-on-screen/m-p/1115194#M3157</guid>
      <dc:creator>GuillaumeArnaud</dc:creator>
      <dc:date>2021-11-09T08:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to know if my widget is on screen ?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/how-to-know-if-my-widget-is-on-screen/m-p/1116750#M3197</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;To do this, I add this part to my code (after render() is load) :&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;//Observer to know if the dom is on screen&lt;BR /&gt;var observer = new IntersectionObserver((entries) =&amp;gt; {&lt;BR /&gt;entries.forEach(entry =&amp;gt; {&lt;BR /&gt;if (entry.intersectionRatio &amp;gt; 0) {&lt;BR /&gt;console.log("Widget is on screen");&lt;BR /&gt;} else {&lt;BR /&gt;console.log("Widget is NOT on screen");&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;}, { root: document.documentElement });&lt;BR /&gt;//Launch it&lt;BR /&gt;if (this.rootNode) {&lt;BR /&gt;observer.observe(this.rootNode);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;In a dom of my render i propose this ref :&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;render() {&lt;BR /&gt;return (&lt;BR /&gt;&amp;lt;React.Fragment&amp;gt;&lt;BR /&gt;&amp;lt;div className='text-primary widget_itineraire_root' ref={(f) =&amp;gt; { this.rootNode = f; }}&amp;gt;&lt;BR /&gt;As you want...&lt;BR /&gt;&amp;lt;/div&amp;gt;&lt;BR /&gt;&amp;lt;/React.Fragment&amp;gt;&lt;BR /&gt;);&lt;BR /&gt;}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;If something can be include directly in the state of widget it will be easier.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Guillaume&lt;/P&gt;</description>
      <pubDate>Mon, 15 Nov 2021 07:17:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/how-to-know-if-my-widget-is-on-screen/m-p/1116750#M3197</guid>
      <dc:creator>GuillaumeArnaud</dc:creator>
      <dc:date>2021-11-15T07:17:44Z</dc:date>
    </item>
  </channel>
</rss>

