googlemaps / googlemaps/react-native-navigation-sdk

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

Offen
#541 2 Kommentare 0 Reaktionen 1 zugewiesene Person Beansprucht von @illuminati1911 Auf GitHub ansehen
priority: p3 type: bug
Vorherrschende Sprache
TypeScript
Sterne
227
Forks
38
Ø Merge
5 T. 7 Std.
Gemergte PRs (30 T.)
10

Beschreibung

## 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+

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.