Skip to content

未使用スタイルの削除とListFooterやToast設定の再レンダリング対策 - #6421

Merged
TinyKitten merged 2 commits into
devfrom
feature/style-cleanup-and-render-stability
Jul 15, 2026
Merged

TinyKitten merged 2 commits into
devfrom
feature/style-cleanup-and-render-stability

Conversation

@TinyKitten

@TinyKitten TinyKitten commented Jul 15, 2026 •

Copy link
Copy Markdown
Member

概要

未使用コードの削除と、レンダリングのたびにコンポーネントや設定オブジェクトが再生成されていた箇所の整理。アプリの見た目・挙動は変えないリファクタリングです。

変更の種類

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

変更内容

  • 17 ファイルから、どこからも参照されていないスタイル定義と不要になった import(RFValue / Platform など)を削除
  • GlobalToast: 毎レンダー useMemo で toastConfig を組み立てる構成をやめ、モジュールレベルの静的 config とテーマ対応の ThemedBaseToast / ThemedErrorToast に分割
  • EnabledLanguagesSettings / Licenses / TTSSettings / ThemeSettings: ListFooterComponent に渡していたインライン関数コンポーネントを独立した ListFooter に切り出し、要素として渡すことでレンダリングごとの再マウントを抑止
  • CommonCard: stations のデフォルト値を毎レンダー新規生成される [] からモジュールレベルの EMPTY_STATIONS に変更し、参照を安定化

テスト

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

関連Issue

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

Summary by CodeRabbit

  • 新機能

    • 言語設定、音声設定、テーマ設定、ライセンス画面のフッター表示を整理し、OKボタンや関連リンクを統一しました。
    • トースト通知の表示色と文字スタイルがテーマに応じて切り替わるようになりました。
  • 改善

    • 駅名、路線記号、カードなどのレイアウトや余白を調整し、画面表示を整理しました。
    • 不要な表示要素を削除し、各画面の見た目を簡潔にしました。

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

coderabbitai Bot commented Jul 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

テーマ対応トーストを共通化し、複数設定画面のフッターをコンポーネント化した。あわせて、共通カード、路線表示、各種画面の未使用スタイルと依存するインポートを整理した。

Changes

UI更新とスタイル整理

Layer / File(s) Summary
テーマ対応トーストの共通化
src/components/GlobalToast.tsx
テーマ判定に基づくスタイル生成をuseToastStylesへ集約し、テーマ付きトーストコンポーネントからsuccess・error・info表示を生成する構成へ変更した。
設定画面フッターのコンポーネント化
src/screens/EnabledLanguagesSettings.tsx, src/screens/Licenses.tsx, src/screens/TTSSettings.tsx, src/screens/ThemeSettings.tsx
リスト末尾のUIをListFooterへ抽出し、言語設定、注意文、OKボタン、navigation.goBack()をprops経由で接続した。
カードと路線記号のスタイル更新
src/components/CommonCard.tsx, src/components/NumberingIconHalfSquare.tsx, src/components/NumberingIconReversedRound.tsx, src/components/NumberingNishitetsu.tsx, src/components/PresetCard.tsx
CommonCardの既定駅配列とマーク表示を更新し、路線番号・カード関連のスタイルを削除または調整した。
各コンポーネントのスタイル整理
src/components/LineBoard.tsx, src/components/LineBoardE231.tsx, src/components/LineBoardSaikyo.tsx, src/components/NowHeader.tsx, src/components/RouteInfoModal.tsx, src/components/SelectBoundModal.tsx, src/components/SettingsHeader.tsx, src/components/StationSearchModal.tsx, src/components/TrainTypeBoxJRKyushu.tsx, src/components/TransferLineMark.tsx, src/components/TypeChangeNotify.tsx, src/screens/Privacy.tsx
未使用スタイルとRFValue・Platform関連のインポートや定義を削除し、一部の駅名・レイアウトスタイルを整理した。

Estimated code review effort: 3 (Moderate) | ~20 minutes

Poem

ぴょんと跳ねればトーストが光る
フッター整えて道がひらく
余分なスタイルは巣から出し
カードの形もすっきり晴れる
うさぎは変更を耳で祝う

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed 主要な変更である未使用スタイル削除とListFooter/Toastの再生成対策を適切に要約しています。
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/style-cleanup-and-render-stability

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

@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 (1)
src/components/GlobalToast.tsx (1)

40-85: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

ThemedBaseToast と ThemedErrorToast の重複ロジックをファクトリ関数へ統合可能。

対象コンポーネント(BaseToast/ErrorToast)以外は完全に同一の実装です。1つのファクトリ関数に切り出すと保守性が向上します。

♻️ 提案するリファクタ例
-const ThemedBaseToast: React.FC<ThemedToastProps> = ({
-  ledColor,
-  defaultColor,
-  ...props
-}) => {
-  const { style, text1Style, text2Style } = useToastStyles(
-    ledColor,
-    defaultColor
-  );
-
-  return (
-    <BaseToast
-      {...props}
-      style={style}
-      contentContainerStyle={contentContainerStyle}
-      text1Style={text1Style}
-      text2Style={text2Style}
-    />
-  );
-};
-
-const ThemedErrorToast: React.FC<ThemedToastProps> = ({
-  ledColor,
-  defaultColor,
-  ...props
-}) => {
-  const { style, text1Style, text2Style } = useToastStyles(
-    ledColor,
-    defaultColor
-  );
-
-  return (
-    <ErrorToast
-      {...props}
-      style={style}
-      contentContainerStyle={contentContainerStyle}
-      text1Style={text1Style}
-      text2Style={text2Style}
-    />
-  );
-};
+const createThemedToast = (
+  ToastComponent: typeof BaseToast | typeof ErrorToast
+): React.FC<ThemedToastProps> => {
+  const ThemedToast: React.FC<ThemedToastProps> = ({
+    ledColor,
+    defaultColor,
+    ...props
+  }) => {
+    const { style, text1Style, text2Style } = useToastStyles(
+      ledColor,
+      defaultColor
+    );
+
+    return (
+      <ToastComponent
+        {...props}
+        style={style}
+        contentContainerStyle={contentContainerStyle}
+        text1Style={text1Style}
+        text2Style={text2Style}
+      />
+    );
+  };
+  return ThemedToast;
+};
+
+const ThemedBaseToast = createThemedToast(BaseToast);
+const ThemedErrorToast = createThemedToast(ErrorToast);
🤖 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/components/GlobalToast.tsx` around lines 40 - 85, ThemedBaseToast and
ThemedErrorToast duplicate the same styling and prop-forwarding logic. Extract
their shared implementation into a factory function parameterized by the target
toast component, then create each themed toast from that factory while
preserving the existing ledColor, defaultColor, and style behavior.
🤖 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.

Nitpick comments:
In `@src/components/GlobalToast.tsx`:
- Around line 40-85: ThemedBaseToast and ThemedErrorToast duplicate the same
styling and prop-forwarding logic. Extract their shared implementation into a
factory function parameterized by the target toast component, then create each
themed toast from that factory while preserving the existing ledColor,
defaultColor, and style behavior.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f7b6597d-fc67-4773-ad65-c9c3b9e2116f

📥 Commits

Reviewing files that changed from the base of the PR and between 84b8203 and c4e10f1.

📒 Files selected for processing (22)
  • src/components/CommonCard.tsx
  • src/components/GlobalToast.tsx
  • src/components/LineBoard.tsx
  • src/components/LineBoardE231.tsx
  • src/components/LineBoardSaikyo.tsx
  • src/components/NowHeader.tsx
  • src/components/NumberingIconHalfSquare.tsx
  • src/components/NumberingIconReversedRound.tsx
  • src/components/NumberingNishitetsu.tsx
  • src/components/PresetCard.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/SelectBoundModal.tsx
  • src/components/SettingsHeader.tsx
  • src/components/StationSearchModal.tsx
  • src/components/TrainTypeBoxJRKyushu.tsx
  • src/components/TransferLineMark.tsx
  • src/components/TypeChangeNotify.tsx
  • src/screens/EnabledLanguagesSettings.tsx
  • src/screens/Licenses.tsx
  • src/screens/Privacy.tsx
  • src/screens/TTSSettings.tsx
  • src/screens/ThemeSettings.tsx
💤 Files with no reviewable changes (14)
  • src/components/TransferLineMark.tsx
  • src/components/SettingsHeader.tsx
  • src/screens/Privacy.tsx
  • src/components/TypeChangeNotify.tsx
  • src/components/NumberingNishitetsu.tsx
  • src/components/StationSearchModal.tsx
  • src/components/NowHeader.tsx
  • src/components/SelectBoundModal.tsx
  • src/components/PresetCard.tsx
  • src/components/TrainTypeBoxJRKyushu.tsx
  • src/components/NumberingIconHalfSquare.tsx
  • src/components/NumberingIconReversedRound.tsx
  • src/components/RouteInfoModal.tsx
  • src/components/LineBoard.tsx

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