@@ -36,10 +36,16 @@ public struct DefaultChatChannelHeader: ToolbarContent {
36
36
37
37
public var channel : ChatChannel
38
38
public var headerImage : UIImage
39
+ @Binding public var isActive : Bool
39
40
40
- public init ( channel: ChatChannel , headerImage: UIImage ) {
41
+ public init (
42
+ channel: ChatChannel ,
43
+ headerImage: UIImage ,
44
+ isActive: Binding < Bool >
45
+ ) {
41
46
self . channel = channel
42
47
self . headerImage = headerImage
48
+ _isActive = isActive
43
49
}
44
50
45
51
public var body : some ToolbarContent {
@@ -54,14 +60,23 @@ public struct DefaultChatChannelHeader: ToolbarContent {
54
60
55
61
ToolbarItem ( placement: . navigationBarTrailing) {
56
62
ZStack {
57
- NavigationLink ( destination: LazyView ( ChatChannelInfoView ( channel: channel, shownFromMessageList: true ) ) ) {
63
+ Button {
64
+ resignFirstResponder ( )
65
+ isActive = true
66
+ } label: {
58
67
Rectangle ( )
59
68
. fill ( Color ( colors. background) )
60
69
. contentShape ( Rectangle ( ) )
61
70
. frame ( width: 36 , height: 36 )
62
71
. clipShape ( Circle ( ) )
63
72
. offset ( x: 8 )
64
73
}
74
+
75
+ NavigationLink ( isActive: $isActive) {
76
+ LazyView ( ChatChannelInfoView ( channel: channel, shownFromMessageList: true ) )
77
+ } label: {
78
+ EmptyView ( )
79
+ }
65
80
66
81
ChannelAvatarView (
67
82
avatar: headerImage,
@@ -79,14 +94,16 @@ public struct DefaultChatChannelHeader: ToolbarContent {
79
94
/// The default header modifier.
80
95
public struct DefaultChannelHeaderModifier : ChatChannelHeaderViewModifier {
81
96
@StateObject private var channelHeaderLoader = ChannelHeaderLoader ( )
97
+ @State private var isActive : Bool = false
82
98
83
99
public var channel : ChatChannel
84
100
85
101
public func body( content: Content ) -> some View {
86
102
content. toolbar {
87
103
DefaultChatChannelHeader (
88
104
channel: channel,
89
- headerImage: channelHeaderLoader. image ( for: channel)
105
+ headerImage: channelHeaderLoader. image ( for: channel) ,
106
+ isActive: $isActive
90
107
)
91
108
}
92
109
}
0 commit comments