Giter Site home page Giter Site logo

Comments (11)

turtlecrab avatar turtlecrab commented on June 12, 2024 2

То же самое - проекты со StrictMode (кое-как) работают на codesandbox, но не работают локально(а также на vercel).

https://codesandbox.io/s/agitated-khayyam-lnstj8?file=/src/App.ts
Здесь можно увидеть баг с двойным отображением маркера - нажимаем на кнопку в строгом режиме - видим два маркера, без строгого режима - ожидаемо один.

При этом этот же проект запущенный локально вообще не работает:

Uncaught TypeError: t is not a constructor
    at Function.mountObject (BaseGeoObject.tsx:61:1)
    at q.componentDidMount (BaseGeoObject.tsx:34:1)
    ...

Карта без маркера ошибку не выбрасывает, только с маркером. Хак, который мне удалось придумать, чтобы все-таки заставить маркер появиться - выводить его по setTimeout на уже загрузившуюся карту:

const [showPlacemark, setShowPlacemark] = useState(false)

useEffect(() => {
  setTimeout(() => setShowPlacemark(true), 2000)
}, [])

...

{showPlacemark && (
  <Placemark geometry={[lat + offset[0], lon + offset[1]]} />
)}

Причем с маленькой задержкой тоже ошибка. Не знаю, насколько эта информация будет полезна, но решил добавить :)

from react-yandex-maps.

kumold avatar kumold commented on June 12, 2024 1

В версии с typescript ругает что у YMaps нет опции children.

https://codesandbox.io/s/typescript-forked-q2lt5w?file=/src/index.tsx

from react-yandex-maps.

kumold avatar kumold commented on June 12, 2024 1

Благодарю за быстрые ответы. Отваливается оказывается при StrictMode.
Т.е. если обернуть App в React.StrictMode.

from react-yandex-maps.

kumold avatar kumold commented on June 12, 2024 1

Хм... в примере от вас работает с StrictMode, но в моем примерном репозиторие отваливается.

from react-yandex-maps.

kumold avatar kumold commented on June 12, 2024 1

В версии react-yandex-maps все как бы работает, но рисует две карты. А в версии @pbe/react-yandex-maps все как вы описали.

То же самое - проекты со StrictMode (кое-как) работают на codesandbox, но не работают локально(а также на vercel).

https://codesandbox.io/s/agitated-khayyam-lnstj8?file=/src/App.ts Здесь можно увидеть баг с двойным отображением маркера - нажимаем на кнопку в строгом режиме - видим два маркера, без строгого режима - ожидаемо один.

При этом этот же проект запущенный локально вообще не работает:

Uncaught TypeError: t is not a constructor
    at Function.mountObject (BaseGeoObject.tsx:61:1)
    at q.componentDidMount (BaseGeoObject.tsx:34:1)
    ...

Карта без маркера ошибку не выбрасывает, только с маркером. Хак, который мне удалось придумать, чтобы все-таки заставить маркер появиться - выводить его по setTimeout на уже загрузившуюся карту:

const [showPlacemark, setShowPlacemark] = useState(false)

useEffect(() => {
  setTimeout(() => setShowPlacemark(true), 2000)
}, [])

...

{showPlacemark && (
  <Placemark geometry={[lat + offset[0], lon + offset[1]]} />
)}

Причем с маленькой задержкой тоже ошибка. Не знаю, насколько эта информация будет полезна, но решил добавить :)

from react-yandex-maps.

R1ZEN avatar R1ZEN commented on June 12, 2024 1

@kumold @turtlecrab пофикшено, сейчас должно и на локалке работать)
https://codesandbox.io/s/nostalgic-lehmann-f0o63o?file=/src/App.tsx

from react-yandex-maps.

R1ZEN avatar R1ZEN commented on June 12, 2024

Биндиги уже работают на React18
https://codesandbox.io/s/pbe-react-yandex-maps-react-18-xe2o98?file=/src/index.js

from react-yandex-maps.

kumold avatar kumold commented on June 12, 2024

У себя добавил children для проверки, но отваливается уже в других местах.

from react-yandex-maps.

kumold avatar kumold commented on June 12, 2024

Собрал примерный проект с 18 реактом.
https://github.com/kumold/react-yandex-maps-example

Там можно посмотреть, как отваливается карта.

from react-yandex-maps.

R1ZEN avatar R1ZEN commented on June 12, 2024

@kumold карта работает, просто контейнер должен иметь размеры)
https://codesandbox.io/s/pbe-react-yandex-maps-placemark-y0lq62?file=/src/App.tsx

from react-yandex-maps.

turtlecrab avatar turtlecrab commented on June 12, 2024

У меня работает! Спасибо!

from react-yandex-maps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.