I am working on a custom widget for an EB Developer application and the on 'click' event won't fire when in mobile layout, but fires as expected in Desktop and Table layout. Each layout does have it's own map and I do have access to the map view in each case, so I don't think that is the issue. Also, nothing is blocking the map in mobile layout (verified in the Page outline) and I have popups enabled for the map.
jimuMapView.view.whenLayerView(cLayer).then((layerView) => {
let highlight
const mapDiv = document.getElementById("jimu-widget-a11y-widget_47")
console.log("jimu map view ", jimuMapView) //this is defined
jimuMapView.view.on("click", function(evt) {
console.log("click zoom level ", jimuMapView.view.zoom)
let screenPoint = {
x: evt.x,
y: evt.y
}
jimuMapView.view.hitTest(screenPoint, {include[cLayer]})
.then(function(resp) {
console.log("Hello!")
const graphHits = resp.results?.filter(
(hitResult) => hitResult.type === "graphic"
);
if(graphHits?.length > 0) {
const county = graphHits[0].graphic.attributes.COUNTY
if(county && currCounty !== county) {
if (jimuMapView.view.zoom >= 6 && jimuMapView.view.zoom < 8.5) {
highlight && highlight.remove();
highlight = layerView.highlight(graphHits[0].graphic);
hoverCty.current = county
hoverGraph.current = graphHits[0].graphic
showLabel(county, screenPoint, mapDiv)
} else {
if(mapDiv.hasChildNodes() && mapDiv.childNodes.length > 1) {
mapDiv.removeChild(mapDiv.childNodes[1])
}
}
hoverCty.current = county
}
} else {
if(mapDiv.hasChildNodes() && mapDiv.childNodes.length > 1) {
mapDiv.removeChild(mapDiv.childNodes[1])
hoverCty.current = ""
}
highlight && highlight.remove();
}
})
})
})