Use ReactNativeZoomableView as a drop-in replacement for a standard View. It allows you to wrap content (like text or images) to enable zooming and panning.
Note on Content Dimensions: When using images or content with intrinsic sizes, it is recommended to provide contentWidth and contentHeight props. These should represent the dimensions of the content as it is rendered naturally (the layout size), not its intrinsic pixel size, so the component can correctly apply boundaries.
import { ReactNativeZoomableView } from '@openspacelabs/react-native-zoomable-view';
<ReactNativeZoomableView
maxZoom={1.5}
minZoom={0.5}
zoomStep={0.5}
initialZoom={1}
onZoomEnd={logOutZoomState}
style={{
padding: 10,
backgroundColor: 'red',
}}
>
<Text>This is the content</Text>
</ReactNativeZoomableView>