A modern, feature-rich React Native mobile application built with Expo that provides Google Maps Places search functionality with real-time autocomplete, interactive map display, and persistent search history.
- π Real-time Place Search: Google Places API autocomplete with instant suggestions
- πΊοΈ Interactive Map: Google Maps integration with custom markers and location display
- π Place Details: Comprehensive place information including ratings, photos, and addresses
- π± Search History: Persistent storage of searched places with AsyncStorage
- π Location Services: Current location detection and map navigation
- π Dark Mode: Full dark/light theme support
- β‘ Performance Optimized: Debounced search, efficient state management
- π¨ Modern UI: Clean gradient design with smooth animations
- π± Mobile-First: Responsive design optimized for mobile devices
- βΏ Accessibility: Proper safe area handling for iOS/Android status bars
- π Navigation: Tab-based navigation between Search and History screens
The app features a clean, modern interface with:
- Search overlay with real-time suggestions
- Interactive Google Maps with place markers
- History management with ratings and details
- Responsive design for all screen sizes
- Framework: React Native with Expo SDK 53
- Language: TypeScript
- State Management: Zustand
- Maps: react-native-maps with Google Maps
- Storage: AsyncStorage for persistence
- Styling: React Native StyleSheet with gradient support
- API: Google Places API (Autocomplete & Place Details)
Before running this application, ensure you have:
- Node.js (v16 or higher)
- npm or yarn
- Expo CLI:
npm install -g @expo/cli - Google Cloud Console Account with API access
- Mobile device or emulator for testing
git clone <repository-url>
cd places-search
npm install- Go to Google Cloud Console
- Create a new project or select existing one
- Enable the following APIs:
- Places API (New)
- Places API
- Maps SDK for Android
- Maps SDK for iOS
- Go to Credentials
- Click "Create Credentials" β "API Key"
- Copy the generated API key
For Android:
- Edit your API key
- Under "Application restrictions" β Select "Android apps"
- Add your package name:
com.yourcompany.placessearch - Add SHA-1 certificate fingerprint (get from Expo)
For iOS:
- Edit your API key
- Under "Application restrictions" β Select "iOS apps"
- Add your bundle identifier:
com.yourcompany.placessearch
{
"expo": {
"ios": {
"config": {
"googleMapsApiKey": "YOUR_GOOGLE_MAPS_API_KEY_HERE"
}
},
"android": {
"config": {
"googleMaps": {
"apiKey": "YOUR_GOOGLE_MAPS_API_KEY_HERE"
}
}
}
}
}const GOOGLE_PLACES_API_KEY = 'YOUR_GOOGLE_MAPS_API_KEY_HERE';# Start the development server
npx expo start
# For specific platforms
npx expo start --ios
npx expo start --androidplaces-search/
βββ app/ # App Router screens
β βββ (tabs)/
β β βββ index.tsx # Main search screen
β β βββ explore.tsx # History screen
β β βββ _layout.tsx # Tab navigation layout
β βββ _layout.tsx # Root layout
β βββ +not-found.tsx # 404 screen
βββ components/ # Reusable components
β βββ MapView.tsx # Google Maps component
β βββ PlaceSearchSimple.tsx # Search with autocomplete
β βββ SearchHistory.tsx # History management
β βββ ThemedText.tsx # Themed text component
β βββ ThemedView.tsx # Themed view component
β βββ HapticTab.tsx # Tab with haptic feedback
β βββ ui/ # UI components
β βββ IconSymbol.tsx # Icon component
β βββ TabBarBackground.tsx # Tab bar styling
βββ services/ # API services
β βββ googlePlacesAPI.ts # Google Places API client
βββ store/ # State management
β βββ placesStore.ts # Zustand store
βββ hooks/ # Custom hooks
β βββ useColorScheme.ts # Theme detection
β βββ useThemeColor.ts # Theme colors
βββ constants/ # App constants
β βββ Colors.ts # Color definitions
βββ assets/ # Static assets
βββ images/ # App icons and images
βββ fonts/ # Custom fonts
- Google Maps integration with react-native-maps
- Custom markers for selected places
- User location display
- Dark mode map styling
- Smooth animations and gestures
- Real-time autocomplete search
- Debounced API calls for performance
- Smart suggestion filtering
- Clean, accessible UI design
- Persistent storage with AsyncStorage
- Place ratings and details display
- Clear history functionality
- Empty state handling
- Centralized state management
- Place selection and history
- Map region control
- Async storage integration
// Get place suggestions
const suggestions = await GooglePlacesAPI.autocomplete(query);// Get detailed place information
const placeDetails = await GooglePlacesAPI.getPlaceDetails(placeId);// Search for nearby places
const nearbyPlaces = await GooglePlacesAPI.searchNearby(lat, lng, radius);The app supports automatic dark/light mode switching based on system preferences:
- Light Mode: Clean whites and blues
- Dark Mode: Dark grays with blue accents
- Gradients: Modern gradient backgrounds
- Typography: Consistent font weights and sizes
- Spacing: Standardized margins and padding
- iOS: Full support with native Maps integration
- Android: Google Maps with custom styling
- Expo Go: Development testing support
- Production: Ready for App Store/Play Store deployment
- Debounced Search: 300ms delay to reduce API calls
- Smart Caching: Prevents duplicate API requests
- Efficient Rendering: Optimized FlatList components
- Memory Management: Proper cleanup of timers and listeners
- Bundle Optimization: Tree-shaking and code splitting
- Verify API key is correct in both
app.jsonandgooglePlacesAPI.ts - Ensure Maps SDK is enabled in Google Cloud Console
- Check API key restrictions match your app's bundle ID
- Clear Expo cache:
npx expo start --clear
- Verify Places API is enabled in Google Cloud Console
- Check API key has Places API permissions
- Monitor console logs for API errors
- Ensure network connectivity
- Check device location services are enabled
- Grant location permission when prompted
- Test on physical device (not simulator)
Enable detailed logging by checking console output:
β
Autocomplete: Found 5 suggestions for "restaurant"
β
Place Details: Found "Restaurant Name" at Address
This project is licensed under the MIT License - see the LICENSE file for details.
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
For support and questions:
- Create an issue in the repository
- Check the troubleshooting section above
- Review Google Places API documentation
- Google Places API for location data
- React Native Maps community
- Expo team for the excellent development platform
- Zustand for simple state management