Hi all,
I'm having an issue with iOS 14.4 in my app.
I have a TabView. On the third tab there is a TextField. Below the TextField, there is a button. The button is designed to submit the entry of the TextField, and move the user onto the next tab. So I have something like:
Button(action: {
hideKeyboard()
userDefaults.set(fbName, forKey: "fbName") // set UserDefault from the TextField
withAnimation {
currentTab = 3 // an @State that defines which tab the TabView is currently showing
}
})
This works perfectly on iOS 14.5 & 14.6.
However on iOS 14.4, the switch of tab in TabView doesn't happen unless the user manually hides the keyboard by tapping return, and then presses this button above.
i.e. The issue is when the TabView tries to switch tabs, but the user is still 'editing' in the TextField.
Because the TextField is still being edited it snags the change in view and keeps it on the tab with the TextField. This happens even though I call a hideKeyboard() function because while the keyboard is closing, the tab switch gets called... so it clashes. It needs to complete the closing of the keyboard before the tab is switched?
Can anyone help me with this? Would be very grateful! Thanks