-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
initialRegion does not work correctly on IOS #4244
Comments
Confirmed this issue, the workaround that I'm using is using a
The |
I'm using 0.31.1 |
Using region instead of initialregion is not a good solution as re-rendering takes you back to the state that was defined in "region" |
initialRegion does not work with my method, because the map needs to be re-zoomed after the setTimeout. |
The same problem here. However, in one component it works good, but on others it doesn't. The map is zoomed out. Didn't happend on 0.30.1, now on 0.31.0 is a problem. |
Changed initialRegion to region works for me |
We are experiencing this issue as well on iOS. We went from The specific issues are:
Here are some of our relevant dependencies:
Unfortunately changing |
Was able to reproduce this. Interestingly, the only thing that changed between 0.30.1 and 0.31.0 regarding this seems to be the Google Maps pod version (let me know if I missed something)? I'm looking to release a beta version this weekend that includes my proposed fix for this. Stand by 👍 |
@Simon-TechForm cheers for the quick response! It looks like updating to |
it's not ideal but it seems to be the only solution for now. Thank you |
🎉 This issue has been resolved in version 1.0.0-beta.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
As you might have guessed from the comment above, I've just published a beta release that should fix the issue. I would love to get feedback from anyone able to try it out 🤞 |
I tested beta today, issue with iOS with google maps and initialRegion is not working, can be reproduced with const [loaded, setLoaded] = useState(false)
const onRegionChangeComplete = (region) => {
if (!loaded) {
if (region.latitude != initialRegion.latitude || region.longitude != initialRegion.longitude) {
mapRef.animateToRegion(initialRegion, 1)
}
setLoaded(true)
}
} |
same for me, I tested beta and initialRegion is still not working properly. |
Interesting. Could you both elaborate on how you are testing the changes and what behaviour you are experiencing? @tomasmozeris You posted a video where initialregion wasn't set until you interacted with the map, how is it behaving now? I just ran the defaultmarker example and a triage project I have locally with the new version, and it's working as expected on my end 🤔 |
✅ Apple maps work great, it zooms to initialRegion Simulator.Screen.Recording.-.iPhone.13.-.2022-06-13.at.09.34.08.mp4Let me know if there is anything I could help |
Beta version does not work for me, |
@tomasmozeris interesting. This is not what I'm seeing at my end. Looking into this again. @longprao the new version contains no changes regarding the circle component, so this is expected. |
initialRegion does not work when I open the component the first time. But if I load the component another time it works perfectly. And sometimes it seems like I have a conflict with initialRegion and region when they are both set as props (the app close when the component load). But not everytime. Strange thing is I have no error message for both of those bugs. |
Also tested the beta on ios with google maps and the initial region is not working most of the time. |
Same issue occurring on my end. With |
I've just released a new beta that includes some changes to how initial region works. I'm not getting my hopes up, but could the people experiencing the issue try it out? And just for the sake of my sanity, please make sure that you are using the newest beta and make sure to clean your project and reinstall your pods if you updated an existing project. I'm not able to reproduce the issue when running the beta version, so if someone who's able to consistently reproduce the bug on the beta channel is willing to try out a few things for me, please let me know. |
|
Same here, 1.0.0-beta.7 seems to fix the problem on iOS when I use initialRegion. Thank you :) |
@Simon-TechForm works perfectly, thank you very much ❤️👍! It also seems to fix another bug for me on the ios simulator, where the map tiles are not aligned with the actual coordinates somehow... |
🎉 This issue has been resolved in version 1.0.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I tried version |
I'm experiencing this issue with version 1.1.0: the first time my app is charged the map is all zoomed out. After a reload or a change in the coordinates, zoom is set as defined by initialRegion. |
this helped 100%, thank you |
This comment was marked as off-topic.
This comment was marked as off-topic.
Has this patch been removed from version 1.4.0-beta.1? @Simon-TechForm |
Just in case it's some of your situations, if you are passing a |
Even when doing like this: ref={(ref) => (mapRef.current = ref)} |
@Badra00 You are assigning a whole |
I am facing same issue with "react-native-maps": "0.29.4" |
@haiderali3071 Issue was resolved one year ago and
|
How do you do this with hooks? |
@Badra00 Your question is out of scope of this issue. Please ask React relative questions on Q/A platforms such as stackoverflow.com or try the discussions of the |
facing the same issue on 1.8.0. Tested maps with static coordinates as initialRegion. |
Also seeing same issue on 1.8.3 |
I had this same problem happening on the IOS emulator, when running on the physical device the problem did not occur. |
same |
Just FYI, for anyone still having issues with this. I still have issues on iPhone 15 Pro Max, mostly on release builds. As a reference, if maybe it's a different bug than this one, my map would load up on the phone and not zoom in where i set it with initialRegion. Sometimes it would move and zoom in, but if i pan it would instantly jump to a point on the map, slightly lower and to the right of the coordinates I set. From that point on whatever region I set or fit coordinates call would animate to a wrong point on the map, with no way of fixing it. Using "react-native-maps": "1.18.0" I recommend experimenting with the following:
I hope it helps someone |
@sbrighiu i am having this issue since now almost two weeks and its driving me crazy. Unfortunately your steps do not help me. For me initially everything is fine, the troubles start as soon as i logout the current demo user, and log back in again with a different user. The initialRegion seems to jumpt to Africa (even though the region is correctly set). Afterwards each animateToRegion is offset slightly to the lower right. Any idea what i could try in addition? I guess i have to create a new issue ... |
Conditionally render the map based on if you have a user or not. It's possible it may fix it, otherwise try to implement some sort of loading inside the map, and when the loading finishes conditionally render a different map component with the initialRegion of your choice. The animation to the region may work if done this way but it depends a lot on the codebase.
Best regards,
Stefan
…On Sep 21, 2024 at 22:41 +0300, tmhrl ***@***.***>, wrote:
@sbrighiu i am having this issue since now almost two weeks and its driving me crazy. Unfortunately your steps do not help me. For me initially everything is fine, the troubles start as soon as i logout the current demo user, and log back in again with a different user. The initialRegion seems to jumpt to Africa (even though the region is correctly set). Afterwards each animateToRegion is offset slightly to the lower right. Any idea what i could try in addition? I guess i have to create a new issue ...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
The sad truth is it depends a lot... delaying the initial region animation by removing the initialRegion and doing it manually the first time when the screen is in focus is the first step. The only other advice i can give is to fix it somehow, then try to call it faster (relative to the mount of the component). If it breaks again, try calling it later and continue the search :) good luck :) |
Bug report
After upgrading the last version of the package initialRegion does not work correctly on IOS, it does work on Android.
Works well in "react-native-maps": "^0.29.4".
Environment info
Steps to reproduce
Describe what actually happens:
The map centers around the correct point but does not zoom to the correct delta
The text was updated successfully, but these errors were encountered: