Skip to content
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

[Bug]地图使用MapControl在iphone12 系统14.2.1上会报错 #532

Open
w3cpress opened this issue Sep 14, 2024 · 4 comments
Open

[Bug]地图使用MapControl在iphone12 系统14.2.1上会报错 #532

w3cpress opened this issue Sep 14, 2024 · 4 comments
Labels
google maps issue Google Maps is misbehaving, upstream issue filed wontfix This will not be worked on

Comments

@w3cpress
Copy link

w3cpress commented Sep 14, 2024

Description

521726279207_ pic

Steps to Reproduce

import React, { useCallback, useMemo } from 'react'
import { useState, useEffect, FC, useRef, createRef, useContext, useReducer } from 'react'

import { APIProvider, useMap, Map, ControlPosition, RenderingType, MapControl, MapProps } from '@vis.gl/react-google-maps';
import './index.scss'
// import { getConfig } from '../../../../utils/google';
// const googleMapKey = getConfig.google.apiKey;
// const mapId = getConfig.google.mapId;

const googleMapKey = "testMapKey";
const mapId = "testId";

const Index: FC = () => {

    const mapProps: MapProps = {
        defaultCenter: {
            lat: 24.7136,
            lng: 46.6753,
        },
        disableDoubleClickZoom: false,
        mapId: mapId,
        mapTypeControl: false,
        minZoom: 5,
        maxZoom: 17,
        zoom: 10,
        style: {
            position: 'absolute',
            minHeight: "100vh",
            width: "100%"
        },
        renderingType: RenderingType.UNINITIALIZED,
    };
    return (
        <div className='index'>
            <APIProvider apiKey={googleMapKey}>
            <Map {...mapProps}>
                <MapControl position={ControlPosition.CENTER}>
                    <div style={{
                        background: 'red'
                    }}>
                        .. any component here will be added to the control-containers of the
                        google map instance ..
                    </div>
                </MapControl>
            </Map>
        </APIProvider>
        </div>
    )
}

export default Index

It's just the normal official demo code, without any additional rendering, and then the above error is reported. Systems equal to or higher than iOS 15 will not have this error.

(original text) 就是正常的官方demo代码,没有其他渲染,然后就报上面的错误了。大于等于ios 15的系统都不会有这个报错。

Environment

  • Library version: 最新
  • Google maps version: weekly
  • Browser and Version: 跟随ios 系统14.2.1的
  • OS: 14.2.1

Logs

No response

@w3cpress w3cpress added the bug Something isn't working label Sep 14, 2024
@shuuji3
Copy link
Contributor

shuuji3 commented Sep 14, 2024

Maybe because the iOS version (14.2.1) seems a bit too old. Google Maps API officially supported two major versions: iOS 16 and 17 so probably the latest library is not well tested on iOS 14.

Browser Support  |  Maps JavaScript API  |  Google for Developers - https://developers.google.com/maps/documentation/javascript/browsersupport

The latest version of iOS 14 is 14.8.1. I'm not sure if this can fix the issue but how about updating to the latest version of iOS 14. I don't recommend using iOS 14 though since it won't receive the security patch anymore.

iOS version history - Wikipedia - https://en.wikipedia.org/wiki/IOS_version_history

@usefulthink
Copy link
Collaborator

I think @shuuji3 is right: The stacktrace in your screenshot doesn't contain any stack frames from our library. I can only guess what that .close() method that causes the exception actually is, but it's probably part of a web-standard that isn't supported by older iOS versions. So there's probably nothing we could do about this.

@usefulthink usefulthink added wontfix This will not be worked on google maps issue Google Maps is misbehaving, upstream issue filed and removed bug Something isn't working labels Sep 17, 2024
@usefulthink
Copy link
Collaborator

Another note: Please invest the time to translate a bug report into English, this will make it easier for us to understand and fix, and it will help others searching for similar issues find this.

@w3cpress
Copy link
Author

@usefulthink @shuuji3 Thanks to everyone, I have replaced the functional part I need without using mapControl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
google maps issue Google Maps is misbehaving, upstream issue filed wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants