Select to view content in your preferred language

On-screen keyboard leaves map blank.

647
2
Jump to solution
02-06-2023 09:53 AM
DuanePfeiffer
New Contributor III

If the on-screen keyboard on my iPad is used, the underlying map is corrupted and no longer shows layers.

I was able to re-produce in the Examples project by adding a textfield to the PopupElementHeader.swift file to  get the keyboard to display.

EDIT: The map is still there, but is panned/zoomed to Antartica

 

struct PopupElementHeader: View {

    let title: String

    let description: String

    @State var text = "Hello"  // DUANE P: ADDED State var

    

    var body: some View {

        VStack(alignment: .leading) {

            // DUANE P: ADDED TEXT FIELD SO KEYBOARD DISPLAYS

            TextField("Work Needed", text: $text)

                .frame(maxWidth:.infinity, alignment: .leading).padding(5).background(Color(UIColor.systemBackground)).border(.gray).cornerRadius(7)

            // Text views with empty text still take up some vertical space in

            // a view, so conditionally check for an empty title and description.

            if !title.isEmpty {

                Text(title)

                    .multilineTextAlignment(.leading)

                    .font(.title2)

                    .foregroundColor(.primary)

            }

            

            if !description.isEmpty {

                Text(description)

                    .multilineTextAlignment(.leading)

                    .font(.subheadline)

                    .foregroundColor(.secondary)

            }

        }

        .padding([.bottom], 4)

    }

}

0 Kudos
1 Solution

Accepted Solutions
DavidFeinzimer
Esri Contributor

Hi Duane, thank you for reaching out and reporting this! From what you've described above, this resembles a known issue that we're working on addressing. In the meantime, I can suggest two different workarounds.

  1. Use the `.ignoresSafeArea(.keyboard, edges: .bottom)` modifier on your map view
  2. Use the `.padding([.bottom], 0.1)` modifier on the highest level view in your heiherchy before your map view. (0.1 is a good amount because it is practically invisible).

Hopefully one of these two workarounds will work for you in the meantime. I've attached a modified version of your code with my workarounds commented out for you to experiment with.

 

Internal Ref: Common #13571

View solution in original post

0 Kudos
2 Replies
DavidFeinzimer
Esri Contributor

Hi Duane, thank you for reaching out and reporting this! From what you've described above, this resembles a known issue that we're working on addressing. In the meantime, I can suggest two different workarounds.

  1. Use the `.ignoresSafeArea(.keyboard, edges: .bottom)` modifier on your map view
  2. Use the `.padding([.bottom], 0.1)` modifier on the highest level view in your heiherchy before your map view. (0.1 is a good amount because it is practically invisible).

Hopefully one of these two workarounds will work for you in the meantime. I've attached a modified version of your code with my workarounds commented out for you to experiment with.

 

Internal Ref: Common #13571
0 Kudos
DuanePfeiffer
New Contributor III

Work around 1 seems to have done the trick.  Thanks!