Skip to content

CustomModalのmaxHeightを制限し下方向へのずれを修正 - #5693

Merged
TinyKitten merged 4 commits into
devfrom
feature/fix-custom-modal-max-height
Mar 27, 2026
Merged

TinyKitten merged 4 commits into
devfrom
feature/fix-custom-modal-max-height

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Mar 27, 2026 •

Copy link
Copy Markdown
Member

Summary

  • CustomModal の maxHeight を画面高さの75%に制限
  • contentContainerStyle 経由で渡される minHeight が maxHeight を超えないよう StyleSheet.flatten でキャップ処理を追加
  • これにより minHeight > maxHeight でモーダルが下にずれる問題を解消

Test plan

  • RouteInfoModal(停車駅リスト)が画面内に収まり、中央に表示されることを確認
  • 閉じるボタンが表示されることを確認
  • 他のCustomModal利用箇所(ThemeConfirmModal, StationSearchModal等)に影響がないことを確認
  • タブレット端末での表示を確認

🤖 Generated with Claude Code

Summary by CodeRabbit

  • 改善(Refactor)
    • モーダル全般の高さ制約を見直し、最大高さをウィンドウの75%に調整(タブレット含む)。コンテンツ高さ指定をmin→heightへ統一し、レイアウトの安定性を向上。
  • 修正(Bug Fixes)
    • 検索/ステーション一覧の読み込み表示を強化し、プレースホルダー行を追加。読み込み中は一覧を空表示にして高さと視認性を安定化。

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

coderabbitai Bot commented Mar 27, 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: 65879691-9cc8-4342-825d-8c0b8c7fc504

📥 Commits

Reviewing files that changed from the base of the PR and between 1b716cc and c2ef77b.

📒 Files selected for processing (3)
  • src/components/EmptyResult.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/StationSearchModal.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/components/EmptyResult.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/components/StationSearchModal.tsx
  • src/components/RouteInfoModal.tsx

📝 Walkthrough

Walkthrough

複数のモーダルで最大高さを75%に引き下げ、コンテンツの高さ制御をminHeight→heightへ切替。ヘッダー高さを動的算出しFlatListやスクロールインセットへ反映、StationSearchで読み込み状態を高さ計算に組み込み。EmptyResultのスケルトンと太字スタイルを拡張。

Changes

Cohort / File(s) Summary
Modal sizing & dynamic height (モーダル共通の高さ調整)
src/components/CustomModal.tsx, src/components/RouteInfoModal.tsx, src/components/StationSearchModal.tsx, src/components/TrainTypeListModal.tsx
モーダルの最大高さを'90%'→'75%'に変更。多くのコンテナでminHeightをheightへ切替。RouteInfoModalはHEADER_HEIGHT定数とheaderHeight stateを導入、FlatListのpaddingTop/scrollIndicatorInsets.topを動的ヘッダー高さで制御。StationSearchModalは読み込みフラグで表示リストと高さ算出をガードし、高さクランプをwindowHeight * 0.75に調整。
EmptyResult skeleton & styles
src/components/EmptyResult.tsx
boldスタイルにfontSize: 16を追加。読み込み時のSkeletonPlaceholderに行を追加してプレースホルダ行数を増加。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 窓の高さをはかってみたよ、
七五の合図でぴょんと収まる。
描画は軽やかに、待つ間は夢見る、
スケルトンは二つでリズムを刻む、
新しい箱でまた跳ねよう ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive PR説明は「概要」「テストプラン」を含み、主な変更内容と確認項目が記載されているが、テンプレートの「変更の種類」「変更内容の詳細」「Lintチェック実行状況」などの必須セクションが不足している。 テンプレートの全セクションを埋める(変更の種類、詳細な変更内容、Lint/テスト実行状況、関連Issue等を追加)。
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR タイトルはモーダルの maxHeight 制限と下方向へのずれ修正に関するもので、raw_summary に記載された複数ファイルでの変更(maxHeight: '90%' から '75%' への更新など)の主要な目的を正確に反映している。
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/fix-custom-modal-max-height

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

@TinyKitten TinyKitten self-assigned this Mar 27, 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.

🧹 Nitpick comments (2)
src/components/StationSearchModal.tsx (1)

248-261: isLoading の定義位置について

isLoading が Line 268 で定義されていますが、stations メモ内(Line 250-251)でも同じ条件が直接使用されています。可読性のため、isLoading を stations メモより前に定義し、両方で再利用することを検討してください。

♻️ 提案
+ const isLoading = fetchStationsByNameLoading || fetchStationsNearbyLoading;
+
  const stations = useMemo(
    () =>
-     fetchStationsByNameLoading || fetchStationsNearbyLoading
+     isLoading
        ? []
        : fetchStationsByNameCalled
          ? getUniqueStations(stationsByNameData?.stationsByName)
          : getUniqueStations(stationsNearbyData?.stationsNearby),
    [
      stationsNearbyData?.stationsNearby,
      stationsByNameData?.stationsByName,
      fetchStationsByNameCalled,
-     fetchStationsByNameLoading,
-     fetchStationsNearbyLoading,
+     isLoading,
    ]
  );
- 
- const isLoading = fetchStationsByNameLoading || fetchStationsNearbyLoading;

Also applies to: 268-269

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

In `@src/components/StationSearchModal.tsx` around lines 248 - 261, Define a
shared isLoading boolean before the stations useMemo and reuse it in the memo
and later code to avoid duplicating the same loading condition; specifically,
create isLoading = fetchStationsByNameLoading || fetchStationsNearbyLoading
above the stations constant, then update the stations useMemo (the function that
currently checks fetchStationsByNameLoading || fetchStationsNearbyLoading) to
reference isLoading, and update any later references (e.g., where isLoading is
currently declared on Lines ~268-269) to use this single definition so the
loading logic is centralized and clearer.
src/components/RouteInfoModal.tsx (1)

32-34: dynamicMinHeight と headerHeight の不一致の可能性

dynamicMinHeight は静的な HEADER_HEIGHT を使用していますが、FlatList の paddingTop と scrollIndicatorInsets は動的な headerHeight(onLayout で測定)を使用しています。

RFValue はデバイスの高さに応じてスケーリングするため、実際のヘッダー高さが HEADER_HEIGHT と異なる場合、モーダルの高さ計算とコンテンツのパディングに微妙なずれが生じる可能性があります。

一貫性を保つため、dynamicMinHeight でも headerHeight を使用することを検討してください。

♻️ 提案
  const dynamicMinHeight = useMemo(() => {
    const count = deduppedStations.length;
    const content =
-     HEADER_HEIGHT + count * 80 + Math.max(0, count - 1) * 8 + 72;
+     headerHeight + count * 80 + Math.max(0, count - 1) * 8 + 72;
    return Math.min(content, windowHeight * 0.75);
- }, [deduppedStations.length, windowHeight]);
+ }, [deduppedStations.length, windowHeight, headerHeight]);

Also applies to: 271-276

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

In `@src/components/RouteInfoModal.tsx` around lines 32 - 34, The computed static
HEADER_HEIGHT can diverge from the runtime-measured headerHeight (set in
onLayout) causing mismatched dynamicMinHeight and FlatList
padding/scrollIndicatorInsets; update the dynamicMinHeight calculation to
reference the headerHeight state/variable instead of HEADER_HEIGHT, and ensure
any places using HEADER_HEIGHT for layout (e.g., dynamicMinHeight, modal
minHeight logic) consistently use headerHeight so FlatList paddingTop and
scrollIndicatorInsets remain in sync with the actual measured header.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/components/RouteInfoModal.tsx`:
- Around line 32-34: The computed static HEADER_HEIGHT can diverge from the
runtime-measured headerHeight (set in onLayout) causing mismatched
dynamicMinHeight and FlatList padding/scrollIndicatorInsets; update the
dynamicMinHeight calculation to reference the headerHeight state/variable
instead of HEADER_HEIGHT, and ensure any places using HEADER_HEIGHT for layout
(e.g., dynamicMinHeight, modal minHeight logic) consistently use headerHeight so
FlatList paddingTop and scrollIndicatorInsets remain in sync with the actual
measured header.

In `@src/components/StationSearchModal.tsx`:
- Around line 248-261: Define a shared isLoading boolean before the stations
useMemo and reuse it in the memo and later code to avoid duplicating the same
loading condition; specifically, create isLoading = fetchStationsByNameLoading
|| fetchStationsNearbyLoading above the stations constant, then update the
stations useMemo (the function that currently checks fetchStationsByNameLoading
|| fetchStationsNearbyLoading) to reference isLoading, and update any later
references (e.g., where isLoading is currently declared on Lines ~268-269) to
use this single definition so the loading logic is centralized and clearer.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 62f2c58a-be4a-46cf-9f6a-a348e42a35f8

📥 Commits

Reviewing files that changed from the base of the PR and between 0429b7d and 1b716cc.

📒 Files selected for processing (5)
  • src/components/CustomModal.tsx
  • src/components/EmptyResult.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/StationSearchModal.tsx
  • src/components/TrainTypeListModal.tsx
✅ Files skipped from review due to trivial changes (1)
  • src/components/CustomModal.tsx

@TinyKitten
TinyKitten merged commit 72e2ba8 into dev Mar 27, 2026
5 checks passed
@TinyKitten
TinyKitten deleted the feature/fix-custom-modal-max-height branch March 27, 2026 01:12
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