Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

auto scroll the container when selecting editors on the send page #676

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading