Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix pan behaviour of the Distance Request map #26525

Merged
merged 3 commits into from
Sep 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/components/MapView/MapView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {useFocusEffect} from '@react-navigation/native';
import Mapbox, {MapState, MarkerView, setAccessToken} from '@rnmapbox/maps';
import {forwardRef, memo, useCallback, useEffect, useImperativeHandle, useRef, useState} from 'react';

import responder from './responder';
import utils from './utils';
import Direction from './Direction';
import CONST from '../../CONST';
Expand Down Expand Up @@ -63,6 +64,8 @@ const MapView = forwardRef<MapViewHandle, MapViewProps>(({accessToken, style, ma
styleURL={styleURL}
onMapIdle={setMapIdle}
pitchEnabled={pitchEnabled}
// eslint-disable-next-line
{...responder.panHandlers}
>
<Mapbox.Camera
ref={cameraRef}
Expand Down
7 changes: 6 additions & 1 deletion src/components/MapView/MapView.web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import React, {forwardRef, useCallback, useEffect, useImperativeHandle, useState
import {View} from 'react-native';
import Map, {MapRef, Marker} from 'react-map-gl';

import responder from './responder';
import utils from './utils';

import CONST from '../../CONST';
Expand Down Expand Up @@ -58,7 +59,11 @@ const MapView = forwardRef<MapViewHandle, MapViewProps>(
);

return (
<View style={style}>
<View
style={style}
// eslint-disable-next-line
{...responder.panHandlers}
>
<Map
ref={setRef}
mapboxAccessToken={accessToken}
Expand Down
5 changes: 5 additions & 0 deletions src/components/MapView/responder/index.ios.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const responder = {
panHandlers: {},
};

export default responder;
8 changes: 8 additions & 0 deletions src/components/MapView/responder/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {PanResponder} from 'react-native';

const responder = PanResponder.create({
onStartShouldSetPanResponder: () => true,
onPanResponderTerminationRequest: () => false,
});

export default responder;
Loading