Skip to content

Commit

Permalink
auto scroll the container when selecting an editor on the send page
Browse files Browse the repository at this point in the history
  • Loading branch information
dreacot committed Sep 30, 2024
1 parent 8f9e5f5 commit c06d5f4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ui/page/send/page.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
}
}

Expand Down

0 comments on commit c06d5f4

Please sign in to comment.