-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: prevent Android ramps modal double press navigation issue #21394
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
base: main
Are you sure you want to change the base?
Conversation
Fixes #21350 This commit fixes an Android-specific issue where selecting a token, payment method, or region in ramps flows (deposit, buy, withdraw) would incorrectly navigate to the home screen instead of returning to the previous screen. Root Cause: - Race condition between BottomSheet's automatic navigation (shouldNavigateBack={true}) and manual navigation.goBack() calls - Both navigation actions fired simultaneously on Android - Navigation stack became confused and navigated to wrong screen Solution: - Set shouldNavigateBack={false} on all ramps BottomSheet components - Use BottomSheet's callback pattern: onCloseBottomSheet(() => navigation.goBack()) - This ensures navigation happens AFTER sheet closes, not during Changes: - Added useNavigation import to all affected modal components - Updated all selector modal callbacks to use navigation.goBack() in callback - Applied fix to deposit and aggregator (buy/sell) flows Files Modified: - TokenSelectorModal (Deposit) - PaymentMethodSelectorModal (Deposit) - RegionSelectorModal (Deposit) - StateSelectorModal (Deposit) - TokenSelectModal (Aggregator) - RegionSelectorModal (Aggregator) - PaymentMethodSelectorModal (Aggregator) - FiatSelectorModal (Aggregator) Testing: - No unit test changes required (navigation already mocked) - Manual testing required on Android devices - iOS behavior unchanged
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. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #21394 +/- ##
==========================================
- Coverage 77.12% 77.11% -0.01%
==========================================
Files 3615 3615
Lines 89144 89168 +24
Branches 16861 16861
==========================================
+ Hits 68748 68758 +10
- Misses 15719 15732 +13
- Partials 4677 4678 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Description
This PR fixes an Android-specific issue where selecting a token, payment method, or region in ramps flows (deposit, buy, withdraw) would incorrectly navigate to the home screen instead of returning to the previous screen.
Problem:
On Android devices, when users selected an item in any ramps modal selector (token, payment method, region, state, fiat), the app would navigate to the home screen instead of returning to the BuildQuote screen. This was a critical regression affecting the entire ramps user experience on Android.
Root Cause:
A race condition occurred between:
navigation.goBack()
call (viashouldNavigateBack={true}
)Both navigation actions fired simultaneously on Android, causing the navigation stack to become confused and navigate to the wrong screen.
Solution:
shouldNavigateBack={false}
on all ramps BottomSheet componentsonCloseBottomSheet(() => navigation.goBack())
This follows the intended BottomSheet usage pattern and eliminates the race condition.
Files Modified:
TokenSelectorModal.tsx
(Deposit)PaymentMethodSelectorModal.tsx
(Deposit)RegionSelectorModal.tsx
(Deposit)StateSelectorModal.tsx
(Deposit)TokenSelectModal.tsx
(Aggregator - Buy/Sell)RegionSelectorModal.tsx
(Aggregator - Buy/Sell)PaymentMethodSelectorModal.tsx
(Aggregator - Buy/Sell)FiatSelectorModal.tsx
(Aggregator - Buy/Sell)Changelog
CHANGELOG entry: Fixed Android issue where ramps modal selection navigated to home screen
Related issues
Fixes: #21350
Manual testing steps
Screenshots/Recordings
Before
Issue as reported in #21350 - selecting token navigates to home screen on Android
After
Expected behavior: selecting token closes modal and returns to BuildQuote screen
Pre-merge author checklist
Pre-merge reviewer checklist
Technical Details
Why This Fix Works
The BottomSheet component has a built-in callback system specifically designed for this use case:
The callback ensures:
navigation.goBack()
Testing Impact
renderScreen
)