mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-06 12:28:29 +00:00
Fix problem with disclosure groups randomly not disclosing by replacing with custom component
- 99% of the code is the same as we were already massively customising it
This commit is contained in:
committed by
Stefan Ceriu
parent
ec7670165c
commit
9f4479b57a
+8
-19
@@ -28,30 +28,17 @@ struct CollapsibleRoomTimelineView: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
DisclosureGroup(L10n.roomTimelineStateChanges(timelineItem.items.count), isExpanded: $isExpanded) {
|
|
||||||
Group {
|
|
||||||
ForEach(groupedViewStates) { viewState in
|
|
||||||
RoomTimelineItemView(viewState: viewState)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.disclosureGroupStyle(CollapsibleRoomTimelineItemDisclosureGroupStyle())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private struct CollapsibleRoomTimelineItemDisclosureGroupStyle: DisclosureGroupStyle {
|
|
||||||
func makeBody(configuration: Configuration) -> some View {
|
|
||||||
VStack(spacing: 0.0) {
|
VStack(spacing: 0.0) {
|
||||||
Button {
|
Button {
|
||||||
withElementAnimation {
|
withElementAnimation {
|
||||||
configuration.isExpanded.toggle()
|
isExpanded.toggle()
|
||||||
}
|
}
|
||||||
} label: {
|
} label: {
|
||||||
HStack(alignment: .center) {
|
HStack(alignment: .center) {
|
||||||
configuration.label
|
Text(L10n.roomTimelineStateChanges(timelineItem.items.count))
|
||||||
Text(Image(systemName: "chevron.forward"))
|
Text(Image(systemName: "chevron.forward"))
|
||||||
.rotationEffect(.degrees(configuration.isExpanded ? 90 : 0))
|
.rotationEffect(.degrees(isExpanded ? 90 : 0))
|
||||||
.animation(.elementDefault, value: configuration.isExpanded)
|
.animation(.elementDefault, value: isExpanded)
|
||||||
}
|
}
|
||||||
.font(.compound.bodySM)
|
.font(.compound.bodySM)
|
||||||
.foregroundColor(.compound.textSecondary)
|
.foregroundColor(.compound.textSecondary)
|
||||||
@@ -63,8 +50,10 @@ private struct CollapsibleRoomTimelineItemDisclosureGroupStyle: DisclosureGroupS
|
|||||||
.frame(maxWidth: .infinity)
|
.frame(maxWidth: .infinity)
|
||||||
.padding(.top, 8.0)
|
.padding(.top, 8.0)
|
||||||
|
|
||||||
if configuration.isExpanded {
|
if isExpanded {
|
||||||
configuration.content
|
ForEach(groupedViewStates) { viewState in
|
||||||
|
RoomTimelineItemView(viewState: viewState)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user