Conversation
ユーザーが地図をパン操作した際に位置更新による自動カメラ移動を 停止し、右下に「現在地に戻る」ボタンを表示するようにした。 https://claude.ai/code/session_014Dfww6cbtt9ZEBh2Ea2REQ
📝 WalkthroughWalkthrough
Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 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
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@app/`(tabs)/map.tsx:
- Around line 77-88: The effect currently calls mapRef.current.fitToCoordinates
with allCoords (from getAllCoordinates) which makes "return to current location"
feel inconsistent when trajectories are long; change the useEffect (and the
handleReturnToCurrentLocation function) to compute and pass only the latest
coordinate (e.g., take the last item from getAllCoordinates(trajectories) or
getLatestCoordinate helper) to mapRef.current.animateToRegion/fitToCoordinates
so the camera recenters on the most recent position; update references in
useEffect (the dependency on trajectories/isFollowing remains) and inside
handleReturnToCurrentLocation to use the same latest-coordinate logic to unify
behavior.
🧹 Nitpick comments (2)
app/(tabs)/map.tsx (2)
90-93: パン以外のジェスチャーでも追従解除するなら、検知範囲を広げるのが安全です。
onPanDragだけだとズーム/回転の操作で追従解除されず、次の更新で強制的に戻る可能性があります。onRegionChangeCompleteのisGestureを使う方法を検討してください(v1.26.20 の仕様確認前提)。♻️ 例(ジェスチャー全般で解除)
- const handleMapPanDrag = useCallback(() => { - setIsFollowing(false); - }, []); + const handleMapInteraction = useCallback((_region, details) => { + if (details?.isGesture) setIsFollowing(false); + }, []);- onPanDrag={handleMapPanDrag} + onRegionChangeComplete={handleMapInteraction}Also applies to: 304-305
327-333: 戻るボタンにアクセシビリティ属性を追加してください。スクリーンリーダー向けに
accessibilityRole/accessibilityLabelを付けると安心です。♿ 追加例
<TouchableOpacity style={styles.returnButton} onPress={handleReturnToCurrentLocation} activeOpacity={0.8} + accessibilityRole="button" + accessibilityLabel="現在地に戻る" >
ユーザーが地図をパン操作した際に位置更新による自動カメラ移動を
停止し、右下に「現在地に戻る」ボタンを表示するようにした。
https://claude.ai/code/session_014Dfww6cbtt9ZEBh2Ea2REQ
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.