Skip to content

横画面でのモーダル表示改善・BlurView適用 - #5677

Merged
TinyKitten merged 4 commits into
devfrom
feature/landscape-modal-improvements
Mar 26, 2026
Merged

TinyKitten merged 4 commits into
devfrom
feature/landscape-modal-improvements

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Mar 26, 2026 •

Copy link
Copy Markdown
Member

Summary

  • 横画面(ランドスケープ)でモーダルが見切れる問題を修正
  • モーダルのヘッダー・フッターにBlurView(ガラスエフェクト)を適用
  • リスト系モーダルのminHeightをコンテンツ件数に応じた動的計算に変更
  • テーマ確認モーダルをコンポーネントとして切り出し

Changes

  • CustomModal: overflow: hidden を追加
  • SelectBoundModal: ScrollView 化、ヘッダーをabsolute配置+BlurView、閉じるボタンをstickyフッター化
  • RouteInfoModal / TrainTypeListModal / StationSearchModal: ヘッダー・フッターにBlurView適用、minHeightを動的計算に変更、FlatListにscrollIndicatorInsets追加
  • ヘッダーテキスト色: ブラー背景で視認性向上のため#333→#111
  • 列車種別: 1件のみの場合は選択UIを無効化(選ぶ必要がないため)
  • ThemeConfirmModal: ThemeSettings.tsxからモーダルを新コンポーネントに切り出し、ScrollViewで横画面対応

Test plan

  • 横画面でSelectBoundModalが全項目スクロール可能であること
  • 横画面でRouteInfoModal, TrainTypeListModal, StationSearchModalが見切れないこと
  • 各モーダルのヘッダー・フッターにBlurViewが適用されていること(iOS)
  • Androidで半透明背景が適用されていること
  • LEDテーマで従来通りの不透明背景であること
  • 縦画面でモーダルの表示が崩れていないこと
  • 列車種別が1件の路線で列車種別ボタンがdisabledであること
  • テーマ設定画面の確認モーダルが横画面でスクロール可能であること

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 新機能

    • テーマ確認モーダルを追加
  • 改善

    • モーダルのヘッダー/フッターにプラットフォーム・テーマ対応のブラー/半透明背景を導入
    • モーダルの最小高さを画面サイズと項目数に応じて動的に算出(レスポンシブ強化)
    • モーダル内コンテンツのオーバーフロー制御を強化(はみ出し抑制)
    • スクロールインジケーターと固定ヘッダー/フッター、固定ボタン配置を最適化
    • 列車種別選択の有効化条件を「選択肢が1件以下で無効化」に調整
    • LEDテーマ時は角丸を無効化する表示を導入

@github-actions github-actions Bot added the react label Mar 26, 2026
@coderabbitai

coderabbitai Bot commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ecd86253-8231-4c11-9b41-d1d95edb4826

📥 Commits

Reviewing files that changed from the base of the PR and between e400a4a and d536eba.

📒 Files selected for processing (1)
  • src/components/SelectBoundModal.tsx

📝 Walkthrough

Walkthrough

複数モーダルでヘッダー/フッターにプラットフォーム・テーマ条件のBlur/オーバーレイを追加し、固定minHeightを項目数と画面高さから算出する動的高さへ置換、FlatList/ScrollViewのレイアウトとスクロールインセットを調整。新規のThemeConfirmModalを追加し、ThemeSettingsでこれを利用するよう差し替え。CustomModalにoverflow追加。trainType無効判定を調整。

Changes

Cohort / File(s) Summary
CustomModal 小変更
src/components/CustomModal.tsx
styles.contentにoverflow: 'hidden'を追加(子要素のはみ出しを制限)。
ヘッダー/クローズ領域のBlur/オーバーレイ
src/components/RouteInfoModal.tsx, src/components/SelectBoundModal.tsx, src/components/StationSearchModal.tsx, src/components/TrainTypeListModal.tsx
非-LEDテーマ時にiOSはBlurView、Androidは半透明白Viewをヘッダーおよびクローズ領域へ追加。LEDテーマ時はオーバーレイを描画しない。ヘッダーテキスト色を非LEDで上書き。
動的高さ & FlatList/ScrollView調整
src/components/RouteInfoModal.tsx, src/components/SelectBoundModal.tsx, src/components/StationSearchModal.tsx, src/components/TrainTypeListModal.tsx
固定minHeight: 512を廃止し、項目数と定数から算出するdynamicMinHeightを適用。FlatList/ScrollViewを絶対配置/コンテナパディングに変更し、各モーダルでscrollIndicatorInsetsを追加。
SelectBoundModal レイアウト再構成
src/components/SelectBoundModal.tsx
中央寄せレイアウトから、absoluteヘッダー+スクロールコンテンツ+固定ボトムのクローズ領域へ再構成。スクロール用paddingとindicator insetsを導入し、インスクロールのCloseを削除して固定ボタンへ置換。
trainType 選択ロジック調整
src/components/Permitted.tsx, src/components/SelectBoundModal.tsx, src/components/SelectBoundSettingListModal.tsx
trainTypeDisabled判定を!fetchedTrainTypes.lengthからfetchedTrainTypes.length <= 1へ変更。settingsAndTrainTypeをfetchedTrainTypes.length > 1で使用。
borderRadius 条件化
src/components/SelectBoundSettingListModal.tsx
ベーススタイルから固定borderRadius: 8を除去し、描画時にisLEDTheme ? 0 : 8(タブレットは既存の16継続)を適用。
TrainTypeListModal 調整
src/components/TrainTypeListModal.tsx
ヘッダー/クローズ領域のBlur導入、minHeightを動的計算に変更、ヘッダーテキスト色適用、scrollIndicatorInsets追加。
StationSearch / RouteInfo の調整
src/components/StationSearchModal.tsx, src/components/RouteInfoModal.tsx
ヘッダー/クローズのBlur実装、非LED時の背景をundefinedに変更、ヘッダーテキスト色追加、content minHeightを動的化、FlatListのスタイルとスクロールインセットを更新。
新規: ThemeConfirmModal
src/components/ThemeConfirmModal.tsx
スクロール可能な確認モーダルを追加。カラースワッチ(LinearGradient)、テーマタイトル・説明、プレビュー画像、Cancel/Applyボタンを含む新規エクスポートコンポーネント。
ThemeSettings での差し替え
src/screens/ThemeSettings.tsx
従来のスクリーン内モーダル/プレビューをThemeConfirmModalへ置換。関連のローカル計算とインポートを削減し、表示制御(isThemeModalVisible / onCloseAnimationEnd)を導入。

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

🐰✨ ふわりとBlurで縁をつつみ、モーダルは窓に合わせて伸びるよ
角はLEDならしゅっと、そうでなければまあるく寄り添う
リストはすべり、インジケータは居場所を知る
新しいConfirmはぴょんと出て、決定をそっと待つよ 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PRタイトルは、横画面でのモーダル表示改善とBlurView適用という主要な変更を的確に反映しており、実装内容と一致している。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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/landscape-modal-improvements

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

@TinyKitten
TinyKitten force-pushed the feature/landscape-modal-improvements branch from a76f348 to fc1f2fe Compare March 26, 2026 09:10
@TinyKitten TinyKitten self-assigned this Mar 26, 2026

@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: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/Permitted.tsx`:
- Line 34: The import of useTrainTypeModal in Permitted.tsx fails because that
hook does not exist; either implement a new hook named useTrainTypeModal under
src/hooks that exports the expected API used by Permitted (create and export the
hook function with the same name), or change the import in Permitted.tsx to the
correct existing hook name/path that provides the same behavior used in the
component; search for existing hooks (e.g., any useTrain* or useModal hooks) and
update the import statement to reference that symbol instead of
useTrainTypeModal.

In `@src/components/RouteInfoModal.tsx`:
- Around line 266-271: The dynamicMinHeight calculation treats
deduppedStations.length === 0 as zero content height so the ListEmptyComponent
skeleton gets hidden; update the logic in the dynamicMinHeight useMemo (which
references deduppedStations.length and windowHeight) to reserve a minimum
body/item area when count is 0 (for example, treat count as Math.max(1,
deduppedStations.length) or add a minBodyHeight constant added to header/footer)
so the empty-state skeleton has visible space while still capping by
windowHeight * 0.9.

In `@src/components/StationSearchModal.tsx`:
- Around line 264-269: The calculated dynamicMinHeight in the useMemo (variable
dynamicMinHeight) yields zero body height when stations.length === 0; update the
calculation to ensure at least one row's worth of content by using
Math.max(count, 1) (or equivalent) when computing the body portion so content =
150 + Math.max(count, 1) * 80 + Math.max(0, count - 1) * 8 + 72, keeping the
Math.min(..., windowHeight * 0.9) cap and preserving dependencies
[stations?.length, windowHeight].

In `@src/components/TrainTypeListModal.tsx`:
- Around line 294-300: When calculating dynamicMinHeight in the useMemo, ensure
the "body" area isn't zero for trainTypes.length === 0 by introducing a minimum
body height for empty/loading states (e.g., minEmptyBodyHeight) and use it when
computing content; update the content calculation in dynamicMinHeight
(referencing trainTypes.length, content, maxHeight, windowHeight) to use body =
trainTypes.length > 0 ? trainTypes.length * 80 + Math.max(0, trainTypes.length -
1) * 8 : minEmptyBodyHeight, then return Math.min(72 + body + 72, maxHeight) so
the empty/loading UI is visible.

In `@src/screens/ThemeSettings.tsx`:
- Around line 247-253: 現在、visible と表示データ(themeId/themeTitle)を同じ pendingTheme
にしているため、handleCloseModal 等で pendingTheme を null
にすると閉じアニメ中に表示データが空になります。修正案:ThemeConfirmModal に onCloseAnimationEnd
コールバックを追加して(または既存のものを透過して)モーダルが閉じアニメ完了するまで親で pendingTheme をクリアしないようにし、visible
の切り替えは別のフラグ(または ThemeConfirmModal 内の isClosing 状態)で制御する。該当箇所:ThemeConfirmModal
コンポーネント呼び出し、pendingTheme 状態更新ロジック(handleCloseModal/handleConfirmThemeChange)と
onCloseAnimationEnd の透過実装を修正してください。
🪄 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: b2bb4eaa-dfd0-4b28-b4e7-26dbeb41b38c

📥 Commits

Reviewing files that changed from the base of the PR and between 30e2727 and a76f348.

📒 Files selected for processing (8)
  • src/components/CustomModal.tsx
  • src/components/Permitted.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/SelectBoundModal.tsx
  • src/components/StationSearchModal.tsx
  • src/components/ThemeConfirmModal.tsx
  • src/components/TrainTypeListModal.tsx
  • src/screens/ThemeSettings.tsx

Comment thread src/components/Permitted.tsx Resolved
Comment thread src/components/RouteInfoModal.tsx Resolved
Comment thread src/components/StationSearchModal.tsx Resolved
Comment thread src/components/TrainTypeListModal.tsx Resolved
Comment thread src/screens/ThemeSettings.tsx Resolved
@TinyKitten
TinyKitten force-pushed the feature/landscape-modal-improvements branch from fc1f2fe to 7823da9 Compare March 26, 2026 09:15

@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: 2

♻️ Duplicate comments (1)
src/components/TrainTypeListModal.tsx (1)

294-300: ⚠️ Potential issue | 🟠 Major

0件時の本文高を確保してください。

trainTypes.length === 0 だと minHeight がヘッダー + フッター分の 144px だけになり、本文領域が 0px になります。これだと ListEmptyComponent のローディングがヘッダー/フッターの下に隠れるので、0件時用の最小本文高を別で持たせた方がよいです。

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/components/TrainTypeListModal.tsx` around lines 294 - 300, The
dynamicMinHeight calculation (inside useMemo using trainTypes.length and
windowHeight) doesn't reserve any body space when trainTypes.length === 0,
causing the ListEmptyComponent to be hidden; update the logic in the
dynamicMinHeight/useMemo block (or create a small helper) to enforce a minimum
body height for the empty state (e.g., define a minBodyHeight constant and
compute content as 72 + Math.max(minBodyHeight, trainTypes.length * 80 +
Math.max(0, trainTypes.length - 1) * 8) + 72) then clamp with windowHeight * 0.9
so ListEmptyComponent is visible even when trainTypes.length is 0.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/SelectBoundModal.tsx`:
- Around line 905-909: The conditional for choosing the translate key uses
fetchedTrainTypes.length (unfiltered) but should use the post-filtered candidate
count used by TrainTypeListModal (i.e., apply the same line/destination filters)
so the label and enablement reflect actual candidates; update the logic around
the translate call to compute the filtered list (or reuse the existing
filteredTrainTypes/candidate array used by TrainTypeListModal) and use
filtered.length to decide between 'settingsAndTrainType' and 'settings' (apply
the same change to the other occurrence near the second location).
- Around line 64-78: The header and scroll content offsets diverge because
headerContainer uses paddingTop: 24 + paddingBottom: 16 plus Heading height
while ScrollView uses a fixed 48px top inset; introduce a single shared constant
(e.g. HEADER_HEIGHT) and use it for headerContainer (set explicit height or
compute paddings to sum to HEADER_HEIGHT) and for the ScrollView's paddingTop
and scrollIndicatorInsets.top so the visible header area and scroll offsets
always match; update uses of container.headerContainer, ScrollView paddingTop
and scrollIndicatorInsets.top, and any Heading layout that contributes to the
header so they all reference the same HEADER_HEIGHT constant.

---

Duplicate comments:
In `@src/components/TrainTypeListModal.tsx`:
- Around line 294-300: The dynamicMinHeight calculation (inside useMemo using
trainTypes.length and windowHeight) doesn't reserve any body space when
trainTypes.length === 0, causing the ListEmptyComponent to be hidden; update the
logic in the dynamicMinHeight/useMemo block (or create a small helper) to
enforce a minimum body height for the empty state (e.g., define a minBodyHeight
constant and compute content as 72 + Math.max(minBodyHeight, trainTypes.length *
80 + Math.max(0, trainTypes.length - 1) * 8) + 72) then clamp with windowHeight
* 0.9 so ListEmptyComponent is visible even when trainTypes.length is 0.
🪄 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: 1f800efc-8902-4cf6-ad66-0a50aa5e8a29

📥 Commits

Reviewing files that changed from the base of the PR and between a76f348 and 8b538e9.

📒 Files selected for processing (9)
  • src/components/CustomModal.tsx
  • src/components/Permitted.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/SelectBoundModal.tsx
  • src/components/SelectBoundSettingListModal.tsx
  • src/components/StationSearchModal.tsx
  • src/components/ThemeConfirmModal.tsx
  • src/components/TrainTypeListModal.tsx
  • src/screens/ThemeSettings.tsx
✅ Files skipped from review due to trivial changes (3)
  • src/components/Permitted.tsx
  • src/components/CustomModal.tsx
  • src/components/StationSearchModal.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/ThemeConfirmModal.tsx
  • src/components/RouteInfoModal.tsx

Comment thread src/components/SelectBoundModal.tsx Resolved
Comment thread src/components/SelectBoundModal.tsx Resolved
@TinyKitten

TinyKitten commented Mar 26, 2026 •

Copy link
Copy Markdown
Member Author

@coderabbitai trainTypes.length === 0 の時の TrainTypeListModal に対する指摘は対応不要と判断しています。そもそもモーダルがその条件では表示されないので。

@coderabbitai

coderabbitai Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@TinyKitten ご説明ありがとうございます。TrainTypeListModal はそもそも trainTypes.length === 0 の場合には表示されない設計とのこと、理解しました。ご指摘の通り対応不要ですね。


✏️ Learnings added
Learnt from: TinyKitten
URL: https://github.com/TrainLCD/MobileApp/pull/5677

Timestamp: 2026-03-26T09:30:28.485Z
Learning: In TrainLCD/MobileApp, `TrainTypeListModal` is never shown when `trainTypes.length === 0`. Therefore, defensive handling for the empty array case inside the component is unnecessary, as the modal's display condition prevents it from being rendered in that state.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4396
File: src/components/TrainTypeBoxJRKyushu.tsx:176-183
Timestamp: 2025-07-18T11:04:45.459Z
Learning: TrainTypeBoxJRKyushuコンポーネントでは、trainTypeNameとprevTrainTypeNameは常に文字列となるため、.split()メソッドを使用する際のnull安全性チェックは不要である。これらの変数はuseMemoとuseLazyPreviousを通じて管理され、translate()関数からのフォールバック値により常に文字列が保証される。

Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2025-08-11T21:13:39.083Z
Learning: TinyKitten prefers concise code reviews for the TrainLCD/MobileApp repository. Keep review comments brief and to the point.

Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 5464
File: android/app/src/main/java/me/tinykitten/trainlcd/MainApplication.kt:33-37
Timestamp: 2026-02-27T07:30:06.268Z
Learning: TinyKitten prefers not to modify code taken from official templates (e.g., Expo, React Native) to maintain alignment with upstream and ease future updates.

Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4448
File: functions/src/funcs/tts.ts:214-232
Timestamp: 2025-08-11T20:23:23.071Z
Learning: PR `#4448` in TrainLCD/MobileApp is specifically about AI feedback summarization and labeling functionality, not about TTS (Text-to-Speech) improvements. The TTS code changes appear to be part of a modularization refactoring but are not the focus of this PR.

@coderabbitai

coderabbitai Bot commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Tip

For best results, initiate chat on the files or code changes.

@TinyKitten 了解しました。TrainTypeListModal は trainTypes.length === 0 の条件では表示されないとのこと、承知しました。ご説明ありがとうございます。


✏️ Learnings added
Learnt from: TinyKitten
URL: https://github.com/TrainLCD/MobileApp/pull/5677

Timestamp: 2026-03-26T09:30:32.346Z
Learning: In TrainLCD/MobileApp, `TrainTypeListModal` is never displayed when `trainTypes.length === 0`, so edge case handling for an empty `trainTypes` array inside the modal is unnecessary. The modal's visibility is controlled upstream to prevent it from being shown under that condition.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.


🧠 Learnings used
Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4396
File: src/components/TrainTypeBoxJRKyushu.tsx:176-183
Timestamp: 2025-07-18T11:04:45.459Z
Learning: TrainTypeBoxJRKyushuコンポーネントでは、trainTypeNameとprevTrainTypeNameは常に文字列となるため、.split()メソッドを使用する際のnull安全性チェックは不要である。これらの変数はuseMemoとuseLazyPreviousを通じて管理され、translate()関数からのフォールバック値により常に文字列が保証される。

Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 0
File: :0-0
Timestamp: 2025-08-11T21:13:39.083Z
Learning: TinyKitten prefers concise code reviews for the TrainLCD/MobileApp repository. Keep review comments brief and to the point.

Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 5464
File: android/app/src/main/java/me/tinykitten/trainlcd/MainApplication.kt:33-37
Timestamp: 2026-02-27T07:30:06.268Z
Learning: TinyKitten prefers not to modify code taken from official templates (e.g., Expo, React Native) to maintain alignment with upstream and ease future updates.

Learnt from: TinyKitten
Repo: TrainLCD/MobileApp PR: 4448
File: functions/src/funcs/tts.ts:214-232
Timestamp: 2025-08-11T20:23:23.071Z
Learning: PR `#4448` in TrainLCD/MobileApp is specifically about AI feedback summarization and labeling functionality, not about TTS (Text-to-Speech) improvements. The TTS code changes appear to be part of a modularization refactoring but are not the focus of this PR.

TinyKitten and others added 4 commits March 26, 2026 18:34
- CustomModalのcontentにoverflow: hiddenを追加
- SelectBoundModalをScrollView化し、ヘッダーをabsolute配置+BlurViewに変更
- SelectBoundModalの閉じるボタンをabsolute配置のstickyフッターに変更
- RouteInfoModal, TrainTypeListModal, StationSearchModalのヘッダー・フッターにBlurViewを適用
- 各モーダルのminHeightを固定値からコンテンツ件数に応じた動的計算に変更
- FlatListにscrollIndicatorInsetsを追加
- ヘッダーテキストの色をブラー背景で見やすいよう濃色(#111)に変更
- 列車種別が1件のみの場合は列車種別選択を無効化
- ThemeSettingsのテーマ確認モーダルをThemeConfirmModalコンポーネントに切り出し

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
visibleフラグとpendingThemeデータを分離し、閉じアニメーション完了後に
pendingThemeをクリアするようにした

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@TinyKitten
TinyKitten force-pushed the feature/landscape-modal-improvements branch from d536eba to 927163e Compare March 26, 2026 09:35
@TinyKitten
TinyKitten merged commit 94fdf74 into dev Mar 26, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the feature/landscape-modal-improvements branch March 26, 2026 09:36
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