Skip to content

Commit 3602c24

Browse files
authored
fix: Prevent recipient input to show multiline for selected address (MetaMask#22392)
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR aims to fix recipient input to show multiline for selected address in send flow ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Fix recipient to be shown multi-line in send flow ## **Related issues** Fixes: MetaMask#22207 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <img width="568" height="1084" alt="Screenshot 2025-11-10 at 12 03 50" src="https://github.com/user-attachments/assets/f8f0da96-2505-4c76-b77c-f904fcab3d6d" /> ### **After** <img width="568" height="1084" alt="Screenshot 2025-11-10 at 12 03 43" src="https://github.com/user-attachments/assets/56c76b7c-a0c9-4640-9f02-bc3b446eed68" /> ## **Pre-merge author checklist** - [X] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Replaces direct TextField props with a custom Input element to force single-line recipient addresses and prevent multiline behavior. > > - **Confirmations › RecipientInput (`app/components/Views/confirmations/components/recipient-input/recipient-input.tsx`)** > - Use `TextField` `inputElement` with `foundation/Input` to control behavior. > - Configure single-line input: `multiline={false}`, `numberOfLines={1}`, `scrollEnabled={false}`, `textAlignVertical="center"`, `textBreakStrategy="simple"`. > - Move input props (value, change handlers, autocorrect/spellcheck/autocomplete/capitalize, placeholder, autofocus, testID) onto `Input`. > - Apply `INPUT_STYLE_OVERRIDE` to remove height/lineHeight and pad adjustments; disable state styles; set `textVariant` via `TOKEN_TEXTFIELD_INPUT_TEXT_VARIANT`. > - Keep start/end accessories (To label, Clear/Paste buttons) unchanged. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e06f20c. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 1e8f4c5 commit 3602c24

1 file changed

Lines changed: 30 additions & 10 deletions

File tree

app/components/Views/confirmations/components/recipient-input/recipient-input.tsx

Lines changed: 30 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,18 @@ import {
1111

1212
import { strings } from '../../../../../../locales/i18n';
1313
import TextField from '../../../../../component-library/components/Form/TextField';
14+
import Input from '../../../../../component-library/components/Form/TextField/foundation/Input';
1415
import { TextFieldSize } from '../../../../../component-library/components/Form/TextField/TextField.types';
16+
import { TOKEN_TEXTFIELD_INPUT_TEXT_VARIANT } from '../../../../../component-library/components/Form/TextField/TextField.constants';
1517
import ClipboardManager from '../../../../../core/ClipboardManager';
1618
import { useSendContext } from '../../context/send-context/send-context';
1719

20+
const INPUT_STYLE_OVERRIDE = {
21+
height: undefined,
22+
lineHeight: undefined,
23+
paddingVertical: 0,
24+
};
25+
1826
export const RecipientInput = ({
1927
isRecipientSelectedFromList,
2028
resetStateOnInput,
@@ -97,19 +105,31 @@ export const RecipientInput = ({
97105
return (
98106
<Box twClassName="w-full px-4 py-2">
99107
<TextField
100-
autoCorrect={false}
101-
ref={inputRef}
102-
value={to}
103-
onChangeText={handleTextChange}
104-
spellCheck={false}
105-
autoComplete="off"
106-
autoCapitalize="none"
107-
placeholder={strings('send.enter_address_to_send_to')}
108108
size={TextFieldSize.Lg}
109109
endAccessory={renderEndAccessory}
110110
startAccessory={defaultStartAccessory}
111-
autoFocus={false}
112-
testID="recipient-address-input"
111+
inputElement={
112+
<Input
113+
textVariant={TOKEN_TEXTFIELD_INPUT_TEXT_VARIANT}
114+
ref={inputRef}
115+
value={to}
116+
onChangeText={handleTextChange}
117+
autoCorrect={false}
118+
multiline={false}
119+
numberOfLines={1}
120+
scrollEnabled={false}
121+
textAlignVertical="center"
122+
textBreakStrategy="simple"
123+
spellCheck={false}
124+
autoComplete="off"
125+
autoCapitalize="none"
126+
placeholder={strings('send.enter_address_to_send_to')}
127+
autoFocus={false}
128+
testID="recipient-address-input"
129+
isStateStylesDisabled
130+
style={INPUT_STYLE_OVERRIDE}
131+
/>
132+
}
113133
/>
114134
</Box>
115135
);

0 commit comments

Comments
 (0)