From c332fbcb6f5e582825e65fe55d8270397bb26f73 Mon Sep 17 00:00:00 2001 From: Kirill Kaverin <89150690390@yandex.ru> Date: Fri, 15 May 2026 13:25:21 +0300 Subject: [PATCH] fix(ios): respect custom duration for Apple map camera animations Use animated MapKit updates in duration > 0 camera commands so moveCamera and fitCoordinates follow the provided duration instead of default timing. --- example/shared/src/screens/HomeScreen.tsx | 4 ++-- ios/core/AppleMapProvider.mm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/example/shared/src/screens/HomeScreen.tsx b/example/shared/src/screens/HomeScreen.tsx index d9138ed..c4c7641 100644 --- a/example/shared/src/screens/HomeScreen.tsx +++ b/example/shared/src/screens/HomeScreen.tsx @@ -153,14 +153,14 @@ const HomeContent = ({ onMarkerPress: onMarkerPressProp }: HomeProps) => { const moveToRandomMarker = () => { if (markers.length === 0) return; const marker = randomFrom(markers); - mapRef.current?.moveCamera(marker.coordinate); + mapRef.current?.moveCamera(marker.coordinate, { duration: 2000 }); mapRef.current?.showMarkerCallout(marker.id); }; const fitAllMarkers = () => { mapRef.current?.fitCoordinates( markers.map((m) => m.coordinate), - { padding: { top: 60, left: 40, right: 40, bottom: 40 } } + { duration: 2000, padding: { top: 60, left: 40, right: 40, bottom: 40 } } ); }; diff --git a/ios/core/AppleMapProvider.mm b/ios/core/AppleMapProvider.mm index 73cb43c..e2db1ef 100644 --- a/ios/core/AppleMapProvider.mm +++ b/ios/core/AppleMapProvider.mm @@ -1778,7 +1778,7 @@ - (void)moveCamera:(double)latitude zoomLevel:targetZoom]; [UIView animateWithDuration:duration / 1000.0 animations:^{ - [self->_mapView setRegion:region animated:NO]; + [self->_mapView setRegion:region animated:YES]; }]; } else { [_mapView @@ -1823,7 +1823,7 @@ - (void)fitCoordinates:(NSArray *)coordinates animations:^{ [self->_mapView setVisibleMapRect:mapRect edgePadding:insets - animated:NO]; + animated:YES]; }]; } else { [_mapView setVisibleMapRect:mapRect edgePadding:insets animated:NO];