
Security News
How Enterprise Security Is Adapting to AI-Accelerated Threats
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.
react-native-reanimated-zoomable
Advanced tools
[React Native | TypeScript | Reanimated] Pure TS component that offers zooming and dragging functionalities for its child components. It seamlessly operates on both Android and iOS platforms.
This Pure TypeScript component offers optimized performance and full customization capabilities, allowing for zooming and dragging functionalities for its child components. 🚀 It seamlessly operates on both Android and iOS platforms. 📱
npm install react-native-reanimated-zoomable
yarn add react-native-reanimated-zoomable
shouldCenterAfterThreshold is true and disableOvershooting is true
shouldCenterAfterThreshold is false and disableOvershooting is false
| Name | version |
|---|---|
react-native-reanimated | >= 2.0.0 |
ZoomableRef: An interface defining the methods available on the ref for controlling the zoomable view.ZoomableProps: A set of props that can be passed to the Zoomable component. 📝react-native-reanimated-zoomable exposes a ref that allows you to programmatically control the zooming and dragging behavior of the view.
setValues(values: { scale?: number, translate?: { x: number, y: number } }): void
Sets the scale and translation values of the view.
scale: (Optional) New scale value for the view.translate: (Optional) New translation values (x, y) for the view. 🖼️import { Zoomable, ZoomableRef } from 'react-native-reanimated-zoomable';
import { View, Text, Button } from 'react-native';
import React, { createRef } from 'react';
const zoomableRef = createRef<ZoomableRef>();
const INITIAL_ZOOM = 1; // Initial zoom scale value
export const setToInitialZoomableSetup = () => {
zoomableRef.current?.setValues({ scale: INITIAL_ZOOM, translate: { x: 0, y: 0 } });
};
const App = () => {
const handleResetZoom = () => {
setToInitialZoomableSetup();
};
return (
<View style={{ flex: 1, padding: 10 }}>
<Zoomable
ref={zoomableRef}
style={{ flex: 1, justifyContent: "center", alignItems: "center" }}
disablePanResponderReleaseAction={false}
threshold={300}
shouldCenterAfterThreshold
disableOvershooting
initialScale={INITIAL_ZOOM}
maxScale={4}
>
<Image
source={{ uri: "https://picsum.photos/id/2/1000/1000" }}
style={{ height: 400, width: 400 }}
/>
</Zoomable>
<Button title="Reset Zoom" onPress={handleResetZoom} />
</View>
);
};
export default App;
| Name | Description | Type | Default Value |
|---|---|---|---|
ref | A reference to the Zoomable component instance. This reference allows you to programmatically control the zooming and dragging behavior of the view. Using this reference, you can call methods such as setValues() to update the scale and translation of the view dynamically. | React.Ref<ZoomableRef> | { } |
style | Style object for the container view. | ViewStyle | { } |
initialScale | Initial scale value for the view. | number | 1 |
maxScale | Maximum allowed scale for the view. | number | initialScale * 2 |
disablePanResponderReleaseAction | The disablePanResponderReleaseAction prop determines whether certain actions should be taken when the user releases a panning gesture. | boolean | false |
threshold | The threshold here represents a numeric value that defines a limit for how far the user can pan the view before triggering a specific action. Threshold functionality won't be active if disablePanResponderReleaseAction is set to true.If shouldCenterAfterThreshold is set to false (default) and a user attempts to pan the view beyond the specified threshold, it will spring back to the threshold position. However, if shouldCenterAfterThreshold is set to true, the view will instead center itself. | number | 300 |
shouldCenterAfterThreshold | The shouldCenterAfterThreshold prop determines whether the view should automatically center itself after the user exceeds the specified threshold while panning. | boolean | false |
disableOvershooting | The disableOvershooting prop controls whether the view should exhibit an overshooting effect when the user releases a panning gesture. When disableOvershooting is set to true, the view will not display any overshooting animation after the user releases a panning gesture. This means that the view will come to an immediate stop at the exact point where the user lifts their finger or releases the gesture. | boolean | false |
disabled | The disabled prop is used to control whether the zooming and panning functionality of a component is enabled or disabled. | boolean | false |
This error usually occurs when you have installed different versions of Reanimated in your project.
Modify your package.json file to ensure only one version of Reanimated is used:
"resolutions": {
"react-native-reanimated": "<Reanimated version>"
}
"overrides": {
"react-native-reanimated": "<Reanimated version>"
}
After updating your package.json, make sure to run your package manager again:
yarn install
npm install
Contributions are welcome! If you have any suggestions, feature requests, or bug reports, feel free to open an issue or submit a pull request. Let's make this component even better together! 😃
MIT
Made with create-react-native-library
FAQs
[React Native | TypeScript | Reanimated] Pure TS component that offers zooming and dragging functionalities for its child components. It seamlessly operates on both Android and iOS platforms.
We found that react-native-reanimated-zoomable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.