简体   繁体   English

OnSelect 不适用于 react-Google-places-autocomplete

[英]OnSelect dosnt work with react-Google-places-autocomplete

I build a form with react js and i want to include location with google-auto complete , so i found this library :我用 react js 构建了一个表单,我想用 google-auto complete 包含位置,所以我找到了这个库:

https://github.com/Tintef/react-google-places-autocomplete#readme https://github.com/Tintef/react-google-places-autocomplete#readme

Its worked fine for me for 2 weeks but suddenly I see nothing while I print the value of OnSelect.它对我来说很好用了 2 周,但是在我打印 OnSelect 的值时突然什么也没看到。 at my console this message in yellow pops-up:在我的控制台中,此消息以黄色弹出:

Select-073d29ba.esm.js:749 [Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952

my Component:我的组件:

<div>
    <GooglePlacesAutocomplete
      onSelect={console.log}
 />

Suggestion what happend?建议怎么回事?

I was facing the same issue, the problem is that the latest version of react-google-places-autocomplete is still in ALPHA and BETA Testing and it is not a stable one.我遇到了同样的问题,问题是最新版本的 react-google-places-autocomplete 仍在 ALPHA 和 BETA 测试中,它不是一个稳定的版本。

Just use the version 2.3.2, it will solve the issue.只需使用2.3.2版本即可解决问题。

run the command :运行命令:

npm install --save react-google-places-autocomplete@2.3.2 npm install --save react-google-places-autocomplete@2.3.2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 从 react-google-places-autocomplete 获取所选项目 - Get selected item from react-google-places-autocomplete 如何使用 react-google-places-autocomplete 从地址获取纬度和经度 - How to get Latitude and Longitude from address using react-google-places-autocomplete 如何将 react-google-places-autocomplete 与 react-hook-from 集成? - How to integrate react-google-places-autocomplete with react-hook-from? 谷歌自动完成将 api 放入反应中 - google autocomplete places api in react Google 在 React 组件中放置了自动完成功能 - Google places autocomplete inside a react component React/Material UI - Google Places 自动完成下拉菜单有时不起作用 - React/Material UI - Google Places autocomplete dropdown sometimes doesn't work 使Google Places与React localhost一起使用 - Making Google Places work with React localhost 有没有办法为 React Google Places AutoComplete 设置初始值? - Is there a way to set the initial value for React Google Places AutoComplete? Google API - 在 React Native Expo 项目中放置自动完成功能 - Google API - Places autocomplete in React Native Expo Project react-places-autocomplete 限制 - react-places-autocomplete restrictions
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM