Skip to content

Commit

Permalink
Only access the reused view when the view is presented (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis authored Jan 17, 2024
1 parent 28036f7 commit 9a414a2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ public struct VideoCallParticipantView: View {
var customData: [String: RawJSON]
var call: Call?

@State private var isVisible = false

public init(
participant: CallParticipant,
id: String? = nil,
Expand All @@ -350,7 +352,7 @@ public struct VideoCallParticipantView: View {
id: id,
size: availableFrame.size,
contentMode: contentMode,
showVideo: showVideo,
showVideo: showVideo && isVisible,
handleRendering: { [weak call] view in
guard call != nil else { return }
view.handleViewRendering(for: participant) { size, participant in
Expand All @@ -360,6 +362,8 @@ public struct VideoCallParticipantView: View {
}
}
)
.onAppear { isVisible = true }
.onDisappear { isVisible = false }
.opacity(showVideo ? 1 : 0)
.edgesIgnoringSafeArea(edgesIgnoringSafeArea)
.accessibility(identifier: "callParticipantView")
Expand Down

0 comments on commit 9a414a2

Please sign in to comment.