mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-24 18:59:36 +00:00
Allow re-attaching a removed screenshot when reporting a problem
The PhotosPicker selection binding was never cleared when removing the screenshot, so the picker kept showing the item as selected and picking it again didn't change the binding, meaning onChange never fired and the image couldn't be attached again. Reset the selection on removal. Fixes #6258 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
committed by
Stefan Ceriu
parent
d82f014dfb
commit
7a45fe0120
@@ -117,7 +117,7 @@ struct BugReportScreen: View {
|
||||
.accessibilityIdentifier(A11yIdentifiers.bugReportScreen.screenshot)
|
||||
.accessibilityLabel(L10n.screenBugReportA11yScreenshot)
|
||||
.overlay(alignment: .topTrailing) {
|
||||
Button { context.send(viewAction: .removeScreenshot) } label: {
|
||||
Button(action: removeScreenshot) {
|
||||
CompoundIcon(\.close, size: .small, relativeTo: .compound.bodyMD)
|
||||
.foregroundStyle(.compound.iconSecondary)
|
||||
.background {
|
||||
@@ -152,6 +152,12 @@ struct BugReportScreen: View {
|
||||
.disabled(context.viewState.shouldDisableInteraction)
|
||||
}
|
||||
}
|
||||
|
||||
private func removeScreenshot() {
|
||||
// Otherwise the picker keeps the item checked and re-picking it doesn't trigger onChange.
|
||||
selectedScreenshot = nil
|
||||
context.send(viewAction: .removeScreenshot)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
Reference in New Issue
Block a user