javascript - 如何将焦点从文本的点击事件转移到 googleplaces 自动完成输入?
问题描述
需要您对我正在尝试开发的应用程序的帮助。所以我使用了 react native googleautoplaces complete 作为位置,这在第一个文本输入中显示。
加载时的页面根据我使用的地理编码器和地理位置代码获取当前位置。
我需要的是,当我单击“更改”链接时,它应该聚焦或选择位置输入。页面设计,谷歌自动完成代码,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(); }}
/>
推荐阅读
- python - 正则表达式 findall python
- java - 如何在 RecyclerView 中选择多个项目并将它们放入 List
- html - CSS :before 出现 :after
- rest - 尝试创建超出最大限制的资源时,POST API 请求的适当 http 状态代码应该是什么
- spring - OnetoOne 双向映射不适用于 spring 和 hibernate
- hibernate - 线程“主”org.hibernate.MappingException 中的异常:
- django - 在 Django admin 中显示图像 - 多对多内联管理视图
- jenkins - 在 Jenkinsfile 中的远程主机上执行命令
- maven - 使用 mvnDebug 进行远程调试,不会在断点处停止
- php - PHP preg_split 正则表达式由给定的分隔符,而不是在 [] 之间