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

Failed to adjust height when scrolling is disabled inside a ScrollView #214

Open
2horse9sun opened this issue Nov 24, 2024 · 3 comments
Open
Labels
adjustment Changes to existing functionality

Comments

@2horse9sun
Copy link

I was trying to embed the RichTextEditor inside a ScrollView and disable the scrolling of the RichTextEditor like this:

import SwiftUI
import RichTextKit

struct Test: View {
    @State var text: NSAttributedString = NSAttributedString(string: "This is a very long string. This is a very long string. This is a very long string. This is a very long string. This is a very long string. This is a very long string. This is a very long string. This is a very long string. This is a very long string. ")
    @StateObject var context = RichTextContext()
    
    var body: some View {
        ScrollView {
            Text("Title")
            RichTextEditor(
                text: $text,
                context: context,
                viewConfiguration: { view in
                    if let richTextView = view as? RichTextView {
                        richTextView.configuration.isScrollingEnabled = false
                    }
                }
            )
            
        }
    }
}

#Preview {
    Test()
}

However, the result was:
image

It seems that the RichTextEditor won't adjust its height when scrolling is disabled and at the same time embedded into a ScrollView.

@lan680
Copy link

lan680 commented Dec 3, 2024

I'm running a similar issue. Hopefully someone will be able to shed light on a potential solution. Thank you!

@danielsaidi
Copy link
Owner

Hi @2horse9sun

Thanks for reporting this.

@danielsaidi danielsaidi added the adjustment Changes to existing functionality label Dec 9, 2024
@lan680
Copy link

lan680 commented Dec 9, 2024

Thank you for the response, Daniel. Would you please advise once the adjustment is being made? Thanks again.

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

No branches or pull requests

3 participants