Conversation
📝 WalkthroughWalkthrough地図表示機能を追加。react-native-mapsを導入し、MapScreenコンポーネント、デバイス軌跡フック、色割当ユーティリティを実装。タブレイアウトに"map"タブを追加し、アコーディオンの高さロジックをmax-heightベースに統一しました。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant MapScreen
participant LocationStore as Location Store
participant Hook as useDeviceTrajectory
participant RNMaps as react-native-maps
participant Reanimated as Reanimated
User->>MapScreen: マップ画面を開く/デバイスを選択
MapScreen->>LocationStore: ロケーション更新を購読
LocationStore-->>MapScreen: 位置更新を配信
MapScreen->>Hook: 更新と選択デバイスを渡す
Hook-->>MapScreen: デバイス別の座標配列を返却
MapScreen->>Reanimated: アコーディオン開閉アニメーション開始
MapScreen->>RNMaps: Polyline/Markerを描画、fitToCoordinatesを呼ぶ
RNMaps-->>User: 地図上に軌跡とマーカーを表示
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 分 Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@app/`(tabs)/_layout.tsx:
- Around line 45-51: Add the missing mapping for the IconSymbol component by
updating the MAPPING object in icon-symbol.tsx: add an entry with key "map.fill"
and value "map" so IconSymbol (used in Tabs.Screen with name "map" and prop
name="map.fill") resolves correctly on Android/Web and avoids the runtime error.
In `@app/`(tabs)/map.tsx:
- Around line 281-298: The current trajectories.map wraps Marker and Polyline
inside a <View>, which breaks react-native-maps overlays; remove the <View>
wrapper and render Marker and Polyline as direct children of MapView instead,
using a keyed React.Fragment for each trajectory (e.g., React.Fragment with
key={trajectory.deviceId}) so the key remains associated with the mapped item;
keep the existing conditional renders for Polyline, Marker and continue using
getDeviceColor(trajectory.deviceId, state.deviceIds) and
trajectory.latestPosition as before.
🧹 Nitpick comments (4)
constants/map-colors.ts (1)
17-20: JSDocコメントと実装の不一致コメントでは「デバイスIDのハッシュ値を使って色を決定する」と記載されていますが、実際の実装は
indexOfによるインデックスベースの色割り当てを行っています。コメントを実装に合わせて修正することをお勧めします。📝 コメント修正案
/** * デバイスIDからPolylineの色を取得 - * デバイスIDのハッシュ値を使って色を決定する + * デバイスIDの配列内インデックスを使って色を決定する */ export function getDeviceColor(deviceId: string, deviceIds: string[]): string {app/(tabs)/logs.tsx (1)
214-231: アコーディオンロジックの共通化を検討
timeline.tsxとlogs.tsxのアコーディオンアニメーションロジック(toggleFilter、contentStyle、arrowStyleなど)はほぼ同一です。将来的にカスタムフック(例:useAccordionAnimation)やコンポーネントへの抽出を検討すると、メンテナンス性が向上します。hooks/use-device-trajectory.ts (1)
65-69: 純粋関数のモジュール配置について検討してください。
getAllCoordinatesはuseMemoなどのReact APIを使用しない純粋関数です。現在の配置でも動作しますが、将来的にユーティリティとしてlib/utils.ts等に移動することで、他のモジュールからも再利用しやすくなります。app/(tabs)/map.tsx (1)
77-87:trajectoriesの参照変更による過剰なfitToCoordinates呼び出しに注意してください。
trajectoriesはuseMemoから返される配列で、updatesやselectedDevicesが変わるたびに新しい参照が生成されます。位置情報の更新頻度が高い場合、fitToCoordinatesが頻繁に呼ばれてパフォーマンスに影響する可能性があります。必要に応じて、座標数の変化時のみフィットさせるなどの最適化を検討してください。
IconSymbolのMAPPINGに"map.fill"エントリを追加し、Android/Webでのランタイムエラーを修正。 MapView内のMarker/PolylineをViewではなくFragmentで囲むことで、 react-native-mapsのオーバーレイが正しく描画されるよう修正。 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary by CodeRabbit
新機能
改善
✏️ Tip: You can customize this high-level summary in your review settings.