crisp-im / crisp-sdk-ios

:package: Crisp iOS SDK, add a chat in any iOS app and communicate with your users.
https://docs.crisp.chat/guides/chatbox-sdks/ios-sdk/
Other
44 stars 19 forks source link

[SwiftUI] Conversations don't appear when typing message #99

Closed Franciscortega closed 2 months ago

Franciscortega commented 2 months ago

Hi !

I'm using the iOS SDK to present the ChatViewController() through UIViewControllerRepresentable in SwiftUI :

import Foundation
import CrispWebRTC

import SwiftUI
struct CrispViewRepresentable: UIViewControllerRepresentable {
    typealias UIViewControllerType = ChatViewController

    func makeUIViewController(context: Context) -> ChatViewController {
        ChatViewController()
    }

    func updateUIViewController(_ uiViewController: ChatViewController, context: Context) {
        // Updates the state of the specified view controller with new information from SwiftUI.
    }
}

I then present it in a sheet :

 .sheet(isPresented: $openCripsSheet, content: {
                CrispViewRepresentable()
            })

The sheet appears correctly, but when starting to type a message, the messages go up and become invisible, including the currently redacted message and the send button : IMG_ED251B2A8A52-1

nesium commented 2 months ago

Hi @Franciscortega. Please use the ChatView instead of wrapping the ChatViewController. That should solve your problem.