mapbox / mapbox-maps-android

Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL.
https://www.mapbox.com/mobile-maps-sdk
Other
464 stars 131 forks source link

Map bounds are wrong while toggling the keyboard #2398

Open dryaz opened 3 months ago

dryaz commented 3 months ago

Environment

Observed behavior and steps to reproduce

If you go from screen with opened keyboard back to the map screen the map won't be drawn on part of the screen below keyboard.

https://github.com/mapbox/mapbox-maps-android/assets/1395176/e708ad81-de84-4a35-b819-0eb7dc9e6f88

If you first close keyboard and then go back to the map screen - all good.

https://github.com/mapbox/mapbox-maps-android/assets/1395176/a4481428-2417-486e-b1e4-45266fc2c915

Expected behavior

Map successfully defines it bounds in case of composing the same time keyboard toggling.

Notes / preliminary analysis

Other several devices + emulator yet works OK. Current mode is android:windowSoftInputMode="adjustResize"

dryaz commented 3 months ago

Found more context:

We put map inside container which has imePadding()

Column(
        modifier = Modifier
            .fillMaxSize()
            .imePadding()
rnalbandyan commented 1 week ago

We are also facing similar issue, when navigating back to the map screen. The mapViewportState.cameraState is kept and has the same value, but when trying to get the bounds it returns wrong values. We are using the MapEffect to get the bounds.

val bounds = map.coordinateBoundsForCamera(
    cameraState.toCameraOptions()
)