是否可以将GooglePlacesAutocomplete限制为仅进行基本搜索?我的直觉是它要么在query
内,要么我需要删除fetchDetails={true}
并仅返回数据...我想这样做,所以我不收取任何搜索费用。
<GooglePlacesAutocomplete
debounce={200}
listViewDisplayed="auto"
minLength={2}
placeholder="Search..."
autoFocus={false}
returnKeyType={'search'}
fetchDetails={true}
query={{
key: API_KEY,
language: 'en',
types: '(cities)'
}}
styles={{
textInputContainer: {
backgroundColor: 'rgba(0,0,0,0)',
borderTopWidth: 0,
borderBottomWidth:0,
},
textInput: {
marginLeft: 0,
marginRight: 0,
height: 38,
color: '#5d5d5d',
fontSize: 16
},
predefinedPlacesDescription: {
color: 'black'
},
}}
renderDescription={value => value.description}
onPress={(data, details) => {
updateLocationArray(data, details, timeFrame);
}}
/>
答案 0 :(得分:0)
Google Maps Platform Places API使用即付即用的定价模型,并且每个请求都相应地计费。您可以查看更多详细信息here。
Google Maps Platform为每个结算帐户提供$ 200 USD的免费层级信用,您可以用来免费请求API。请小心不要超过此限制,因为一旦免费信用用尽,您将相应地付费。您还可以遵循此optimization guide来帮助您优化用法。
您还可以使用Places API进行多种搜索。您可以有查找地点,附近搜索,文本搜索请求。在Google Maps Platform的documentation上详细了解它。
希望这会有所帮助!