You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that the zoomTapEnabled prop in the MapView component can't be modified. If the map is rendered the first time with this prop in true/false, it doesn't matter what value we pass the following times, it always keep the first one. This causes that even when we pass this prop as false, the user can zoom in by double tapping on the map.
This makes it impossible to enable or disable the gesture if not when you create the map for the first time.
Just the sample code is enough. The map is initially rendered with zoomTapEnabled={false} and a second later that changes to zoomTapEnabled={true} but the user still can't zoom in.
Expected result
The MapView component should enable or disable the zoom tap gesture as per the passed value.
Actual result
The MapView component only considers the value passed the first time.
React Native Maps Version
1.13.0
What platforms are you seeing the problem on?
iOS (Google Maps)
React Native Version
0.73.3
What version of Expo are you using?
Not using Expo
Device(s)
All iOS devices
Additional information
Looking at the native code I found the problem. I'll open a pull request but I wanted to have an issue to reference to.
In react-native-google-maps > AirGoogleMap.m file, there's a method called overrideGestureRecognizersForView which gets called when the map is loaded.
Sometimes this method is called before React Native sets the zoomTapEnabled prop to NO, and when this happens, the gesture recognizer with handleZoomTapGesture action is not removed. The next time overrideGestureRecognizersForView is called, the origGestureRecognizersMeta dict already contains all the gestures so it just continue without making any changes.
I think instead of removing the gesture, we should enable/disable it when the zoomTapEnabled property is set.
The text was updated successfully, but these errors were encountered:
Summary
I found that the
zoomTapEnabled
prop in the MapView component can't be modified. If the map is rendered the first time with this prop in true/false, it doesn't matter what value we pass the following times, it always keep the first one. This causes that even when we pass this prop as false, the user can zoom in by double tapping on the map.This makes it impossible to enable or disable the gesture if not when you create the map for the first time.
This only affects iOS using Google Maps
Reproducible sample code
Steps to reproduce
Just the sample code is enough. The map is initially rendered with
zoomTapEnabled={false}
and a second later that changes tozoomTapEnabled={true}
but the user still can't zoom in.Expected result
The MapView component should enable or disable the zoom tap gesture as per the passed value.
Actual result
The MapView component only considers the value passed the first time.
React Native Maps Version
1.13.0
What platforms are you seeing the problem on?
iOS (Google Maps)
React Native Version
0.73.3
What version of Expo are you using?
Not using Expo
Device(s)
All iOS devices
Additional information
Looking at the native code I found the problem. I'll open a pull request but I wanted to have an issue to reference to.
In react-native-google-maps > AirGoogleMap.m file, there's a method called overrideGestureRecognizersForView which gets called when the map is loaded.
Sometimes this method is called before React Native sets the zoomTapEnabled prop to NO, and when this happens, the gesture recognizer with handleZoomTapGesture action is not removed. The next time overrideGestureRecognizersForView is called, the origGestureRecognizersMeta dict already contains all the gestures so it just continue without making any changes.
I think instead of removing the gesture, we should enable/disable it when the zoomTapEnabled property is set.
The text was updated successfully, but these errors were encountered: