From c06d5f4af7e7c49fa138cb9ab5e9d786bfc67bc0 Mon Sep 17 00:00:00 2001 From: dreacot Date: Thu, 26 Sep 2024 19:44:25 +0100 Subject: [PATCH] auto scroll the container when selecting an editor on the send page --- ui/page/send/page.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ui/page/send/page.go b/ui/page/send/page.go index b9baccc80..46b1f8836 100644 --- a/ui/page/send/page.go +++ b/ui/page/send/page.go @@ -296,6 +296,12 @@ func (pg *Page) OnNavigatedTo() { // go load.GetAPIFeeRate(pg.selectedWallet) go pg.feeRateSelector.UpdatedFeeRate(pg.selectedWallet) } + + for _, re := range pg.recipients { // focus on destination address editor + re.sendDestination.destinationAddressEditor.SetFocus() + pg.pageContainer.List.ScrollTo(1) // scroll to the first item in the list + break + } } // OnDarkModeChanged is triggered whenever the dark mode setting is changed @@ -652,8 +658,24 @@ func (pg *Page) HandleUserInteractions(gtx C) { } // handle recipient user interactions + // TODO: Automatically calculate ScrollTo position for _, re := range pg.recipients { re.HandleUserInteractions(gtx) + if re.sendDestination.destinationAddressEditor.Pressed(gtx) { + pg.pageContainer.List.ScrollTo(1) + } + if re.amount.amountEditor.Pressed(gtx) { + pg.pageContainer.List.ScrollTo(1) + } + if re.amount.usdAmountEditor.Pressed(gtx) { + pg.pageContainer.List.ScrollTo(1) + if pg.IsMobileView() { + pg.pageContainer.List.ScrollTo(3) + } + } + if re.description.Pressed(gtx) { + pg.pageContainer.List.ScrollTo(3) + } } }