googlemaps / googlemaps/react-native-navigation-sdk

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

Aperta
#541 2 commenti 0 reazioni 1 assegnatario Rivendicata da @illuminati1911 Vedi su GitHub
priority: p3 type: bug
Lingua principale
TypeScript
Stelle
227
Fork
38
Merge medio
5g 7h
PR unite (30g)
10

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.