Wednesday, December 7, 2022
HomeiOS Developmentios - TextField isn't moved again down with keyboard avoidance on

ios – TextField isn’t moved again down with keyboard avoidance on


Does any know what I’ve carried out incorrect right here?

Drawback

After I faucet on the textual content area and the keyboard seems. Faucet on the navgation hyperlink to get to the second display. Then return, the textual content area has not returned to the “non-focused” place.

  • iOS: 16
  • Sim: iPhone 14 Professional

Expectation

I’m anticipating to see the textual content area again at its unique beginning place. That’s, once I faucet the sphere, the keyboard avoidance causes that area to maneuver up. Then I faucet return on the keyboard to dismiss the keyboard, the textual content area returns to its beginning place. After I navigation between view, I anticipate the identical behaviour as a result of the keyboard has been dismissed.

Steps

  • Faucet the textField (assuming software program keyboard is on)
  • Faucet the navigationLink
  • Faucet Again
import SwiftUI

struct ContentView: View {
    @State non-public var textual content: String = "Whats up, world!"

    var physique: some View {
        NavigationView {
            VStack {
                NavigationLink("Whats up", vacation spot: { Textual content("World") })

                TextField("Whoops", textual content: $textual content)
            }
        }
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments