如何从文本的点击事件到googleplaces的自动完成输入获得焦点?



需要你的帮助,我正在开发一个应用程序。因此,我使用了react native googleautoplaces complete作为位置,它显示在第一个文本输入中。

加载时的页面根据地理编码器获得当前位置,我使用的地理位置代码。

我需要的是,当我点击'更改'链接,它应该集中或选择的位置输入。网页设计,谷歌自动完成代码,code2.

如果我使用ref,我可以这样做吗?如果是,如何添加多个ref,因为已经在自动完成中使用了另一个ref。autocomplete内部使用的Ref方法,它接受地址值。

<GooglePlacesAutocomplete 
...
ref={(ref) => { this.ref_location = ref }
//your element where the "Change" is being pressed. I used a button just as an example
<Button
title="Change"
onPress={() => { this.ref_location.focus(); }}
/>

最新更新