Skip to content

Commit d93f34f

Browse files
committed
Autoselect payee field when focused
1 parent 064fd0f commit d93f34f

File tree

4 files changed

+15
-1
lines changed

4 files changed

+15
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
## Unreleased
44

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

1314
## 4.19.0

src/components/modals/ContactListModal.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ export function ContactListModal({ bridge, contactType, contactName }: Props) {
8181
rowComponent={rowComponent}
8282
rowDataFilter={rowDataFilter}
8383
autoFocus
84+
autoSelect
8485
/>
8586
)
8687
}

src/components/modals/ListModal.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ interface Props<T> {
3131
onSubmitEditing?: (text: string) => void
3232
secureTextEntry?: boolean // Defaults to 'false'
3333
autoFocus?: boolean // Defaults to 'false'
34+
autoSelect?: boolean // Defaults to 'false'
3435
// List Props
3536
rowsData?: T[] // Defaults to []
3637
fullScreen?: boolean
@@ -47,6 +48,7 @@ export function ListModal<T>({
4748
initialValue = '',
4849
rowsData = [],
4950
fullScreen = true,
51+
autoSelect = false,
5052
rowComponent,
5153
rowDataFilter,
5254
onSubmitEditing,
@@ -80,6 +82,7 @@ export function ListModal<T>({
8082
blurOnClear={false}
8183
autoCorrect={false}
8284
autoCapitalize="words"
85+
autoSelect={autoSelect}
8386
returnKeyType="done"
8487
testID={title}
8588
onChangeText={handleChangeText}

src/components/themed/FilledTextInput.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@ export interface FilledTextInputBaseProps extends MarginRemProps {
8181
* 'autoFocus' and 'regular' text inputs don't. */
8282
autoFocus?: boolean // Defaults to 'true'
8383

84+
/**
85+
* autoSelect: If true, the text input will be selected when focused.
86+
*/
87+
autoSelect?: boolean
88+
8489
/** Unless 'blurOnClear' is passed explicitly in the props, Search Bars calls
8590
* 'blur' when cleared and text inputs don't call 'blur' when cleared.
8691
* Defaults to 'false' */
@@ -158,6 +163,7 @@ export const FilledTextInput = React.forwardRef<FilledTextInputRef, FilledTextIn
158163
autoComplete,
159164
autoCorrect,
160165
autoFocus = false,
166+
autoSelect = false,
161167
blurOnClear = false,
162168
blurOnSubmit,
163169
disabled = false,
@@ -232,6 +238,9 @@ export const FilledTextInput = React.forwardRef<FilledTextInputRef, FilledTextIn
232238
})
233239
const handleFocus = useHandler(() => {
234240
focusAnimation.value = withTiming(1, { duration: baseDuration })
241+
if (autoSelect) {
242+
setNativeProps({ selection: { start: 0, end: value.length } })
243+
}
235244
if (onFocus != null) onFocus()
236245
})
237246
const handleSubmitEditing = useHandler(() => {

0 commit comments

Comments
 (0)