| 
 | 1 | +import { Steps, PackageManagerTabs } from '@theme';  | 
 | 2 | + | 
 | 3 | +# Installation  | 
 | 4 | + | 
 | 5 | +:::info Important  | 
 | 6 | +`react-native-gesture-image-viewer` is a high-performance viewer library built on [`react-native-reanimated`](https://www.npmjs.com/package/react-native-reanimated) and [`react-native-gesture-handler`](https://www.npmjs.com/package/react-native-gesture-handler).     | 
 | 7 | +Therefore, you **must install** React Native Reanimated and Gesture Handler before using this library. Please refer to the official documentation of these libraries for detailed setup guides.  | 
 | 8 | +:::  | 
 | 9 | + | 
 | 10 | +#### Minimum Requirements  | 
 | 11 | + | 
 | 12 | +|Library|Minimum Version|  | 
 | 13 | +|:--|:--:|  | 
 | 14 | +|`react`|`>=18.0.0`|  | 
 | 15 | +|`react-native`|`>=0.75.0`|  | 
 | 16 | +|`react-native-gesture-handler`|`>=2.24.0`|  | 
 | 17 | +|`react-native-reanimated`|`>=3.0.0`|  | 
 | 18 | + | 
 | 19 | +## [React Native Reanimated Setup](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/)  | 
 | 20 | + | 
 | 21 | +<PackageManagerTabs command="install react-native-reanimated" />  | 
 | 22 | + | 
 | 23 | +<Steps>  | 
 | 24 | + | 
 | 25 | +### Add the plugin to your `babel.config.js`:  | 
 | 26 | + | 
 | 27 | +```js title="babel.config.js"  | 
 | 28 | +module.exports = {  | 
 | 29 | +  presets: [  | 
 | 30 | +    ... // don't add it here :)  | 
 | 31 | +  ],  | 
 | 32 | +  plugins: [  | 
 | 33 | +    ...  | 
 | 34 | +    // for web  | 
 | 35 | +    '@babel/plugin-proposal-export-namespace-from', // [!code highlight]  | 
 | 36 | +    // react-native-reanimated/plugin has to be listed last.  | 
 | 37 | +    'react-native-reanimated/plugin', // [!code highlight]  | 
 | 38 | +  ],  | 
 | 39 | +};  | 
 | 40 | +```  | 
 | 41 | + | 
 | 42 | +### Wrap your Metro config with `wrapWithReanimatedMetroConfig` in `metro.config.js`:  | 
 | 43 | + | 
 | 44 | +```js title="metro.config.js"  | 
 | 45 | +// [!code highlight:3]  | 
 | 46 | +const {  | 
 | 47 | +  wrapWithReanimatedMetroConfig,  | 
 | 48 | +} = require('react-native-reanimated/metro-config');  | 
 | 49 | + | 
 | 50 | +const config = {  | 
 | 51 | +  // Your existing Metro configuration options  | 
 | 52 | +};  | 
 | 53 | + | 
 | 54 | +module.exports = wrapWithReanimatedMetroConfig(config); // [!code highlight]  | 
 | 55 | +```  | 
 | 56 | + | 
 | 57 | +</Steps>  | 
 | 58 | + | 
 | 59 | +## [React Native Gesture Handler Setup](https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation)  | 
 | 60 | + | 
 | 61 | +<PackageManagerTabs command="install react-native-gesture-handler" />  | 
 | 62 | + | 
 | 63 | +- `react-native-gesture-handler` generally doesn't require additional setup, but please refer to the official documentation for your specific environment.  | 
 | 64 | +- For [using gestures in Android modals](https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation#android), you would normally need to wrap modal content with `GestureHandlerRootView`. However, **this library already includes `GestureHandlerRootView` internally, so no additional wrapping is needed when using modals.**  | 
 | 65 | + | 
 | 66 | +## Install React Native Gesture Image Viewer  | 
 | 67 | + | 
 | 68 | +You’re all set! 🎉     | 
 | 69 | +Start by installing `react-native-gesture-image-viewer`  | 
 | 70 | + | 
 | 71 | +<PackageManagerTabs command="install react-native-gesture-image-viewer" />  | 
0 commit comments