openspacelabs / react-native-zoomable-view

A view component for react-native with pinch to zoom, tap to move and double tap to zoom capability.
MIT License
205 stars 57 forks source link

`maxZoom?: number` instead of `maxZoom?: number | null` #109

Open Volper212 opened 1 month ago

Volper212 commented 1 month ago

In the docs it says that maxZoom can be null for infinite scaling. However, the type of maxZoom when one hovers over it is number | undefined, not number | null | undefined.

(property) maxZoom?: number | undefined
elliottkember commented 1 month ago

I think the docs just need updating, then. Sounds as though it used to take null but no longer requires the prop. Would you mind making a PR for this change?

Volper212 commented 1 month ago

null actually works as the docs say (it just does not pass the type check with TypeScript's strict mode): https://github.com/openspacelabs/react-native-zoomable-view/blob/34342f0cd99096d9689305db0e26731ebafdf7e2/src/ReactNativeZoomableView.tsx#L604

So not the docs but the types need to be updated. Alternatively, one could get rid the option of passing null altogether and just use maxZoom={Infinity} for infinite zoom. There are two options then.