简体   繁体   English

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

[英]How to get focus from click event of a text to googleplaces autocomplete input?

need your help for an app iam trying to develop.我正在尝试开发一个应用程序,需要您的帮助。 So I have used react native googleautoplaces complete for the location, which is shown in the first text input.因此,我使用 react native googleautoplaces complete 作为位置,显示在第一个文本输入中。

The page when loaded gets the current location based on geocoder, geolocation codes i have used.加载后的页面根据我使用的地理编码器和地理定位代码获取当前位置。

What i need is that, when i click on the 'change' link, it should focus or select the location input.我需要的是,当我点击“更改”链接时,它应该关注或 select 位置输入。 page design , code for google autocomplete , code2 .页面设计谷歌自动完成代码code2

If i use ref, can i do like that.如果我使用 ref,我可以那样做吗? If yes, how to add multiple ref, because already another ref is used in the autocomplete.如果是,如何添加多个 ref,因为自动完成中已经使用了另一个 ref。 ref method used inside autocomplete, which takes the address value.自动完成内部使用的 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(); }}
/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM