[英]How to get focus from click event of a text to googleplaces autocomplete input?
我正在嘗試開發一個應用程序,需要您的幫助。 因此,我使用 react native googleautoplaces complete 作為位置,顯示在第一個文本輸入中。
加載后的頁面根據我使用的地理編碼器和地理定位代碼獲取當前位置。
我需要的是,當我點擊“更改”鏈接時,它應該關注或 select 位置輸入。 頁面設計,谷歌自動完成代碼, code2 。
如果我使用 ref,我可以那樣做嗎? 如果是,如何添加多個 ref,因為自動完成中已經使用了另一個 ref。 自動完成內部使用的 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.