Skip to content

Commit f65db0f

Browse files
committed
don't know; too many TODOs
1 parent bda4037 commit f65db0f

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/App.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -221,17 +221,18 @@ function LargeScreenLayout({ query, route, map, error, mapOptions, encodedValues
221221
function 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}>

src/sidebar/search/AddressInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ export default function AddressInput(props: AddressInputProps) {
156156
<PlainButton
157157
className={styles.btnClose}
158158
onClick={() => {
159-
setHasFocus(false)
160159
hideSuggestions()
160+
setHasFocus(false)
161161
}}
162162
>
163163
<ArrowBack />

0 commit comments

Comments
 (0)