reactjs - 谷歌地方自动完成根本没有设置状态,也没有在控制台上显示它
问题描述
当我在另一个空白屏幕上尝试它时它可以工作但它不能在这个屏幕上工作?
但我必须在这个屏幕上
我在设置状态后尝试了条件渲染,但它不起作用
const renderAutocomplete = () => {
return (
<View
style={{
flex: 1,
}}
>
<GooglePlacesAutocomplete
placeholder="Search..."
onPress={(data, details = null) => {
// 'details' is provided when fetchDetails = true
setLocationToSet(data.description);
console.warn(data.description);
}}
query={{
key: `AIzaSyAP6ZeQjc`,
language: "uz",
}}
styles={{
textInput: {
marginVertical: SIZES.mr,
borderColor: COLORS.main,
backgroundColor: COLORS.bg2,
borderRadius: SIZES.br,
...FONTS.normal,
...FONTS.small,
},
}}
renderRow={(item) => <AutocompleteRow item={item} />}
/>
</View>
);
};
解决方案
推荐阅读
- r - R 中的 stemDocument 过多地减少了一些单词。如何为此进行调整?
- node.js - 带有 .validate() 的摩卡测试模式不返回
- java - 如何使用 Java Beans 和 jsp 标签在 Postgres 数据库中插入数据?
- arrays - 如何从 Java 8 中的 3 维数组中获取 Stream?
- javascript - Javascript中回溯的递归函数
- node.js - NginX : 为 Node API 提供静态内容和代理传递
- javascript - Java 脚本添加事件监听器
- css - CSS Only Accordion 适用于 Chrome 但不适用于 Safari
- python - 未调用 post_delete
- reactjs - 在 POST 返回响应之前防止点击正文