googlemaps / googlemaps/react-native-navigation-sdk

[Bug]: mapPadding on Android requires raw pixels instead of density-independent points

Open
#541 2 comments 0 reactions 1 assignee Claimed by @illuminati1911 View on GitHub
priority: p3 type: bug
Dominant language
TypeScript
Stars
227
Forks
38
Avg merge
5d 7h
Merged PRs (30d)
10

Description

## Bug Description

The `mapPadding` prop on `NavigationView` behaves inconsistently across platforms. On iOS, it correctly accepts values in density-independent points (dp/pt), but on Android it appears to expect raw pixel values instead.

This forces consumers to manually multiply padding values by the device's pixel ratio on Android:

```tsx
const pixelRatio = Platform.OS === 'android' ? PixelRatio.get() : 1;
const mapPadding = {
bottom: Math.round(sheetHalfHeight * pixelRatio),
};

```

## Expected Behavior

`mapPadding` should accept density-independent points on both platforms, consistent with how all other React Native layout values work. The SDK should handle the dp-to-pixel conversion internally on Android, so consumers can simply write:

```tsx
const mapPadding = {
bottom: sheetHalfHeight,
};
```

## Current Behavior

On Android, passing dp values (e.g. from a React Native layout measurement) results in incorrect/too-small padding. You must manually multiply by `PixelRatio.get()` to get the correct result. On iOS, the same dp values work correctly without any conversion.

## Environment

- **SDK version**: 0.14.1
- **Platform**: Android (iOS works correctly)
- **React Native**: 0.76+

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.