我已经添加了react本地-谷歌-地点-自动完成与纱线在我的反应-本土cli项目,但它是行不通的。以下是我目前面临的问题。
(尽管焦点设置为true)一样。
注意:启用了所有google位置api,启用了google、places和geocode api,并给出了一个有效的api密钥。
我尝试了所有可能的解决方案,包括:
日志在Xcode和Android上都没有显示任何内容。下面是代码片段:
<View style = {[{zIndex: 2, backgroundColor: 'white'}]}>
<GooglePlacesAutocomplete
ref = {ref => setSearchTextRef(ref)}
placeholder='Search for gym'
styles={{
container: {backgroundColor: 'transparent'},
textInputContainer: styles.viewStyle,
textInput: styles.textInputStyle,
}}
keyboardShouldPersistTaps = {'handled'}
listUnderlayColor = {'transparent'}
textInputProps = {{
onFocus: () => focusInput(),
onBlur: () => blurInput(),
onChangeText: (text) => onChange(text)
}}
minLength={1} // minimum length of text to search
returnKeyType={'search'}
listViewDisplayed={'auto'} // true/false/undefined
fetchDetails={true}
renderDescription={row => row.description} // custom description render
onPress={(data, details = null) => {
let coordinates = details.geometry.location;
sendCoordinates(coordinates, {data, details});
}}
getDefaultValue={() => ''}
query={{
key: googleAPIKey,
language: 'en', // language of the results
// types: '(cities)' // default: 'geocode'
}}
nearbyPlacesAPI='GooglePlacesSearch' // Which API to use: GoogleReverseGeocoding or GooglePlacesSearch
GooglePlacesSearchQuery={{
rankby: 'distance',
types: 'gym'
}}
filterReverseGeocodingByTypes={['locality', 'administrative_area_level_3']}
debounce={200}
/>
</View>提前谢谢你
发布于 2020-04-28 17:37:10
你的代码,加上一些注释,对我有用。注释掉您的函数调用,因为没有提供这些调用。
<View style = {[{zIndex: 2, backgroundColor: 'white'}]}>
<GooglePlacesAutocomplete
//ref = {ref => setSearchTextRef(ref)}
placeholder='Search for gym'
styles={{
container: {backgroundColor: 'transparent'},
//textInputContainer: styles.viewStyle,
//textInput: styles.textInputStyle,
}}
keyboardShouldPersistTaps = {'handled'}
listUnderlayColor = {'transparent'}
textInputProps = {{
//onFocus: () => focusInput(),
//onBlur: () => blurInput(),
//onChangeText: (text) => onChange(text)
}}
minLength={1} // minimum length of text to search
returnKeyType={'search'}
listViewDisplayed={'auto'} // true/false/undefined
fetchDetails={true}
renderDescription={row => row.description} // custom description render
onPress={(data, details = null) => {
let coordinates = details.geometry.location;
console.log(JSON.stringify(details)); //display details in console!
//sendCoordinates(coordinates, {data, details});
}}
getDefaultValue={() => ''}
query={{
key: 'YourKeyHere',
language: 'en', // language of the results
// types: '(cities)' // default: 'geocode'
}}
nearbyPlacesAPI='GooglePlacesSearch' // Which API to use: GoogleReverseGeocoding or GooglePlacesSearch
GooglePlacesSearchQuery={{
rankby: 'distance',
types: 'gym'
}}
filterReverseGeocodingByTypes={['locality', 'administrative_area_level_3']}
debounce={200}
/>
</View> 发布于 2022-10-25 06:54:49
这种情况发生在我身上,因为我在ScrollView中有这个控制。在keyboardShouldPersistTaps=上使用ScrollView“handled”似乎可以修复它
发布于 2020-03-06 14:22:22
此软件包不再维护,根本无法工作。我试过在IOS上用博览。我甚至没有得到结果的清单。我发现了另一个像魅力一样有效的包裹:
https://stackoverflow.com/questions/60187491
复制相似问题