Skip to content

Commit

Permalink
Merge pull request #26525 from allroundexperts/fix-26435
Browse files Browse the repository at this point in the history
  • Loading branch information
thienlnam authored Sep 2, 2023
2 parents 8fbe6aa + 6d043f7 commit 9701fbe
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 1 deletion.
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;

0 comments on commit 9701fbe

Please sign in to comment.