Created
July 23, 2020 17:58
-
-
Save mattyoung/9b49b67ed662b8c362009d8ebb4feebe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct KeyboardAvoidance: View { | |
@State var text = "" | |
var body: some View { | |
VStack { | |
// Only work if something is added below the list | |
TextField("Enter", text: $text) | |
List { | |
ForEach(1...50, id: \.self) { | |
Text("More \($0)") | |
} | |
Text("End of List") | |
} | |
// by adding this for keyboard avoidance | |
// Color.clear | |
// .frame(width: 0, height: 0) | |
} | |
// or add this also cause it to work | |
// .padding() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment