react-native-google-places-turbo
v0.1.1
Published
React Native Google Places Autocomplete native module using TurboModules with Swift (iOS) and Kotlin (Android). New Architecture and bridgeless ready.
Maintainers
Readme
React Native Google Places Autocomplete (Native, TurboModule)
react-native-google-places-turbo is a high-performance React Native Google Places Autocomplete library built using the official Google Places SDK for Android (Kotlin) and iOS (Swift).
It is designed for the React Native New Architecture and powered by TurboModules, providing native UI, fast performance, and a bridge-free experience.
Unlike JavaScript-based wrappers, this library directly uses Google’s native autocomplete UI for the most accurate and reliable place search results.
WHY react-native-google-places-turbo?
- ✅ Built with React Native New Architecture
- ✅ Uses TurboModules (no legacy bridge)
- ✅ Official Google Places SDK
- ✅ Native autocomplete UI on Android and iOS
- ✅ Written in Swift and Kotlin
- ✅ Lightweight with minimal JavaScript layer
- ✅ Ideal replacement for older Google Places libraries
If you are looking for a modern React Native Google Places Autocomplete library, this package is built for you.
FEATURES
- 🚀 Native performance using official SDKs
- ⚡ TurboModule support for faster execution
- 📱 Native Google autocomplete UI
- 📍 Accurate place search results
- 🌍 Country-based filtering support
- 🛠 Simple and clean JavaScript API
- 🔐 Secure API key handling
Demo
| Android | iOS | | ------------------------------------------------------- | ------------------------------------------------------- | | | |
INSTALLATION
Using npm:
npm install react-native-google-places-turboUsing yarn:
yarn add react-native-google-places-turboiOS Setup
Run pod install to install the native GoogleMaps/GooglePlaces dependencies:
cd ios && pod installAndroid Setup
No additional manual setup is usually required for Android as dependencies are automatically handled by Gradle.
Google Cloud Setup
- Go to the Google Cloud Console.
- Create a new project or select an existing one.
- Enable the Places API (New) for your project.
- Generate an API Key.
- (Optional but Recommended) Restrict your API key to your specific bundle ID (iOS) and package name (Android).
USAGE
Step 1: Initialize Google Places SDK
Call initialize once when your app starts.
Example (TypeScript / JavaScript):
import { initialize } from 'react-native-google-places-turbo';
initialize(
'YOUR_GOOGLE_PLACES_API_KEY',
(message) => console.log('Google Places initialized:', message),
(error) => console.error('Initialization error:', error)
);Step 2: Open Google Places Autocomplete Modal
import { openAutocompleteModal } from 'react-native-google-places-turbo';
const handleSearch = async () => {
try {
const place = await openAutocompleteModal({
countries: ['US', 'CA'],
});
console.log(place);
} catch (error) {
console.log('Autocomplete cancelled or failed', error);
}
};API Reference
Methods
initialize(key, onSuccess?, onError?)
Initializes the Native Google Places SDK.
| Parameter | Type | Required | Description |
| :---------- | :---------------------- | :------- | :------------------------------------- |
| key | string | Yes | Your Google Cloud API Key. |
| onSuccess | (msg: string) => void | No | Callback when initialization succeeds. |
| onError | (err: string) => void | No | Callback if initialization fails. |
openAutocompleteModal(options?)
Opens the full-screen native place picker modal.
| Parameter | Type | Required | Description |
| :-------- | :-------------------- | :------- | :-------------------------------- |
| options | AutocompleteOptions | No | Configuration object (see below). |
- Returns:
Promise<Place> - Rejects: If the user cancels the picker or an error occurs.
Types
AutocompleteOptions
type AutocompleteOptions = {
countries?: string[]; // Array of ISO 3166-1 Alpha-2 country codes (e.g. ["US", "IN"])
};Place
The object returned when a user selects a location.
type Place = {
name: string; // Name of the place (e.g., "Googleplex")
placeID: string; // Unique Google Place ID
coordinate: LatLng; // Geographic coordinates
address: string; // Formatted address
};LatLng
type LatLng = {
latitude: number;
longitude: number;
};Troubleshooting
- Crash on Open: Ensure you have enabled the "Places API" in Google Cloud Console, not just the Maps SDK.
- Key Error: Double check that your API Key has no restrictions that would block the current app's bundle ID / package name during development.
- iOS Build Failure: Make sure to run
pod installinside theiosdirectory and open the.xcworkspacefile, not.xcodeproj.
COMPARISON WITH OTHER LIBRARIES
| Feature | react-native-google-places-turbo | | :------------------- | :-------------------------------- | | Native UI | ✅ Yes | | TurboModule | ✅ Yes | | New Architecture | ✅ Yes | | Swift / Kotlin | ✅ Yes | | Bridge-free | ✅ Yes |
Most JavaScript-based Google Places libraries do not support these features.
CONTRIBUTING
Contributions are welcome. Please check CONTRIBUTING.md for development and contribution guidelines.
LICENSE
MIT License
Built using create-react-native-library by Callstack
