Hello all,
Recently ejected from Expo and the animateToRegion is not working for Android devices but is working on iOS devices.
Necessary data is making it to the method but the map is not animating. I’ve tried it with both a “duration” and without, and both times the results are the same (Map doesn’t animate to the new location).
Any help would be highly appreciated.
Here is my code:
useEffect(() => {
if (!selectedPlaceId || !flatlist) {
return
}
const index = filteredItems().findIndex(item => item.id === selectedPlaceId)
flatlist.current.scrollToIndex({ index })
const selectedPlace = filteredItems()[index]
const region = {
latitude: selectedPlace.coordinates.latitude -.02,
longitude: selectedPlace.coordinates.longitude,
latitudeDelta: 0.08,
longitudeDelta: 0.08
}
map.current.animateToRegion(region)
}, [selectedPlaceId]);
const filteredItems = () => {
if (selectedItem) {
if(props.userLanguage == 'fr' || props.userLanguage == 'fr-CA'){
return items.filter((location) => location.subCategoryFR.some((subCategory) => subCategory === selectedItem))
}
return items.filter((location) => location.subCategory.some((subCategory) => subCategory === selectedItem))
}
return items
}