-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
chore(runway): cherry-pick fix(card): cp-7.60.0 fix OTP inputs frozen screens #22902
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
chore(runway): cherry-pick fix(card): cp-7.60.0 fix OTP inputs frozen screens #22902
Conversation
… screens (#22894) <!-- 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? --> Fixed critical OTP input freezing issues affecting three Card onboarding/authentication screens where users were unable to navigate, proceed, or sometimes even focus the 6-digit OTP input field. **Problem:** Users experienced UI freezing on OTP verification screens, preventing them from: - Focusing the OTP input field - Navigating back to previous screens - Proceeding after entering the verification code **Root Cause:** The implementations were missing the `useBlurOnFulfill` hook from `react-native-confirmation-code-field`, which is critical for proper input lifecycle management. Without this hook: - The input field remained focused after all digits were entered - The keyboard wasn't properly dismissed - Focus conflicts caused the UI to freeze - Navigation became blocked **Solution:** - Added `useBlurOnFulfill` hook to properly manage OTP input focus and blur events - Updated ref handling to use the hook's return value instead of manual useRef - Fixed hook dependency arrays to prevent stale closure issues - Fixed a cooldown timing bug in ConfirmPhoneNumber (was setting cooldown before API success) - Updated all test mocks to include the new hook The implementation now matches the working pattern used in the Ramp/Deposit OTP screen (OtpCode.tsx), which doesn't experience these issues. ## **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: Fixed OTP input freezing issues on Card email and phone verification screens ## **Related issues** Fixes: ## **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** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **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] > Integrates useBlurOnFulfill for OTP fields, adds platform-specific autocomplete, refactors focus/refs, and fixes resend cooldown timing; updates tests and mocks accordingly. > > - **Card OTP flows** > - Use `useBlurOnFulfill` for `CodeField` in `CardAuthentication`, `ConfirmEmail`, and `ConfirmPhoneNumber` to manage focus/blur and prevent freezes. > - Replace manual `useRef` with hook-provided refs; update focus effects and dependency arrays. > - Add platform-specific `autoComplete` (`android: 'sms-otp'`, default: `'one-time-code'`) and type `TextInputProps`. > - Cast `CodeField` refs to `React.RefObject<TextInput>`. > - **Resend/cooldown behavior** > - In `ConfirmPhoneNumber`, set cooldown after successful resend; maintain guard against rapid presses with `resendInProgressRef`. > - In `CardAuthentication`/`ConfirmEmail`, ensure countdown timers and resend handlers respect cooldown state. > - **Tests** > - Update `react-native-confirmation-code-field` mocks to include `useBlurOnFulfill` in related test files. > - Minor adjustments (e.g., variable rename for `contactVerificationId`) to align with implementation. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 158a841. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsThe changes affect Card authentication and onboarding flows in MetaMask Mobile. All 6 changed files are related to the Card feature:
Analysis:
Without git diffs available, I cannot determine the exact nature of changes, but these files contain:
The test files are comprehensive with 1300+ lines each, indicating these are well-tested components. Risk Assessment: Medium
Tag Selection:
|
|
|
No release label on PR. Adding release label release-7.60.0 on PR, as PR was cherry-picked in branch 7.60.0. |


Description
Fixed critical OTP input freezing issues affecting three Card
onboarding/authentication screens where users were unable to navigate,
proceed, or sometimes even focus the 6-digit OTP input field.
Problem:
Users experienced UI freezing on OTP verification screens, preventing
them from:
Root Cause:
The implementations were missing the
useBlurOnFulfillhook fromreact-native-confirmation-code-field, which is critical for properinput lifecycle management. Without this hook:
Solution:
useBlurOnFulfillhook to properly manage OTP input focus andblur events
useRef
cooldown before API success)
The implementation now matches the working pattern used in the
Ramp/Deposit OTP screen (OtpCode.tsx), which doesn't experience these
issues.
Changelog
CHANGELOG entry: Fixed OTP input freezing issues on Card email and phone
verification screens
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Docs and MetaMask Mobile
Coding
Standards.
if applicable
guidelines).
Not required for external contributors.
Pre-merge reviewer checklist
app, test code being changed).
in the ticket it closes and includes the necessary testing evidence such
as recordings and or screenshots.
Note
Integrates useBlurOnFulfill and platform-specific autoComplete for OTP fields, fixes resend cooldown timing, and updates tests/mocks accordingly.
CardAuthentication,ConfirmEmail,ConfirmPhoneNumber):useBlurOnFulfillfor proper focus/blur handling and use its ref forCodeField.useRefusage.autoComplete(android: sms-otp, default:one-time-code).useClearByFocusCell.ConfirmPhoneNumber: start cooldown only after successful resend.ConfirmEmail: store returnedcontactVerificationIdfrom resend.react-native-confirmation-code-fieldto includeuseBlurOnFulfilland align with ref changes.Written by Cursor Bugbot for commit 9b259a1. This will update automatically on new commits. Configure here.
9f9609f