Skip to content

JSスレッド駆動アニメーションのネイティブ化と検索結果の仮想化などパフォーマンス改善のフォローアップ - #6423

Merged
TinyKitten merged 6 commits into
devfrom
feature/performance-followups
Jul 16, 2026
Merged

TinyKitten merged 6 commits into
devfrom
feature/performance-followups

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

概要

#6422 のプロファイリングで検出したがスコープ外として残していた改善項目のフォローアップです。JS スレッドを塞いでいたアニメーション・非仮想化リスト・直列フェッチ・ディープリンク処理の過剰なゲートを解消します。

変更の種類

  • バグ修正
  • 新機能
  • リファクタリング
  • ドキュメント
  • CI/CD
  • その他

変更内容

  • useLineSelection: 互いに独立した駅一覧と種別一覧のフェッチを Promise.all で並列化(Main.tsx の既存パターンに整合)。路線選択から方面モーダル表示までの待ち時間が RTT 1 本分短縮
  • PadArch: 乗車中常時走るシェブロンの無限ループアニメーション(opacity / translateY)を useNativeDriver: true 化し、60fps の補間を JS スレッドから排除(height 補間の fillHeight は対象外のまま)
  • 設定系 10 画面: スクロール連動ヘッダーの scrollY.setValue を JS ハンドラから Animated.event(..., { useNativeDriver: true }) へ移行。Reanimated の Animated.ScrollView では RN の AnimatedEvent がネイティブにアタッチされないことを確認したため、対象画面のスクロールコンポーネントを RN 本体の Animated.ScrollView / Animated.FlatList に統一
  • RouteSearchScreen: 件数無制限の検索結果を手動行チャンク + .map() の全件マウントから FlashList(numColumns 対応・createAnimatedComponent ラップでヘッダー連動もネイティブ駆動)へ移行。カード幅・余白は従来と同一になるよう列位置別 padding で再現。検索結果変化時の LinearTransition レイアウトアニメーションは FlashList のリサイクルと両立しないため削除
  • DeepLinkProvider: ゲート条件を「初期 URL の処理完了まで」に限定。従来は稼働中に受けたランタイムディープリンクの解決中も isLoading でツリー全体が null になり、表示中の画面が消えてナビゲーション状態が破棄されていた

調査のみ(変更なし): useAndroidWearable の毎秒のメッセージ組み立ては Wear OS 端末の接続状態ゲートで止められるが、ネイティブ側 (NodeClient.connectedNodes + リスナー) の実装と実機 Wear OS 端末での検証が必要なため今回は見送り。

テスト

  • npm run lint が通ること
  • npm test が通ること
  • npm run typecheck が通ること

フルスイート 192 スイート / 2044 テスト全パス。

関連Issue

スクリーンショット(任意)

Summary by CodeRabbit

  • 改善
    • 設定画面全体のスクロール連動アニメーションを最適化し、ヘッダー表示や追従エフェクトの動作をより滑らかにしました。
    • 検索結果一覧の表示方式を改善し、複数列レイアウトでの間隔や空状態の表示を整えました。
    • 路線選択時の駅・列車種別情報の読み込みを効率化しました。
    • ディープリンク処理中に画面がちらついたり、一時的に消えたりする問題を改善しました。

@TinyKitten TinyKitten self-assigned this Jul 15, 2026
@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

スクロール位置の更新をネイティブAnimatedイベントへ移行し、検索結果をFlashListで表示するよう変更しました。駅データ取得を並列化し、ディープリンク初期処理とパッドアーチのアニメーション設定も更新しています。

Changes

ネイティブスクロール連携

Layer / File(s) Summary
設定画面のスクロールイベント移行
src/screens/*Settings.tsx, src/screens/Licenses.tsx, src/screens/SelectLineScreen.tsx
手動のscrollY.setValue更新をRNAnimated.eventへ置き換え、RNAnimated.ScrollView/FlatListとscrollEventThrottle={16}を使用する構成に変更しました。

検索結果リスト更新

Layer / File(s) Summary
FlashList検索結果表示への移行
src/screens/RouteSearchScreen.tsx
検索結果をAnimated FlashListで表示し、セル間隔、複数列レイアウト、ヘッダー、空状態、フッター、スクロール連携をFlashListのプロパティへ移行しました。

路線選択データ取得

Layer / File(s) Summary
駅一覧と列車種別の並列取得
src/hooks/useLineSelection.ts
駅一覧と条件付き列車種別クエリをPromise.allで並列取得し、取得済み列車種別データを後続状態へ反映するよう変更しました。

ランタイムフロー調整

Layer / File(s) Summary
初期ディープリンク処理ゲート
src/providers/DeepLinkProvider.tsx
初期表示をinitialUrlProcessedの完了状態だけで制御するよう変更しました。
パッドアーチのネイティブリセット
src/components/PadArch.tsx
到着前のアニメーションリセットでuseNativeDriver: trueを指定しました。

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

  • TrainLCD/MobileApp#6412: SelectLineScreenのScrollView、RefreshControl、レイアウト変更が重なります。
  • TrainLCD/MobileApp#6416: SelectLineScreenのスクロール構成とアニメーション連携が重なります。

Poem

ぴょんと跳ねればスクロール軽やか、
駅のデータも並んで届く。
リンクを待って画面は静か、
矢印アニメも月へ跳ぶ。
うさぎはコードを祝います 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 主要な変更点であるパフォーマンス改善のフォローアップと、アニメーションのネイティブ化・検索結果の仮想化を適切に要約しています。
Description check ✅ Passed 必須テンプレートの各セクションが概ね埋まっており、変更内容とテスト結果も具体的に記載されています。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/performance-followups

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added the react label Jul 15, 2026
@TinyKitten

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/screens/RouteSearchScreen.tsx (1)

507-511: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

handleScroll の参照をメモ化してください。

現在はレンダーごとに Animated.event が再生成されます。ネイティブスクロール連携を安定させるため、useMemo などで同一参照を維持してください。FlashList v2 でも props のメモ化が重視されています。(shopify.github.io)

修正例
-  const handleScroll = RNAnimated.event(
-    [{ nativeEvent: { contentOffset: { y: scrollY } } }],
-    { useNativeDriver: true }
+  const handleScroll = useMemo(
+    () =>
+      RNAnimated.event(
+        [{ nativeEvent: { contentOffset: { y: scrollY } } }],
+        { useNativeDriver: true }
+      ),
+    [scrollY]
   );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/screens/RouteSearchScreen.tsx` around lines 507 - 511, メモ化されていない
handleScroll の Animated.event 生成を更新し、レンダー間で同一参照を維持してください。RouteSearchScreen 内の
handleScroll を useMemo など既存の React フックで包み、scrollY を依存値として適切に扱いながら
useNativeDriver: true の動作は保持してください。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/screens/RouteSearchScreen.tsx`:
- Around line 449-463: 検索結果表示時にもウォークスルー計測対象が残るよう、検索結果セルを生成する renderCard 周辺の先頭要素に
searchResultsRef と onLayout を設定してください。ListEmptyComponent に依存せず、検索成功後に存在する先頭セルなどで
measureSearchResults() が実行され、routeSearchResults のスポットライトが更新される状態を維持してください。

---

Nitpick comments:
In `@src/screens/RouteSearchScreen.tsx`:
- Around line 507-511: メモ化されていない handleScroll の Animated.event
生成を更新し、レンダー間で同一参照を維持してください。RouteSearchScreen 内の handleScroll を useMemo など既存の
React フックで包み、scrollY を依存値として適切に扱いながら useNativeDriver: true の動作は保持してください。
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6d8b50fe-9a25-4882-bb58-3a3c487c719f

📥 Commits

Reviewing files that changed from the base of the PR and between db5df14 and 1cf7548.

📒 Files selected for processing (14)
  • src/components/PadArch.tsx
  • src/hooks/useLineSelection.ts
  • src/providers/DeepLinkProvider.tsx
  • src/screens/AndroidSettings.tsx
  • src/screens/AppSettings.tsx
  • src/screens/BatterySettings.tsx
  • src/screens/EnabledLanguagesSettings.tsx
  • src/screens/ExperimentalSettings.tsx
  • src/screens/Licenses.tsx
  • src/screens/NotificationSettings.tsx
  • src/screens/RouteSearchScreen.tsx
  • src/screens/SelectLineScreen.tsx
  • src/screens/TTSSettings.tsx
  • src/screens/ThemeSettings.tsx

Comment thread src/screens/RouteSearchScreen.tsx Resolved
@TinyKitten

Copy link
Copy Markdown
Member Author

@coderabbitai autofix

@coderabbitai

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • src/screens/RouteSearchScreen.tsx

Commit: f4899bb1403a4e3972d26b9a1d389032546f7525

The changes have been pushed to the feature/performance-followups branch.

Time taken: 1m 53s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <[email protected]>
@TinyKitten
TinyKitten merged commit 5d01a40 into dev Jul 16, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the feature/performance-followups branch July 16, 2026 00:01
@TinyKitten TinyKitten mentioned this pull request Jul 16, 2026
6 of 9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant