// Dynamic config layered over app.json. // // react-native-maps reads the Google Maps key from the *native* manifest // (AndroidManifest `com.google.android.geo.API_KEY`), not from the JS bundle, // so EXPO_PUBLIC_GOOGLE_API_KEY has to be injected here at build time. Without // it Android renders an empty grey tile area instead of a map. const googleMapsApiKey = process.env.EXPO_PUBLIC_GOOGLE_API_KEY; const LOCATION_PERMISSION = "Waseel uses your location to show nearby drivers and set your pickup point."; module.exports = ({ config }) => { if (!googleMapsApiKey) { console.warn( "[app.config] EXPO_PUBLIC_GOOGLE_API_KEY is not set — maps will render blank on Android.", ); } return { ...config, ios: { ...config.ios, // iOS uses Apple Maps via PROVIDER_DEFAULT, so this only matters if the // Map component is switched to PROVIDER_GOOGLE. config: { ...config.ios?.config, googleMapsApiKey }, infoPlist: { ...config.ios?.infoPlist, NSLocationWhenInUseUsageDescription: LOCATION_PERMISSION, }, }, android: { ...config.android, config: { ...config.android?.config, googleMaps: { apiKey: googleMapsApiKey }, }, // Location permissions come from the expo-location plugin below. }, plugins: [ ...(config.plugins ?? []), [ "expo-location", { locationAlwaysAndWhenInUsePermission: LOCATION_PERMISSION, locationWhenInUsePermission: LOCATION_PERMISSION, }, ], ], }; };