@@ -2,7 +2,6 @@ import React, { useState, useEffect, useRef, useCallback, useMemo } from 'react'
22import {
33 View ,
44 Text ,
5- Image ,
65 ScrollView ,
76 StyleSheet ,
87 Pressable ,
@@ -15,8 +14,9 @@ import { SafeAreaView, useSafeAreaInsets } from 'react-native-safe-area-context'
1514import { useLocalSearchParams , useRouter } from 'expo-router' ;
1615import { Ionicons } from '@expo/vector-icons' ;
1716import { LinearGradient } from 'expo-linear-gradient' ;
18- import MapView , { Marker , Polyline , Callout , PROVIDER_GOOGLE } from 'react-native-maps' ;
17+ import MapView , { Polyline , Callout , PROVIDER_GOOGLE } from 'react-native-maps' ;
1918import { colors } from '../../src/shared' ;
19+ import PinMarker from '../../src/components/game/PinMarker' ;
2020
2121const guessPinImage = require ( '../../assets/marker-src.png' ) ;
2222const actualPinImage = require ( '../../assets/marker-dest.png' ) ;
@@ -113,6 +113,7 @@ export default function GameResultsScreen() {
113113
114114 const [ activeRound , setActiveRound ] = useState < number | null > ( null ) ;
115115 const [ detailsExpanded , setDetailsExpanded ] = useState ( false ) ;
116+ const [ collapsedContentHeight , setCollapsedContentHeight ] = useState ( 0 ) ;
116117
117118 // Animated panel height for smooth expand/collapse
118119 const panelAnim = useRef ( new Animated . Value ( 0 ) ) . current ; // 0 = collapsed, 1 = expanded
@@ -286,14 +287,12 @@ export default function GameResultsScreen() {
286287 return (
287288 < React . Fragment key = { index } >
288289 { hasActual && (
289- < Marker
290+ < PinMarker
290291 identifier = { `actual-${ index } ` }
291292 coordinate = { { latitude : round . actualLat ! , longitude : round . actualLong ! } }
292- anchor = { { x : 0.5 , y : 1.0 } }
293- tracksViewChanges = { false }
293+ imageSource = { actualPinImage }
294294 stopPropagation
295295 >
296- < Image source = { actualPinImage } style = { styles . markerImage } resizeMode = "contain" />
297296 < Callout onPress = { ( ) => openInGoogleMaps ( round . actualLat ! , round . actualLong ! , round . panoId ) } >
298297 < View style = { styles . calloutContainer } >
299298 < Text style = { styles . calloutTitle } > Round { index + 1 } — Actual Location</ Text >
@@ -310,17 +309,15 @@ export default function GameResultsScreen() {
310309 </ View >
311310 </ View >
312311 </ Callout >
313- </ Marker >
312+ </ PinMarker >
314313 ) }
315314 { hasGuess && (
316- < Marker
315+ < PinMarker
317316 identifier = { `guess-${ index } ` }
318317 coordinate = { { latitude : round . guessLat , longitude : round . guessLong } }
319- anchor = { { x : 0.5 , y : 1.0 } }
320- tracksViewChanges = { false }
318+ imageSource = { guessPinImage }
321319 stopPropagation
322320 >
323- < Image source = { guessPinImage } style = { styles . markerImage } resizeMode = "contain" />
324321 < Callout >
325322 < View style = { styles . calloutContainer } >
326323 < Text style = { styles . calloutTitle } > Round { index + 1 } — Your Guess</ Text >
@@ -334,7 +331,7 @@ export default function GameResultsScreen() {
334331 ) }
335332 </ View >
336333 </ Callout >
337- </ Marker >
334+ </ PinMarker >
338335 ) }
339336 { hasActual && hasGuess && (
340337 < Polyline
@@ -580,7 +577,11 @@ export default function GameResultsScreen() {
580577 // ═══════════════════════════════════════════════════════════
581578 // PORTRAIT LAYOUT — map top, bottom sheet panel (like web mobile)
582579 // ═══════════════════════════════════════════════════════════
583- const collapsedHeight = height * 0.35 ;
580+ const bottomInsetPadding = Math . max ( insets . bottom , 8 ) ;
581+ const panelBottomPadding = detailsExpanded ? bottomInsetPadding : 26 ;
582+ const collapsedHeight = collapsedContentHeight > 0
583+ ? collapsedContentHeight + panelBottomPadding
584+ : Math . min ( height * 0.35 , 240 + panelBottomPadding ) ;
584585 const expandedHeight = height * 0.68 ;
585586
586587 const animatedPanelHeight = panelAnim . interpolate ( {
@@ -617,28 +618,42 @@ export default function GameResultsScreen() {
617618 styles . portraitPanel ,
618619 {
619620 height : animatedPanelHeight ,
620- paddingBottom : Math . max ( insets . bottom , 8 ) ,
621621 } ,
622622 ] }
623623 >
624624 < LinearGradient
625625 colors = { [ 'rgba(20, 65, 25, 0.97)' , 'rgba(20, 65, 25, 0.90)' ] }
626- style = { styles . portraitPanelGradient }
626+ style = { [
627+ styles . portraitPanelGradient ,
628+ {
629+ paddingBottom : panelBottomPadding ,
630+ } ,
631+ ] }
627632 >
628- { /* Drag handle — tap to toggle details */ }
629- < Pressable onPress = { toggleDetails } style = { styles . handleBarTouchArea } >
630- < View style = { styles . handleBar } />
631- </ Pressable >
633+ < View
634+ onLayout = { ( event ) => {
635+ if ( detailsExpanded ) return ;
636+ const nextHeight = Math . ceil ( event . nativeEvent . layout . height ) ;
637+ if ( Math . abs ( nextHeight - collapsedContentHeight ) >= 2 ) {
638+ setCollapsedContentHeight ( nextHeight ) ;
639+ }
640+ } }
641+ >
642+ { /* Drag handle — tap to toggle details */ }
643+ < Pressable onPress = { toggleDetails } style = { styles . handleBarTouchArea } >
644+ < View style = { styles . handleBar } />
645+ </ Pressable >
632646
633- { renderHeader ( detailsExpanded ) }
647+ { renderHeader ( detailsExpanded ) }
648+ </ View >
634649
635650 { /* Rounds section — always rendered, animated via panel height */ }
636651 { detailsExpanded && (
637652 < >
638653 < View style = { styles . sidebarDivider } />
639654 < ScrollView
640655 style = { { flex : 1 } }
641- contentContainerStyle = { { paddingBottom : spacing . lg } }
656+ contentContainerStyle = { { paddingBottom : spacing . lg + bottomInsetPadding } }
642657 showsVerticalScrollIndicator = { true }
643658 bounces = { true }
644659 nestedScrollEnabled = { true }
@@ -663,6 +678,7 @@ const styles = StyleSheet.create({
663678 sidebar : {
664679 borderLeftWidth : 2 ,
665680 borderLeftColor : colors . primary ,
681+ backgroundColor : 'rgba(20, 65, 25, 0.97)' ,
666682 } ,
667683 sidebarGradient : {
668684 flex : 1 ,
@@ -679,6 +695,7 @@ const styles = StyleSheet.create({
679695 left : 0 ,
680696 right : 0 ,
681697 overflow : 'hidden' ,
698+ backgroundColor : 'rgba(20, 65, 25, 0.97)' ,
682699 borderTopLeftRadius : 16 ,
683700 borderTopRightRadius : 16 ,
684701 ...Platform . select ( {
@@ -856,13 +873,6 @@ const styles = StyleSheet.create({
856873 fontSize : fontSizes . xs ,
857874 fontWeight : '500' ,
858875 } ,
859-
860- // ── Map markers ──────────────────────────────────────────────
861- markerImage : {
862- width : 40 ,
863- height : 50 ,
864- } ,
865-
866876 // ── Callout tooltips ─────────────────────────────────────────
867877 calloutContainer : {
868878 minWidth : 180 ,
0 commit comments