【发布时间】:2021-07-21 17:33:39
【问题描述】:
我在一个项目中使用了 React/Mapbox(更具体地说是 DeckGL)的组合。我想包括用于查询地址的地理编码。
我目前的输出:
使用此代码生成:
<DeckGL {...deckGLProps} ref={deckRef}>
<StaticMap
ref={mapRef}
{...staticMapProps}
/>
<div style={{ border: '5px solid black', top: 500, display: 'inline-block', zIndex: '9999'}}>
<Geocoder
mapRef={mapRef}
onViewportChange={handleGeocoderViewportChange}
mapboxApiAccessToken={process.env.REACT_APP_MAPBOX_TOKEN}
position="top-left"
minLength={1}
trackProximity={true}
countries={"us"}
reverseGeocode={true}
enableEventLogging={false}
/>
</div>
</DeckGL>
我的问题:我无法点击搜索栏。搜索栏在其div 中的奇怪位置表明了这一点。有没有办法放置组件以使搜索栏可点击?我认为Geocoder 组件没有问题,因为this 示例中的代码可以正常工作。
【问题讨论】:
标签: reactjs mapbox mapbox-gl-js deck.gl react-map-gl