Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
fix: 🐛 Card Details: crash if clicking on button
Browse files Browse the repository at this point in the history
`MessagingViewModel` is needed/expected by `ButtonView` and needs to be
passed as environment object to the details paeg as `NavigationLink`
  • Loading branch information
MarcoEidinger committed Mar 11, 2022
1 parent f0565f6 commit 576e929
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Sources/SAPCAI/UI/Common/SwiftUI/ListItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import Foundation
import SwiftUI

struct ListItemView: View {
@EnvironmentObject private var viewModel: MessagingViewModel

var model: ObjectMessageData

var body: some View {
NavigationLink(destination: CardPageView(card: model)
.environmentObject(ThemeManager.shared)) {
.environmentObject(ThemeManager.shared)
.environmentObject(self.viewModel)
) {
ObjectMessageView(model: model)
}
}
Expand All @@ -18,6 +22,7 @@ struct ListItemView: View {
ListItemView(model: PreviewData.objectMessage.first!)
.previewLayout(.sizeThatFits)
.environmentObject(ThemeManager.shared)
.environmentObject(testData)
}
}
#endif

0 comments on commit 576e929

Please sign in to comment.