The Android map never drew because mapType was "mutedStandard", an Apple Maps value. Android's MapManager looks the name up in a fixed table and unboxes the result into an int, so an unrecognised value threw a NullPointerException in the native view manager before any tile rendered. Android now gets "standard" plus a customMapStyle that mutes POI and transit labels, since showsPointsOfInterest is iOS-only too. Location hung indefinitely: getCurrentPositionAsync was called with no accuracy and no timeout, so it waited for a GPS fix that never arrives indoors or on an emulator with no mock location. useUserLocation now takes a cached fix first for an immediate render, caps the precise reading at 15 seconds, and checks device location services separately from app permission. Reverse geocoding moved off the critical path so a failed lookup costs the address label rather than the coordinates. The single boolean became five states, each with its own notice and either a retry or a settings shortcut, since retrying a hard denial does nothing. Map also no longer deletes itself when the driver fetch fails or the location is still pending: drivers are an overlay, and calculateRegion already falls back to Beirut. Adds a four-tile service selector above Recent Rides - Car, Moto, Courier, My Car - with the choice held in useServiceStore for the booking flow to read. English only for now; the intended Arabic names are recorded in constants/services.ts for the language pass. Selection styling matches the role picker on sign-up so the two read as one control. app.config.js layers the Google Maps key and expo-location permission strings onto app.json. No effect under Expo Go, which ignores native config, but required for the first EAS build. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
52 lines
1.5 KiB
JavaScript
52 lines
1.5 KiB
JavaScript
// 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,
|
|
},
|
|
],
|
|
],
|
|
};
|
|
};
|