Skip to content

fix(perps): android token scroll tap, share dialog scope, desktop chart expand(OK-52513,OK-52302,OK-52078)#11087

Merged
Minnzen merged 12 commits into
xfrom
fix/perps-share-dialog-android-scroll-chart-expand
Apr 8, 2026
Merged

fix(perps): android token scroll tap, share dialog scope, desktop chart expand(OK-52513,OK-52302,OK-52078)#11087
Minnzen merged 12 commits into
xfrom
fix/perps-share-dialog-android-scroll-chart-expand

Conversation

@Minnzen
Copy link
Copy Markdown
Contributor

@Minnzen Minnzen commented Apr 7, 2026

Summary

  • Fix Android bottom scroll tap in perps token selector
  • Fix share prompt dialog appearing outside Perps tab
  • Add desktop chart expand/fullscreen toggle via TradingView header button

Intent & Context

Three perps-related issues addressed in one PR:

  1. OK-52513: Android users couldn't tap tokens when scrolled to the bottom of the selector list — classic nested scroll touch interception on Android
  2. OK-52302: The referral share prompt dialog was appearing even when users navigated away from the Perps tab, because the focus check only tracked "has ever been focused" rather than "is currently focused"
  3. OK-52078: Desktop perps chart needs an expand/fullscreen mode that hides OrderBook, TradingPanel, and bottom panels to give the TradingView chart full screen space

Root Cause

  • OK-52513: FlashList inside a modal on Android — parent scroll view intercepted touch events at scroll boundaries
  • OK-52302: hasBeenFocusedRef was a one-time flag (set to true on first Perps visit, never reset). When tradesData updated while user was on another tab, checkAndShowPrompt() ran and showed the dialog globally via Dialog.show()

Design Decisions

  • Android scroll fix: Used nestedScrollEnabled={platformEnv.isNativeAndroid} — the established pattern across the codebase (DeFiContainer, PortfolioContainer, etc.)
  • Share dialog fix: Added isFocusedRef for real-time tab focus tracking alongside existing hasBeenFocusedRef. When not focused, sets pendingCheckRef = true so the check retries on next tab focus
  • Chart expand: Uses display: 'none' instead of conditional rendering (null) to hide panels — preserves component state (order form inputs, WebSocket connections, scroll positions) during expand/collapse. Version-gated to appVersion >= 6.2.0 on the TradingView side
  • Chart expand state: Reset chartExpanded to false on layout mount to avoid desync between persisted atom state and iframe state after app restart

Changes Detail

File Purpose
MoblieTokenSelector.tsx Add nestedScrollEnabled for Android
usePerpsSharePrompt.tsx Add isFocusedRef + pending mechanism for tab-aware dialog
perps.ts Add chartExpanded to layout state atom
messageTypes.ts Add CHART_EXPAND message constant
usePerpsTradingViewMessageHandler.ts Handle tradingview_chartExpand message from iframe
PerpDesktopLayout.web.tsx Toggle panel visibility with display:none, reset state on mount
PerpDesktopLayout.tsx Same for non-web desktop, plus contentContainerStyle for RN ScrollView

Risk Assessment

  • Risk Level: Medium
  • Affected Platforms: Desktop (chart expand), Android (scroll fix), All (share dialog fix)
  • Risk Areas: Chart expand layout toggle — uses display:none to keep components mounted; TradingView iframe ↔ app state sync relies on message passing

Related PR

  • TradingView charting library: OneKeyHQ/tradingview-charting-library — feat/chart-expand-button branch (adds ChartExpandManager with version gating)

Test plan

  • Android: Open perps token selector, scroll to bottom, verify taps register on last items
  • Desktop: Open Perps, click chart expand button, verify OrderBook/TradingPanel/bottom panels hide and chart fills space
  • Desktop: Click collapse button, verify all panels restore with preserved state (order form values, scroll positions)
  • Desktop: Expand chart, switch symbol, verify layout collapses correctly (destroy sends collapse message)
  • All platforms: Meet share prompt conditions (3+ trades, $100k+ volume), navigate away from Perps tab, verify dialog does NOT appear on other tabs
  • All platforms: Return to Perps tab after above, verify share dialog appears correctly

Open with Devin

…rt expand(OK-52513,OK-52302,OK-52078)

- Fix Android bottom scroll tap in token selector by enabling nestedScrollEnabled
- Fix share prompt dialog appearing outside Perps tab by tracking real-time focus state
- Add desktop chart expand/fullscreen toggle via TradingView header button with version gating (>=6.2.0)
- Use display:none instead of unmounting panels to preserve state during expand/collapse
@revan-zhang
Copy link
Copy Markdown
Contributor

revan-zhang commented Apr 7, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@Minnzen Minnzen enabled auto-merge (squash) April 7, 2026 13:47
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 5 additional findings.

Open in Devin Review

devin-ai-integration[bot]

This comment was marked as resolved.

originalix
originalix previously approved these changes Apr 7, 2026
Comment thread packages/kit/src/views/Perp/hooks/usePerpsSharePrompt.tsx Outdated
Comment thread packages/kit/src/views/Perp/hooks/usePerpsSharePrompt.tsx
@Minnzen Minnzen requested a review from originalix April 7, 2026 14:40
originalix
originalix previously approved these changes Apr 7, 2026
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Apr 8, 2026

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

@Minnzen Minnzen requested a review from originalix April 8, 2026 02:40
@Minnzen Minnzen merged commit 0cfddc2 into x Apr 8, 2026
12 checks passed
@Minnzen Minnzen deleted the fix/perps-share-dialog-android-scroll-chart-expand branch April 8, 2026 03:02
PatrickChoo pushed a commit to PatrickChoo/app-monorepo that referenced this pull request Apr 8, 2026
…rt expand(OK-52513,OK-52302,OK-52078) (OneKeyHQ#11087)

* fix(perps): android token scroll tap, share dialog scope, desktop chart expand(OK-52513,OK-52302,OK-52078)

- Fix Android bottom scroll tap in token selector by enabling nestedScrollEnabled
- Fix share prompt dialog appearing outside Perps tab by tracking real-time focus state
- Add desktop chart expand/fullscreen toggle via TradingView header button with version gating (>=6.2.0)
- Use display:none instead of unmounting panels to preserve state during expand/collapse

* fix: prettier format for import statement

* fix: use functional updater for chartExpanded reset and fix spellcheck

* fix: exclude modal-covered state from share prompt focus check

* fix: re-check focus after async gap in share prompt

* fix: align @stoprocent/noble version to 2.3.10 across desktop packages

* fix: update yarn.lock for @stoprocent/noble version alignment

---------

Co-authored-by: morizon <sidmorizon@outlook.com>
Co-authored-by: huhuanming <huanming@onekey.so>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants