大家好!
我正在开发一个天气应用程序的反应本土化。在我的项目中,我安装了反应-本地-谷歌-地点-自动完成
我从文档获取了一个基本示例的代码,并将其插入到我的应用程序中:
import React from 'react';
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';
export const GooglePlacesInput = () => {
return (
<GooglePlacesAutocomplete
placeholder='Search'
onPress={(data, details = null) => {
// 'details' is provided when fetchDetails = true
console.log(data, details);
}}
query={{
key: 'my key here...',
language: 'en',
}}
/>
);
}万事通一切正常。但出于某种原因,搜索栏是不可点击的。我点击它,但什么都没有发生,我不能在那里写。
,请告诉我有什么问题吗?
发布于 2022-01-12 08:55:05
也许你需要这个:
const ref = useRef();
useEffect(() => {
ref.current?.setAddressText('Some Text');
}, []);然后在你看来:
<GooglePlacesAutocomplete
ref={ref}
...
/>https://stackoverflow.com/questions/70678572
复制相似问题