HMS-Core / hms-react-native-plugin

This repo contains all of React-Native HMS plugins.
https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1
Apache License 2.0
240 stars 68 forks source link

[react-native-hms-map] onCameraIdle / onCameraMoveStarted #158

Closed peltax closed 2 years ago

peltax commented 2 years ago

Description When user is dragging the map there is onCameraMoveStarted / onCameraIdle event spam in the middle of dragging. It happens most frequently when you're moving small distances or drag slowly.

I tried to "fix" this by using counter variable that only executes onCameraIdle logic when it's 0 but sometimes it misses events or they don't fire at all and counter is -1 or 2 after touch is released.

The only workaround that works is to update timestamp in onCameraMoveStarted and add artificial 2000ms setTimeout to onCameraIdle handler and execute logic only after delay is expired (= movement really ended).

EDIT: 2000ms is only required in dev build, ~500ms is enough in release build. This issue is maybe bug in native gesture handling in map library?

Expected behavior onCameraMoveStarted is called exactly once when user starts to drag map (reason = GESTURE). onCameraMove is called during dragging (I don't use this event currently). onCameraIdle is called exactly once after user releases finger

Environment

Other Consider adding onTouchStarted and onTouchReleased events if current behaviour is intended.

ozcanozgur commented 2 years ago

Hi @peltax,

According to our tests the issue is caused by the native Android Huawei Map SDK. Huawei React Native Map Plugin is a wrapper of native Android Huawei Map SDK thus inherits the behaviours of it. For any question and suggestions please submit a ticket online.

Thank you for your interest.