react-native-google-places-autocomplete中的当前位置

问题描述 投票:0回答:1

选择当前位置后,api会获取位置,但是列表似乎没有填充/显示位置。但是,当选择它时,它会反转地理编码并在控制台中打印详细信息。

但是它没有设置为textInput。

不确定我缺少什么

This is how the screen looks like

代码看起来像这样

<GooglePlacesAutocomplete
  placeholder='Deliver To'
  minLength={2} // minimum length of text to search
  autoFocus={false}
  returnKeyType={'search'} // Can be left out for default return key https://facebook.github.io/react-native/docs/textinput.html#returnkeytype
  listViewDisplayed='auto'    // true/false/undefined
  fetchDetails={true}
  renderDescription={row => row.description || row.vicinity} // custom description render
  onPress={(data, details = null) => { // 'details' is provided when fetchDetails = true
    console.log(data, details);
  }}

  getDefaultValue={() => ''}

  query={{
    // available options: https://developers.google.com/places/web-service/autocomplete
    key: '',
    language: 'en', // language of the results
    types: 'geocode', // default: 'geocode'
    components: 'country:au',
  }}

  styles={{
    textInputContainer: {
      width: '100%',
      backgroundColor: 'rgba(0,0,0,0)',
      borderLeftWidth: 0.5,
      borderRightWidth: 0.5,

    },
    textInput: {
      fontFamily: "AvenirMedium",
      fontSize: 17,
      color: "#000",
      backgroundColor: 'rgba(0,0,0,0)',

    },
    description: {
      fontWeight: 'bold'
    },
    predefinedPlacesDescription: {
      color: '#1faadb'
    }
  }}

  currentLocation={true} // Will add a 'Current location' button at the top of the predefined places list
  currentLocationLabel="Current location"
  nearbyPlacesAPI={'GoogleReverseGeocoding'} // Which API to use: GoogleReverseGeocoding or GooglePlacesSearch
  GoogleReverseGeocodingQuery={{
    // available options for GoogleReverseGeocoding API : https://developers.google.com/maps/documentation/geocoding/intro
    key: '',
    language: 'en',
  }}
/>
react-native googleplacesautocomplete
1个回答
0
投票
© www.soinside.com 2019 - 2024. All rights reserved.