@@ -221,17 +221,18 @@ function LargeScreenLayout({ query, route, map, error, mapOptions, encodedValues
221221function SmallScreenLayout ( { query, route, map, error, mapOptions, encodedValues, drawAreas } : LayoutProps ) {
222222 const sheetRef = useRef < BottomSheetRef > ( null )
223223
224+ // TODO a click onto the map should ensure that bottomSheet is at initialHeight or smaller
224225 // TODO in general it is a bit ugly that autocomplete has to move the input to the top (away from where the input was touched/clicked)
225226 // but on iOS it behaves exactly like this
226227 // TODO move osm credits and +/- somewhere else
227228 // TODO dynamically add and remove snapResult if focus for input
228229 // TODO how to measure height of RoutingResult!?
229- const includeRoute = route . routingResult . paths . length ? 100 : 0
230+ const initialHeight = 250
230231
231232 // TODO on iphone the soft keyboard moves the input sometimes too far into the top so that it gets invisible
232233 // window.innerHeight - 50
233234
234- const placeholderHeight = 30
235+ const placeholderHeight = 25
235236 return (
236237 < >
237238 < div style = { { height : placeholderHeight + 'px' } } > </ div >
@@ -242,10 +243,12 @@ function SmallScreenLayout({ query, route, map, error, mapOptions, encodedValues
242243 blocking = { false }
243244 onClick = { ( ) => {
244245 if ( ! sheetRef . current ) return
245- if ( sheetRef . current . height < 200 + includeRoute ) sheetRef . current . snapTo ( 200 + includeRoute )
246+ if ( sheetRef . current . height < initialHeight )
247+ sheetRef . current . snapTo ( initialHeight )
246248 else if ( sheetRef . current . height < window . innerHeight - 50 )
247249 sheetRef . current . snapTo ( window . innerHeight - 50 )
248- else sheetRef . current . snapTo ( 200 + includeRoute )
250+ // TODO how to snap to minHeight?
251+ else sheetRef . current . snapTo ( sheetRef . current . height )
249252 } }
250253 onDragEnd = { ( ) => {
251254 if ( sheetRef . current ) {
@@ -254,11 +257,11 @@ function SmallScreenLayout({ query, route, map, error, mapOptions, encodedValues
254257 // Dispatcher.dispatch(new MobileDragYOffsetEnd(sheetRef.current.height))
255258 }
256259 } }
257- defaultSnap = { ( { minHeight } ) => minHeight }
260+ defaultSnap = { ( { lastSnap , snapPoints } ) => lastSnap ?? snapPoints [ 0 ] }
258261 snapPoints = { ( { minHeight } ) => [
259262 minHeight ,
260263 placeholderHeight ,
261- 200 + includeRoute ,
264+ initialHeight ,
262265 window . innerHeight - 50 ,
263266 ] }
264267 >
@@ -268,7 +271,7 @@ function SmallScreenLayout({ query, route, map, error, mapOptions, encodedValues
268271 error = { error }
269272 encodedValues = { encodedValues }
270273 drawAreas = { drawAreas }
271- onFocus = { b => sheetRef . current ?. snapTo ( b ? window . innerHeight - 50 : 200 + includeRoute ) }
274+ onFocus = { b => sheetRef . current ?. snapTo ( b ? window . innerHeight - 50 : initialHeight ) }
272275 />
273276
274277 < div className = { styles . smallScreenRoutingResult } >
0 commit comments