diff --git a/src/features/venueMap/components/VenueMapView/VenueMapView.tsx b/src/features/venueMap/components/VenueMapView/VenueMapView.tsx index 5d2686becdb..df284ef6c12 100644 --- a/src/features/venueMap/components/VenueMapView/VenueMapView.tsx +++ b/src/features/venueMap/components/VenueMapView/VenueMapView.tsx @@ -2,6 +2,7 @@ import BottomSheet from '@gorhom/bottom-sheet' import { useNavigation } from '@react-navigation/native' import React, { FunctionComponent, useCallback, useEffect, useMemo, useRef, useState } from 'react' import { Platform, View } from 'react-native' +import { Directions, FlingGesture, Gesture, GestureDetector } from 'react-native-gesture-handler' import { useSafeAreaInsets } from 'react-native-safe-area-context' import styled from 'styled-components/native' import Supercluster from 'supercluster' @@ -50,6 +51,8 @@ interface Props { playlistType: PlaylistType } +const FLING_GESTURE = Gesture.Fling().runOnJS(true).direction(Directions.UP) + export const VenueMapView: FunctionComponent = ({ height, from, @@ -71,6 +74,9 @@ export const VenueMapView: FunctionComponent = ({ const { setInitialVenues } = useInitialVenuesActions() const isPreviewEnabled = useFeatureFlag(RemoteStoreFeatureFlags.WIP_VENUE_MAP) const shouldDisplayPinV2 = useFeatureFlag(RemoteStoreFeatureFlags.WIP_VENUE_MAP_PIN_V2) + const shouldNavigateToVenueOnFling = useFeatureFlag( + RemoteStoreFeatureFlags.WIP_FLING_BOTTOM_SHEET_NAVIGATE_TO_VENUE + ) const bottomSheetOffersEnabled = useFeatureFlag( RemoteStoreFeatureFlags.WIP_OFFERS_IN_BOTTOM_SHEET ) @@ -269,6 +275,7 @@ export const VenueMapView: FunctionComponent = ({ .filter((venueType): venueType is VenueTypeCode => !!venueType) ?? [] return ( @@ -277,19 +284,33 @@ export const VenueMapView: FunctionComponent = ({ [filteredVenues] ) + const flingRef = useRef() + + FLING_GESTURE.withRef(flingRef) + .enabled(shouldNavigateToVenueOnFling) + .onEnd(() => { + if (selectedVenue && bottomSheetIndex === snapPoints.length - 1) { + navigateToVenue(selectedVenue.venueId) + } + }) + return ( - + + + +