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

Android: Не срабатывает onPress маркера в ClusteredYamap #293

Open
mvpk-x opened this issue Jul 30, 2024 · 2 comments

Comments

@mvpk-x
Copy link

mvpk-x commented Jul 30, 2024

import React from 'react';
import { ClusteredYamap } from '../../react-native-yamap/src';

const Map = () => {
  return (
    <ClusteredYamap
      clusterColor="red"
      clusteredMarkers={[
        {
          point: {
            lat: 56.754215,
            lon: 38.622504,
          },
          data: {},
        },
        {
          point: {
            lat: 56.754215,
            lon: 38.222504,
          },
          data: {},
        },
      ]}
      renderMarker={(info, index) => (
        <Marker
          key={index}
          point={info.point}
          onPress={() => console.log('pressed')}
        />
      )}
      style={{flex: 1}}
    />
  );
};

На iOS не проверял.

@ybalaev1
Copy link

ybalaev1 commented Aug 15, 2024

на ios тоже не работает нажатие на маркер😔
"react-native-yamap": "^4.6.0",
сделал костыль - работает через раз, т.к точность 1:100 точек
в функции onMapPress

const pLat = e.nativeEvent.lat;
            const pLon = e.nativeEvent.lon;
            // вычисление погрешности при нажатии на карту и сравнивание с координатами активности(Math.abs(pLon - activity.location.coordinates.longitude) >= 0.001));
            const item = activities.find(activity => {
              const dep = Math.abs(pLat - activity.location.coordinates.latitude) >= 0.001;
              const depLon = Math.abs(pLon - activity.location.coordinates.longitude) >= 0.001;Math.abs(pLon - 
              activity.location.coordinates.longitude), depLon);
              
              if (!dep && !depLon) {
                return activity;
              }
            });
            
            if (!!item) {
              onPresItem(item);
            }

@DMilyutin
Copy link

на ios тоже не работает нажатие на маркер😔 "react-native-yamap": "^4.6.0", сделал костыль - работает через раз, т.к точность 1:100 точек в функции onMapPress

const pLat = e.nativeEvent.lat;
            const pLon = e.nativeEvent.lon;
            // вычисление погрешности при нажатии на карту и сравнивание с координатами активности(Math.abs(pLon - activity.location.coordinates.longitude) >= 0.001));
            const item = activities.find(activity => {
              const dep = Math.abs(pLat - activity.location.coordinates.latitude) >= 0.001;
              const depLon = Math.abs(pLon - activity.location.coordinates.longitude) >= 0.001;Math.abs(pLon - 
              activity.location.coordinates.longitude), depLon);
              
              if (!dep && !depLon) {
                return activity;
              }
            });
            
            if (!!item) {
              onPresItem(item);
            }

На iOS работает нажатие на маркер

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants