为什么 GooglePlacesAutocomplete 可以在 iOS 上运行,而不能在 Android 上运行?

问题描述

我正在使用 React Native 和 Expo 进行开发,并且我安装了 google-places-autocomplete。我插入了以下代码,它在 iOS 上运行良好,但它甚至没有出现在 Android 上。另外,在 Android 上,会弹出两个错误,说“在 Android 上设置一个长时间(即几分钟)的计时器是性能和正确性问题,因为它使计时器模块保持唤醒状态,并且计时器只能在应用程序启动时调用前台”和“无效索引 1,大小为 0”,当我禁用自动完成功能时,两个错误都会消失。我应该怎么做才能修复它?

<GooglePlacesAutocomplete  
    placeholder="Buscar"
    query={{
      key: "API_KEY",language: 'es-419',}}
    fetchDetails={true}
    onPress={(data,details = null) => location_query(details.geometry.location.lat,details.geometry.location.lng )}
    onFail={(error) => console.error(error)}
    styles={{
      textInput: {
        backgroundColor: 'white',marginTop: 10,marginLeft: 15,marginRight: 15,},}}
    requestUrl={{
      url:
        'https://cors-anywhere.herokuapp.com/https://maps.googleapis.com/maps/api',uSEOnPlatform: 'web',}}
  />

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)