Skip to content

Header駅名スロットにminWidth: 0を追加して圧縮が効かなくなる回帰を修正 - #6063

Merged
TinyKitten merged 1 commit into
devfrom
claude/text-compression-display-ALCks
May 27, 2026
Merged

TinyKitten merged 1 commit into
devfrom
claude/text-compression-display-ALCks

Conversation

@TinyKitten

@TinyKitten TinyKitten commented May 27, 2026 •

Copy link
Copy Markdown
Member

概要

PR #6060 で導入した駅名圧縮の修正に回帰があった。可視 Text に width: naturalTextWidth を渡しても、スロット側のデフォルト min-width: auto により Text の自然幅がスロット自身を押し広げてしまい、onLayout が natural と同じ値を返して scaleX = 1(圧縮ゼロ)になっていた。実機でも「…」は消えたが文字が画面外へはみ出すだけになっていたので追従修正する。

変更の種類

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

変更内容

  • HeaderE231 (stationNameWrapper) / HeaderE235 (stationNameSlot) / HeaderJL (stationNameSlot) / HeaderJRWest (stationNameContainer) に minWidth: 0 を追加。これにより flex 子要素の既定 min-width: auto を上書きし、内側 Text の width: naturalTextWidth がスロット/コンテナ自体を押し広げる回帰を抑止する。
  • スロットの実測幅が flex 配分で決まる値に戻るため、scaleX = containerWidth / naturalTextWidth が想定通りに計算され、極端に長い駅名でも字幅圧縮が機能する。

テスト

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

関連Issue

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


Generated by Claude Code

Summary by CodeRabbit

  • バグ修正
    • 複数のヘッダーコンポーネントの駅名表示レイアウトを改善しました。テキストのスケーリングと幅計算が正確に動作するように調整されています。

Review Change Stack

@TinyKitten TinyKitten self-assigned this May 27, 2026
@github-actions github-actions Bot added the react label May 27, 2026
@coderabbitai

coderabbitai Bot commented May 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: b23bf9f8-bdee-4d80-bc8d-be564031694c

📥 Commits

Reviewing files that changed from the base of the PR and between d146bbd and 32b58b6.

📒 Files selected for processing (4)
  • src/components/HeaderE231.tsx
  • src/components/HeaderE235.tsx
  • src/components/HeaderJL.tsx
  • src/components/HeaderJRWest.tsx

📝 Walkthrough

Walkthrough

HeaderE231、HeaderE235、HeaderJL、HeaderJRWest の4つのヘッダーコンポーネントの駅名表示スタイルに minWidth: 0 を追加。flex レイアウトにおける子要素の既定 min-width: auto による押し広げを抑止し、onLayout と自然幅の計測値の整合性を確保して scaleX 圧縮計算を正確に動作させる。

Changes

Flex レイアウト最小幅調整

Layer / File(s) Summary
駅名領域の minWidth: 0 統一調整
src/components/HeaderE231.tsx, src/components/HeaderE235.tsx, src/components/HeaderJL.tsx, src/components/HeaderJRWest.tsx
4つのヘッダーコンポーネントの駅名スロット/コンテナスタイルに minWidth: 0 を追加。flex 子要素の既定 min-width: auto による幅押し広げを抑止し、onLayout と scaleX 計算の整合性を確保するため、各箇所にコメントを付加。

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

  • TrainLCD/MobileApp#6053: 本PR の minWidth: 0 追加は #6053 の scaleX 実装により生じうる onLayout と自然幅の不一致を抑える直接の補強になっているため関連がある。
  • TrainLCD/MobileApp#6057: 両PR とも同一のヘッダーコンポーネント群で駅名 onLayout/scaleX 計測経路に影響する箇所を扱っており、前者の minWidth: 0 調整と後者の useStationName* フック置換は相補的な変更である。

Suggested labels

react

Poem

🐰 四つのヘッダーが flex に悩み

minWidth ゼロで呪いを払う

scaleX よ、正しく圧縮されよ

駅名がレイアウトに収まりて

いざレンダリング、美しかれ 🚆

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PRのタイトルは、minWidth: 0を追加して駅名圧縮の回帰を修正するという変更の主要な内容を明確かつ簡潔に表現しており、ファイルリストやノイズがなく、変更箇所を適切に要約しています。
Description check ✅ Passed PRの説明は、概要・変更の種類・変更内容・テストチェック結果といった必須セクションがすべて充実して記載されており、テンプレートの主要項目を適切に満たしています。
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.

✏️ 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 claude/text-compression-display-ALCks

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

@TinyKitten
TinyKitten merged commit 1705389 into dev May 27, 2026
6 checks passed
@TinyKitten
TinyKitten deleted the claude/text-compression-display-ALCks branch May 27, 2026 23:00
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.

2 participants