@@ -239,6 +239,7 @@ class LocationField extends Component {
239
239
label,
240
240
showClearButton,
241
241
static : isStatic ,
242
+ suppressNearby,
242
243
type,
243
244
nearbyStops
244
245
} = this . props
@@ -275,10 +276,12 @@ class LocationField extends Component {
275
276
// Add to the selection handler lookup (for use in _onKeyDown)
276
277
this . locationSelectedLookup [ itemIndex ] = locationSelected
277
278
278
- // Create and add the option item to the menu items array
279
- const currentLocationOption = createOption ( optionIcon , optionTitle , locationSelected , itemIndex === activeIndex )
280
- menuItems . push ( currentLocationOption )
281
- itemIndex ++
279
+ if ( ! suppressNearby ) {
280
+ // Create and add the option item to the menu items array
281
+ const currentLocationOption = createOption ( optionIcon , optionTitle , locationSelected , itemIndex === activeIndex )
282
+ menuItems . push ( currentLocationOption )
283
+ itemIndex ++
284
+ }
282
285
283
286
/* 2) Process geocode search result option(s) */
284
287
if ( geocodedFeatures . length > 0 ) {
@@ -309,7 +312,7 @@ class LocationField extends Component {
309
312
}
310
313
311
314
/* 3) Process nearby transit stop options */
312
- if ( nearbyStops . length > 0 ) {
315
+ if ( nearbyStops . length > 0 && ! suppressNearby ) {
313
316
// Add the menu sub-heading (not a selectable item)
314
317
menuItems . push ( < MenuItem header key = 'ns-header' > Nearby Stops</ MenuItem > )
315
318
@@ -380,6 +383,8 @@ class LocationField extends Component {
380
383
</ InputGroup . Addon >
381
384
382
385
if ( isStatic ) { // 'static' mode (menu is displayed alongside input)
386
+ if ( isStatic ) {
387
+ // 'static' mode (menu is displayed alongside input, e.g., for mobile view)
383
388
return (
384
389
< div className = 'location-field static' >
385
390
< form >
@@ -393,12 +398,18 @@ class LocationField extends Component {
393
398
</ InputGroup >
394
399
</ FormGroup >
395
400
</ form >
396
- < ul className = 'dropdown-menu' >
397
- { menuItems }
401
+ < ul className = 'dropdown-menu' style = { { width : '100%' } } >
402
+ { menuItems . length > 0 // Show typing prompt to avoid empty screen
403
+ ? menuItems
404
+ : < MenuItem header className = { 'text-center' } >
405
+ Begin typing to search for locations
406
+ </ MenuItem >
407
+ }
398
408
</ ul >
399
409
</ div >
400
410
)
401
- } else { // default display mode with dropdown menu
411
+ } else {
412
+ // default display mode with dropdown menu
402
413
return (
403
414
< form >
404
415
< FormGroup className = 'location-field' >
0 commit comments