Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Text does not wrap when isScrollingEnabled is set to false #7

Open
mattmaddux opened this issue Feb 14, 2020 · 5 comments
Open

Text does not wrap when isScrollingEnabled is set to false #7

mattmaddux opened this issue Feb 14, 2020 · 5 comments

Comments

@mattmaddux
Copy link

If you write a long line with the following view...

struct TestView: View {
    
    @State var text: String = ""
    @State var isEditing: Bool = false
    
    var body: some View {
        TextView(text: $text, isEditing: $isEditing, isScrollingEnabled: false)
    }
    
}

...the text won't wrap and view keeps getting wider.

But if you just change it back to true...

struct TestView: View {
    
    @State var text: String = ""
    @State var isEditing: Bool = false
    
    var body: some View {
        TextView(text: $text, isEditing: $isEditing, isScrollingEnabled: true)
    }
    
}

...it works fine.

@kenmueller
Copy link
Owner

Try setting the width explicitly, does it still have that problem?

@mattmaddux
Copy link
Author

Yeah, unfortunately it still doesn't wrap even if you set the width. You can see below I put a border just so you can see the shape of the view. It looks like the SwiftUI view is staying the appropriate width, but the UIView inside it is expanding.

2020-02-26 10 47 43

@cblackcom
Copy link

Is it possible that the isScrollingEnabled property should actually be isScrollEnabled ?

@kenmueller
Copy link
Owner

No, I set the isScrollEnabled property on the UITextView, I just slightly changed the name for the constructor parameter.

@ninjudd
Copy link

ninjudd commented May 10, 2024

This should fix it: https://stackoverflow.com/a/60278105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants