[英]Google API - Places autocomplete in React Native Expo Project
I am developing mobile app using React Native Expo .我正在使用 React Native Expo开发移动应用程序。 I am using
react-native-google-places-autocomplete
for text auto completetion of location/places.我正在使用
react-native-google-places-autocomplete
来自动完成位置/地点的文本。 It is Google API.它是谷歌 API。 I have made account, enabled the google service and also added my billing info.
我已经创建了帐户,启用了谷歌服务并添加了我的账单信息。 But the code is not working.
但是代码不起作用。
See the code below:请看下面的代码:
<View style={{height: 500}}>
<GooglePlacesAutocomplete
fetchDetails={true}
placeholder='Search'
onPress={(data, details = null) => {
console.log(data, details);
}}
query={{
key: 'my-api-key-here',
language: 'en',
}}
/>
</View>
I am able to SUCCESSFULLY see the Search
placeholder where I can type, but I am not able to see the suggestions/autocompletion text by google.我能够成功地看到我可以输入的
Search
占位符,但我无法看到谷歌的建议/自动完成文本。 I am able to type the location successfully in the box, but there is no location suggestions coming by google.我可以在框中成功输入位置,但谷歌没有提供位置建议。
I have installed and imported relevant libraries too.我也安装并导入了相关库。
You need to add prop listViewDisplayed={boolean or "auto"}.您需要添加道具 listViewDisplayed={boolean or "auto"}。 See this link https://snack.expo.io/@tobzy/react-native-google-places-autocomplete-example
请参阅此链接https://snack.expo.io/@tobzy/react-native-google-places-autocomplete-example
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.