@@ -11,13 +11,14 @@ import StopMarker from 'components/StopMarker';
1111import { GET_TRIP } from 'screens/route/RouteScreen' ;
1212import Stop from 'components/Stop' ;
1313import { setActiveStop } from 'slices/stops' ;
14+ import { STOP_FIELDS } from 'apollo/fragments' ;
1415
1516MapboxGL . setAccessToken ( MAPBOX_ACCESS_TOKEN ) ;
1617
1718const DEFAULT_COORD = [ - 73.94594865587045 , 40.7227534777328 ] ;
1819const DEFAULT_ZOOM = 11 ;
1920const STOP_ZOOM = 15 ;
20- const ANIMATION_DURATION = 2000 ;
21+ const ANIMATION_DURATION = 1500 ;
2122
2223interface ShapeVars {
2324 shapeId : string ;
@@ -58,8 +59,8 @@ const MapScreen: FC = () => {
5859 } ,
5960 } ) ;
6061
61- const goToStop = useCallback (
62- stop => {
62+ const onStopPress = useCallback (
63+ ( stop : IStop ) => {
6364 setMarkerVisible ( false ) ;
6465 setTimeout ( ( ) => setMarkerVisible ( true ) , ANIMATION_DURATION ) ;
6566 dispatch (
@@ -81,11 +82,12 @@ const MapScreen: FC = () => {
8182
8283 const { nextTrip : trip } : { nextTrip : ITrip } = tripInCache || { } ;
8384
84- const stopTime : IStopTime | any =
85- trip ?. stopTimes . find (
86- ( st : IStopTime ) => st . stop . stopId === activeStop ?. stopId ,
87- ) || null ;
88- const { stop } : { stop : IStop } = stopTime || { } ;
85+ const stop = client . readFragment ( {
86+ id : `Stop:${ activeStop ?. stopId } ` ,
87+ fragment : gql `
88+ ${ STOP_FIELDS }
89+ ` ,
90+ } ) ;
8991
9092 useEffect ( ( ) => {
9193 if ( stop ) {
@@ -121,9 +123,10 @@ const MapScreen: FC = () => {
121123 trip ?. stopTimes . map ( ( st : IStopTime ) => (
122124 < Stop
123125 key = { `stop-time-${ st . stop . stopId } ` }
124- stopId = { st . stop . stopId }
125- trip = { trip }
126- goToStop = { goToStop }
126+ stop = { st . stop }
127+ color = { trip . route . routeColor }
128+ aboveLayerID = { `line-layer-${ trip . shapeId } ` }
129+ onPress = { onStopPress }
127130 />
128131 ) ) }
129132 </ MapboxGL . MapView >
0 commit comments