I’m using React Native with the react-native-google-places-autocomplete package to implement an address search input.
I want users to search for an address and auto-fill Address / City / State / Zip Code.
Here’s my current code:
onPlaceSelected(data, details)}
query={{
key: GOOGLE_API_KEY,
language: "en",
types: "geocode",
}}
fetchDetails={true}
onFail={(error) => console.error("Error searching location:", error)}
enablePoweredByContainer={false}
debounce={400}
/>
I enabled Places API (New) in Google Cloud Console.
My API key is valid and works in other contexts.
I’m using the latest version of
react-native-google-places-autocomplete.
But when I try to search, I get this error:
Error searching location: You’re calling a legacy API, which is not enabled for your project.
To get newer features and more functionality, switch to the Places API (New) or Routes API.
What I’ve tried:
Verified API key and billing are enabled
Updated the library to the latest version
Tried adding
useGoogleMapsPlatform={true}(not recognized by TypeScript)Is
react-native-google-places-autocompletecompatible with the new Places API?