Select to view content in your preferred language

On-screen keyboard leaves UI expanded underneath.

1782
4
Jump to solution
12-20-2022 12:34 PM
DuanePfeiffer
New Contributor III

Not sure if this is an Apple/SwiftUI issue or an Esri issue.  If I put a textfield in my view and then the keyboard is activated, when the keyboard disappears, the map view display doesn't expand back to where it was before keyboard activated.  See attached photos in order 90, 91, 92

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
DuanePfeiffer
New Contributor III

This is a Apple/SwiftUI issue.  I had to wrap my MapViewReader in a scrollview and scrollview in a GeometryReader.  I would have thought Apple would have a better solution by now.

GeometryReader { geo in

            ScrollView() {

                VStack {

                    MapViewReader { mapViewProxy in

                        MapView(map: AppData.shared.map)...

                }

            }
    }.frame(height:geo.size.height). // ScrollView

}

 

View solution in original post

0 Kudos
4 Replies
DuanePfeiffer
New Contributor III

The problem goes away if I remove my HStack at the bottom of the view.

0 Kudos
DuanePfeiffer
New Contributor III

This is a Apple/SwiftUI issue.  I had to wrap my MapViewReader in a scrollview and scrollview in a GeometryReader.  I would have thought Apple would have a better solution by now.

GeometryReader { geo in

            ScrollView() {

                VStack {

                    MapViewReader { mapViewProxy in

                        MapView(map: AppData.shared.map)...

                }

            }
    }.frame(height:geo.size.height). // ScrollView

}

 

0 Kudos
dfeinzimer
New Contributor

Hi Duane, thank you for reaching out and welcome to the new beta Swift SDK! I'm glad to see you were able to find a workaround. I'm not sure of the exact requirements you are working with but if you're able to, leaving the scroll view out entirely may also help.

 

If you have any further questions feel free to respond to this or open a new thread!

0 Kudos
DuanePfeiffer
New Contributor III

I had to add the scrollview to fix the initial problem of the view not being restored after the on-screen keyboard was dismissed. Even dismissed from a modal view in full screen!  Since I don't fill out any text input from the main map view screen, I don't need that screen to move up when text input happens.  Adding the scrollview with proper height prevents my HStack from resizing, thus fixing the issue.  So far the new beta Swift SDK is working but I'm just getting started.  Next item is location display.  Thanks for your input.