Skip to content

Commit

Permalink
Autoselect payee field when focused
Browse files Browse the repository at this point in the history
  • Loading branch information
paullinator committed Dec 16, 2024
1 parent 064fd0f commit d93f34f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

## Unreleased

- added: New Kado OTC provider integration.
- changed: `WalletListScene` filter mode remains active on empty text
- changed: (iOS) `SimpleTextInput` back chevron replaced with "Cancel" button
- added: New Kado OTC provider integration.
- changed: Improved EdgeCrashEvent reporting with additional metadata, tags, and name/message information.
- changed: Integrate `installSurvey` endpoint for post-install survey options
- changed: StakeKit staking plugin to check validator status before getting quote
- changed: Auto select text in tx details payee field when focused
- fixed: Only send successful import items to completion scene

## 4.19.0
Expand Down
1 change: 1 addition & 0 deletions src/components/modals/ContactListModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export function ContactListModal({ bridge, contactType, contactName }: Props) {
rowComponent={rowComponent}
rowDataFilter={rowDataFilter}
autoFocus
autoSelect
/>
)
}
Expand Down
3 changes: 3 additions & 0 deletions src/components/modals/ListModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ interface Props<T> {
onSubmitEditing?: (text: string) => void
secureTextEntry?: boolean // Defaults to 'false'
autoFocus?: boolean // Defaults to 'false'
autoSelect?: boolean // Defaults to 'false'
// List Props
rowsData?: T[] // Defaults to []
fullScreen?: boolean
Expand All @@ -47,6 +48,7 @@ export function ListModal<T>({
initialValue = '',
rowsData = [],
fullScreen = true,
autoSelect = false,
rowComponent,
rowDataFilter,
onSubmitEditing,
Expand Down Expand Up @@ -80,6 +82,7 @@ export function ListModal<T>({
blurOnClear={false}
autoCorrect={false}
autoCapitalize="words"
autoSelect={autoSelect}
returnKeyType="done"
testID={title}
onChangeText={handleChangeText}
Expand Down
9 changes: 9 additions & 0 deletions src/components/themed/FilledTextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ export interface FilledTextInputBaseProps extends MarginRemProps {
* 'autoFocus' and 'regular' text inputs don't. */
autoFocus?: boolean // Defaults to 'true'

/**
* autoSelect: If true, the text input will be selected when focused.
*/
autoSelect?: boolean

/** Unless 'blurOnClear' is passed explicitly in the props, Search Bars calls
* 'blur' when cleared and text inputs don't call 'blur' when cleared.
* Defaults to 'false' */
Expand Down Expand Up @@ -158,6 +163,7 @@ export const FilledTextInput = React.forwardRef<FilledTextInputRef, FilledTextIn
autoComplete,
autoCorrect,
autoFocus = false,
autoSelect = false,
blurOnClear = false,
blurOnSubmit,
disabled = false,
Expand Down Expand Up @@ -232,6 +238,9 @@ export const FilledTextInput = React.forwardRef<FilledTextInputRef, FilledTextIn
})
const handleFocus = useHandler(() => {
focusAnimation.value = withTiming(1, { duration: baseDuration })
if (autoSelect) {
setNativeProps({ selection: { start: 0, end: value.length } })
}
if (onFocus != null) onFocus()
})
const handleSubmitEditing = useHandler(() => {
Expand Down

0 comments on commit d93f34f

Please sign in to comment.