react-native-gesture-image-viewer 1.6.1 → 2.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,478 +2,85 @@
2
2
 
3
3
  > English | [한국어](./README-ko_kr.md)
4
4
 
5
+ <div align="center">
6
+ <img src="./assets/logo.png" width="300px" alt="React Native Gesture Image Viewer logo" />
7
+ </div>
8
+
5
9
  ## Overview
6
10
 
7
11
  Have you ever struggled with implementing complex gesture handling and animations when building image galleries or content viewers in React Native?
8
12
 
9
13
  Existing libraries often have limited customization options or performance issues. `react-native-gesture-image-viewer` is a high-performance **universal gesture viewer** library built on React Native Reanimated and Gesture Handler, providing complete customization and intuitive gesture support for not only images but also videos, custom components, and any other content.
10
14
 
11
- ### Key Features
12
-
13
- - ✅ **Complete Gesture Support** - Pinch zoom, double-tap zoom, swipe navigation, vertical drag dismiss
14
- - ✅ **High-Performance Animations** - Smooth 60fps animations powered by React Native Reanimated
15
- - ✅ **Full Customization** - Complete control over components, styles, and behaviors
16
- - ✅ **External Control API** - Programmatic control from buttons or other components
17
- - ✅ **Multi-Instance Management** - ID-based independent management of multiple viewers
18
- - ✅ **Flexible Integration** - Use with Modal, [React Native Modal](https://www.npmjs.com/package/react-native-modal), ScrollView, FlatList, [FlashList](https://www.npmjs.com/package/@shopify/flash-list), [Expo Image](https://www.npmjs.com/package/expo-image), [FastImage](https://github.com/DylanVann/react-native-fast-image), and more
19
- - ✅ **Full TypeScript Support** - Enhanced developer experience with smart type inference
20
- - ✅ **Cross-Platform** - iOS, Android, and Web support
21
- - ✅ **Easy-to-Use API** - Intuitive and simple implementation without complex setup
22
- - ✅ **Various Environment Support** - Expo Go and New Architecture support
23
-
24
- ## Quick Start
25
-
26
- ### Examples & Demo
27
- - [📁 Example Project](/example/) - Real implementation code with various use cases
28
- - [🤖 Expo Go](https://snack.expo.dev/@harang/react-native-gesture-image-viewer) - Try it instantly on Snack Expo
29
-
30
15
  <p align="center">
31
- <img src="./assets/example.gif" width="600" />
16
+ <img src="./assets/example.gif" width="600" alt="Gesture and zoom demo" />
32
17
  </p>
33
18
 
34
- ### Prerequisites
35
-
36
- > [!IMPORTANT]
37
- > `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).
38
- > 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.
39
-
40
- ```bash
41
- npm install react-native-reanimated
42
- npm install react-native-gesture-handler
43
- ```
44
-
45
- #### Minimum Requirements
46
-
47
- |Library|Minimum Version|
48
- |:--|:--:|
49
- |`react`|`>=18.0.0`|
50
- |`react-native`|`>=0.75.0`|
51
- |`react-native-gesture-handler`|`>=2.24.0`|
52
- |`react-native-reanimated`|`>=3.0.0`|
53
-
54
- #### [React Native Reanimated Setup](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/getting-started/)
55
-
56
- Add the plugin to your `babel.config.js`:
57
-
58
- ```js
59
- // babel.config.js
60
- module.exports = {
61
- presets: [
62
- ... // don't add it here :)
63
- ],
64
- plugins: [
65
- ...
66
- // for web
67
- '@babel/plugin-proposal-export-namespace-from',
68
- // react-native-reanimated/plugin has to be listed last.
69
- 'react-native-reanimated/plugin',
70
- ],
71
- };
72
- ```
73
-
74
- Wrap your Metro config with `wrapWithReanimatedMetroConfig` in `metro.config.js`:
75
-
76
- ```js
77
- const {
78
- wrapWithReanimatedMetroConfig,
79
- } = require('react-native-reanimated/metro-config');
80
-
81
- const config = {
82
- // Your existing Metro configuration options
83
- };
84
-
85
- module.exports = wrapWithReanimatedMetroConfig(config);
86
- ```
87
-
88
- #### [react-native-gesture-handler Setup](https://docs.swmansion.com/react-native-gesture-handler/docs/fundamentals/installation)
89
-
90
- - `react-native-gesture-handler` generally doesn't require additional setup, but please refer to the official documentation for your specific environment.
91
- - 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.
19
+ ### Key Features
92
20
 
93
- ### Installation
21
+ - 🤌 **Complete Gesture Support** - Pinch zoom, double-tap zoom, swipe navigation, pan when zoomed-in, and vertical drag to dismiss
22
+ - 🏎️ **High-Performance Animations** - Smooth and responsive animations at 60fps and beyond, powered by React Native Reanimated
23
+ - 🎨 **Full Customization** - Total control over components, styles, and gesture behavior
24
+ - 🎛️ **External Control API** - Trigger actions programmatically from buttons or other UI components
25
+ - 🧩 **Multi-Instance Management** - Manage multiple viewers independently using unique IDs
26
+ - 🧬 **Flexible Integration** - Use with Modal, [React Native Modal](https://www.npmjs.com/package/react-native-modal), ScrollView, FlatList, [FlashList](https://www.npmjs.com/package/@shopify/flash-list), [Expo Image](https://www.npmjs.com/package/expo-image), [FastImage](https://github.com/DylanVann/react-native-fast-image), and more
27
+ - 🧠 **Full TypeScript Support** - Great developer experience with type inference and safety
28
+ - 🌐 **Cross-Platform** - Runs on iOS, Android, and Web with Expo Go and New Architecture compatibility
29
+ - 🪄 **Easy-to-Use API** - Simple and intuitive API that requires minimal setup
94
30
 
95
- ```bash
96
- # npm
97
- npm install react-native-gesture-image-viewer
31
+ ## Quick Start
98
32
 
99
- # pnpm
100
- pnpm add react-native-gesture-image-viewer
33
+ ### 📚 Documentation
101
34
 
102
- # yarn
103
- yarn add react-native-gesture-image-viewer
35
+ Full documentation is available at: <https://react-native-gesture-image-viewer.pages.dev>
104
36
 
105
- # bun
106
- bun add react-native-gesture-image-viewer
107
- ```
37
+ ### Examples & Demo
108
38
 
109
- ## Usage
39
+ - [📁 Example Project](/example/) - Real implementation code with various use cases
40
+ - [🤖 Expo Go](https://snack.expo.dev/@harang/react-native-gesture-image-viewer) - Try it instantly on Snack Expo
110
41
 
111
42
  ### Basic Usage
112
43
 
113
44
  `react-native-gesture-image-viewer` is a library focused purely on gesture interactions for complete customization.
114
- You can create a viewer using any `Modal` of your choice as shown below:
115
45
 
116
46
  ```tsx
117
- import { FlatList, Image, Modal } from 'react-native';
118
- import { GestureViewer } from 'react-native-gesture-image-viewer';
47
+ import { useCallback, useState } from 'react';
48
+ import { ScrollView, Image, Modal, View, Text, Button } from 'react-native';
49
+ import { GestureViewer, useGestureViewerController, useGestureViewerEvent } from 'react-native-gesture-image-viewer';
119
50
 
120
51
  function App() {
121
52
  const images = [...];
122
53
  const [visible, setVisible] = useState(false);
123
54
 
124
- // Wrap with useCallback for performance optimization
55
+ const { goToIndex, goToPrevious, goToNext, currentIndex, totalCount } = useGestureViewerController();
56
+
125
57
  const renderImage = useCallback((imageUrl: string) => {
126
58
  return <Image source={{ uri: imageUrl }} style={{ width: '100%', height: '100%' }} resizeMode="contain" />;
127
59
  }, []);
128
60
 
61
+ useGestureViewerEvent('zoomChange', (data) => {
62
+ console.log(`Zoom changed from ${data.previousScale} to ${data.scale}`);
63
+ });
64
+
129
65
  return (
130
66
  <Modal visible={visible} onRequestClose={() => setVisible(false)}>
131
67
  <GestureViewer
132
68
  data={images}
133
69
  renderItem={renderImage}
134
- ListComponent={FlatList}
70
+ ListComponent={ScrollView}
135
71
  onDismiss={() => setVisible(false)}
136
72
  />
137
- </Modal>
138
- );
139
- }
140
- ```
141
-
142
- ### Gesture Features
143
-
144
- `react-native-gesture-image-viewer` supports various gestures essential for viewers. All gestures are enabled by default.
145
-
146
- ```tsx
147
- function App() {
148
- return (
149
- <GestureViewer
150
- data={images}
151
- renderItem={renderImage}
152
- enableLoop={false}
153
- enableDismissGesture
154
- enableSwipeGesture
155
- enableZoomGesture
156
- enableDoubleTapGesture
157
- enableZoomPanGesture
158
- />
159
- )
160
- }
161
- ```
162
-
163
- |Property|Description|Default|
164
- |:--:|:-----|:--:|
165
- |`enableLoop`|Enables loop mode. When `true`, navigating next from the last item goes to the first item, and navigating previous from the first item goes to the last item.|`false`|
166
- |`enableDismissGesture`|Calls `onDismiss` function when swiping down. Useful for closing modals with downward swipe gestures.|`true`|
167
- |`enableSwipeGesture`|Controls left/right swipe gestures. When `false`, horizontal gestures are disabled.|`true`|
168
- |`enableZoomGesture`|Controls two-finger pinch gestures with focal point zooming. When `false`, pinch zoom is disabled. Zoom centers on the point between your two fingers for intuitive scaling.|`true`|
169
- |`enableDoubleTapGesture`|Controls double-tap zoom gestures with precision targeting. When `false`, double-tap zoom is disabled. Zoom centers exactly on the tapped location.|`true`|
170
- |`enableZoomPanGesture`|Enables panning when zoomed in with automatic boundary detection. When `false`, movement is disabled during zoom. Prevents content from moving outside visible screen area.|`true`|
171
-
172
- ### Custom Components
173
-
174
- `react-native-gesture-image-viewer` offers powerful complete component customization. You can create gesture-supported items with not only images but any component you want.
175
-
176
- #### List Components
177
-
178
- Support for any list component like `ScrollView`, `FlatList`, `FlashList` through the `ListComponent` prop.
179
- The `listProps` provides **type inference based on the selected list component**, ensuring accurate autocompletion and type safety in your IDE.
180
-
181
- ```tsx
182
- import { FlashList } from '@shopify/flash-list';
183
-
184
- function App() {
185
- return (
186
- <GestureViewer
187
- data={images}
188
- ListComponent={FlashList}
189
- listProps={{
190
- // ✅ FlashList props autocompletion
191
- }}
192
- />
193
- );
194
- }
195
- ```
196
-
197
- #### Content Components
198
-
199
- You can inject various types of content components like `expo-image`, `FastImage`, etc., through the `renderItem` prop to use gestures.
200
-
201
- ```tsx
202
- import { GestureViewer } from 'react-native-gesture-image-viewer';
203
- import { Image } from 'expo-image';
204
-
205
- function App() {
206
- const renderImage = useCallback((imageUrl: string) => {
207
- return <Image source={{ uri: imageUrl }} style={{ width: '100%', height: '100%' }} contentFit="contain" />;
208
- }, []);
209
-
210
- return (
211
- <GestureViewer
212
- data={images}
213
- renderItem={renderImage}
214
- />
215
- );
216
- }
217
- ```
218
-
219
- ### useGestureViewerController
220
-
221
- You can programmatically control the `GestureViewer` using the `useGestureViewerController` hook.
222
-
223
- ```tsx
224
- import { GestureViewer, useGestureViewerController } from 'react-native-gesture-image-viewer';
225
-
226
- function App() {
227
- const {
228
- goToIndex,
229
- goToPrevious,
230
- goToNext,
231
- currentIndex,
232
- totalCount,
233
- zoomIn,
234
- zoomOut,
235
- resetZoom,
236
- rotate
237
- } = useGestureViewerController();
238
-
239
- return (
240
- <View>
241
- <GestureViewer
242
- data={images}
243
- renderItem={renderImage}
244
- />
245
- {/* Zoom Controls */}
246
- <View>
247
- <Feather.Button name="zoom-in" onPress={() => zoomIn(0.25)} />
248
- <Feather.Button name="zoom-out" onPress={() => zoomOut(0.25)} />
249
- <Feather.Button
250
- name="refresh-cw"
251
- onPress={() => {
252
- rotate(0);
253
- resetZoom();
254
- }}
255
- />
256
- <Feather.Button name="rotate-cw" onPress={() => rotate(90)} />
257
- <Feather.Button name="rotate-ccw" onPress={() => rotate(90, false)} />
258
- </View>
259
- {/* Navigation Controls */}
260
73
  <View>
261
- <Feather.Button name="chevron-left" onPress={goToPrevious} />
74
+ <Button title="<" onPress={goToPrevious} />
262
75
  <Button title="Jump to index 2" onPress={() => goToIndex(2)} />
263
- <Feather.Button name="chevron-right" onPress={goToNext} />
76
+ <Button title=">" onPress={goToNext} />
264
77
  <Text>{`${currentIndex + 1} / ${totalCount}`}</Text>
265
78
  </View>
266
- </View>
267
- );
268
- }
269
- ```
270
-
271
- #### API Reference
272
-
273
- | Property | Description | Type | Default |
274
- |:---------|:------------|:-----|:-------:|
275
- | `goToIndex` | Navigate to a specific index. | `(index: number) => void` | - |
276
- | `goToPrevious` | Navigate to the previous item. | `() => void` | - |
277
- | `goToNext` | Navigate to the next item. | `() => void` | - |
278
- | `currentIndex` | The index of the currently displayed item. | `number` | `0` |
279
- | `totalCount` | The total number of items. | `number` | `0` |
280
- | `zoomIn` | Zoom in by the specified multiplier. | `(multiplier?: number) => void` | `0.25` |
281
- | `zoomOut` | Zoom out by the specified multiplier. | `(multiplier?: number) => void` | `0.25` |
282
- | `resetZoom` | Reset zoom to the specified scale. | `(scale?: number) => void` | `1` |
283
- | `rotate` | Rotate by the specified angle. | `(angle?: number, clockwise?: boolean) => void` | `90, true` |
284
-
285
- #### Parameters
286
-
287
- - `zoomIn(multiplier?)`
288
- - **multiplier**: The multiplier for zooming in (range: `0.01 ~ 1`)
289
- - Example: `zoomIn(0.5)` → Zoom in by an additional 50% of the current scale
290
- - `zoomOut(multiplier?)`
291
- - **multiplier**: The multiplier for zooming out (range: `0.01 ~ 1`)
292
- - Example: `zoomOut(0.3)` → Zoom out by dividing the current scale by 1.3
293
- - `resetZoom(scale?)`
294
- - **scale**: The scale value to reset to
295
- - Example: `resetZoom(1.5)` → Reset to 1.5x scale
296
- - `rotate(angle?, clockwise?)`
297
- - **angle**: The angle to rotate (0, 90, 180, 270, 360)
298
- - **clockwise**: The direction to rotate (true: clockwise, false: counter-clockwise)
299
- - Example: `rotate(90)` → Rotate 90 degrees clockwise
300
- - Example: `rotate(90, false)` → Rotate 90 degrees counter-clockwise
301
- - Example: `rotate(0)` → Reset rotation
302
-
303
- ### useGestureViewerEvent
304
-
305
- You can subscribe to specific events from `GestureViewer` using the `useGestureViewerEvent` hook. This allows you to respond to real-time gesture changes like zoom and rotation.
306
-
307
- ```tsx
308
- import { GestureViewer, useGestureViewerEvent } from 'react-native-gesture-image-viewer';
309
-
310
- function App() {
311
- // Listen to zoom changes on the default instance (ID: 'default')
312
- useGestureViewerEvent('zoomChange', (data) => {
313
- console.log(`Zoom changed from ${data.previousScale} to ${data.scale}`);
314
- });
315
-
316
- // Listen to rotation changes on the default instance (ID: 'default')
317
- useGestureViewerEvent('rotationChange', (data) => {
318
- console.log(`Rotation changed from ${data.previousRotation}° to ${data.rotation}°`);
319
- });
320
-
321
- // Listen to events on a specific instance
322
- useGestureViewerEvent('gallery', 'zoomChange', (data) => {
323
- console.log(`Gallery zoom: ${data.scale}x`);
324
- });
325
-
326
- return (
327
- <GestureViewer
328
- data={images}
329
- renderItem={renderImage}
330
- />
331
- );
332
- }
333
- ```
334
-
335
- #### Event Types
336
-
337
- | Event | Description | Data |
338
- |:-----|:-----|:-----|
339
- | `zoomChange` | Fired when the zoom scale changes during pinch gestures | `{ scale: number, previousScale: number }` |
340
- | `rotationChange` | Fired when the rotation angle changes during rotation gestures | `{ rotation: number, previousRotation: number }` |
341
-
342
- ### Style Customization
343
-
344
- You can customize the styling of `GestureViewer`.
345
-
346
- ```tsx
347
- import { GestureViewer } from 'react-native-gesture-image-viewer';
348
-
349
- function App() {
350
- return (
351
- <GestureViewer
352
- animateBackdrop={false}
353
- width={400}
354
- containerStyle={{ /* ... */ }}
355
- backdropStyle={{ backgroundColor: 'rgba(0, 0, 0, 0.90)' }}
356
- renderContainer={(children) => <View style={{ flex: 1 }}>{children}</View>}
357
- />
358
- );
359
- }
360
- ```
361
-
362
- |Property|Description|Default|
363
- |:--:|:-----|:--:|
364
- |`animateBackdrop`|By default, the background `opacity` gradually decreases from 1 to 0 during downward swipe gestures. When `false`, this animation is disabled.|`true`|
365
- |`width`|The width of content items. Default is window width.|`Dimensions width`|
366
- |`containerStyle`|Allows custom styling of the container that wraps the list component.|`flex: 1`|
367
- |`backdropStyle`|Allows customization of the viewer's background style.|`backgroundColor: black; StyleSheet.absoluteFill;`|
368
- |`renderContainer`|Allows custom wrapper component around `<GestureViewer />`.||
369
-
370
- ### Multi-Instance Management
371
-
372
- When you want to efficiently manage multiple `GestureViewer` instances, you can use the `id` prop to use multiple `GestureViewer` components.
373
- `GestureViewer` automatically removes instances from memory when components are unmounted, so no manual memory management is required.
374
-
375
- > The default `id` value is `default`.
376
-
377
- ```tsx
378
- import { GestureViewer, useGestureViewerController } from 'react-native-gesture-image-viewer';
379
-
380
- const firstViewerId = 'firstViewerId';
381
- const secondViewerId = 'secondViewerId';
382
-
383
- function App() {
384
- const { currentIndex: firstCurrentIndex, totalCount: firstTotalCount } = useGestureViewerController(firstViewerId);
385
- const { currentIndex: secondCurrentIndex, totalCount: secondTotalCount } = useGestureViewerController(secondViewerId);
386
-
387
- return (
388
- <View>
389
- <GestureViewer
390
- id={firstViewerId}
391
- data={images}
392
- renderItem={renderImage}
393
- />
394
- <GestureViewer
395
- id={secondViewerId}
396
- data={images}
397
- renderItem={renderImage}
398
- />
399
- </View>
400
- );
401
- }
402
- ```
403
-
404
- ### Additional Props
405
-
406
- #### `onIndexChange`
407
- The `onIndexChange` callback function is called when the `index` value changes.
408
-
409
- ```tsx
410
- import { GestureViewer } from 'react-native-gesture-image-viewer';
411
-
412
- function App() {
413
- const [currentIndex, setCurrentIndex] = useState(0);
414
-
415
- return (
416
- <GestureViewer
417
- onIndexChange={setCurrentIndex}
418
- />
419
- );
420
- }
421
- ```
422
-
423
- #### `useSnap`
424
- Sets the scroll behavior mode. `false` (default) uses paging mode, `true` uses snap mode.
425
-
426
- ```tsx
427
- import { GestureViewer } from 'react-native-gesture-image-viewer';
428
-
429
- function App() {
430
- return (
431
- <GestureViewer
432
- data={data}
433
- renderItem={renderItem}
434
- useSnap={true}
435
- />
436
- );
437
- }
438
- ```
439
-
440
- #### `itemSpacing`
441
- Sets the spacing between items in pixels. Only applied when `useSnap` is `true`.
442
-
443
- ```tsx
444
- import { GestureViewer } from 'react-native-gesture-image-viewer';
445
-
446
- function App() {
447
- return (
448
- <GestureViewer
449
- data={data}
450
- renderItem={renderItem}
451
- useSnap={true}
452
- itemSpacing={16} // 16px spacing between items
453
- />
79
+ </Modal>
454
80
  );
455
81
  }
456
82
  ```
457
83
 
458
- #### `initialIndex` (default: `0`)
459
- Sets the initial index value.
460
-
461
- #### `dismissThreshold` (default: `80`)
462
- `dismissThreshold` controls when `onDismiss` is called by applying a threshold value during vertical gestures.
463
-
464
- #### `resistance` (default: `2`)
465
- `resistance` controls the range of vertical movement by applying resistance during vertical gestures.
466
-
467
- #### `maxZoomScale` (default: `2`)
468
- Controls the maximum zoom scale multiplier.
469
-
470
- ## Performance Optimization Tips
471
-
472
- - Wrap the `renderItem` function with `useCallback` to prevent unnecessary re-renders.
473
- - For large images, we recommend using `FastImage` or `expo-image`.
474
- - For handling many images, we recommend using `FlashList`.
475
- - Test on actual devices (performance may be limited in simulators).
476
-
477
84
  ## Contributing
478
85
 
479
86
  For details on how to contribute to the project and set up the development environment, please refer to the [Contributing Guide](CONTRIBUTING.md).
@@ -3,7 +3,8 @@
3
3
  import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
4
4
  import { InteractionManager, useWindowDimensions } from 'react-native';
5
5
  import { Gesture } from 'react-native-gesture-handler';
6
- import { Easing, interpolate, runOnJS, useAnimatedReaction, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
6
+ import { Easing, interpolate, useAnimatedReaction, useAnimatedStyle, useSharedValue, withSpring, withTiming } from 'react-native-reanimated';
7
+ import { runOnJS } from 'react-native-worklets';
7
8
  import { registry } from "./GestureViewerRegistry.js";
8
9
  import { createBoundsConstraint, createScrollAction, getLoopAdjustedIndex } from "./utils.js";
9
10
  export const useGestureViewer = ({
@@ -182,8 +183,11 @@ export const useGestureViewer = ({
182
183
  return;
183
184
  }
184
185
  translateY.value = withSpring(0, {
185
- damping: 15,
186
- stiffness: 150
186
+ stiffness: 600,
187
+ damping: 50,
188
+ mass: 4,
189
+ overshootClamping: false,
190
+ energyThreshold: 6e-9
187
191
  });
188
192
  });
189
193
  }, [translateY, dismissThreshold, enableDismissGesture, onDismiss, resistance, isZoomed]);
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useEffect","useMemo","useRef","useState","InteractionManager","useWindowDimensions","Gesture","Easing","interpolate","runOnJS","useAnimatedReaction","useAnimatedStyle","useSharedValue","withSpring","withTiming","registry","createBoundsConstraint","createScrollAction","getLoopAdjustedIndex","useGestureViewer","data","initialIndex","onIndexChange","onDismiss","width","customWidth","dismissThreshold","resistance","animateBackdrop","enableDismissGesture","enableSwipeGesture","enableZoomGesture","enableDoubleTapGesture","enableZoomPanGesture","enableLoop","maxZoomScale","itemSpacing","useSnap","id","screenWidth","height","screenHeight","isZoomed","setIsZoomed","isRotated","setIsRotated","currentIndex","setCurrentIndex","manager","setManager","unsubscribeRef","initialTranslateY","initialTranslateX","startScale","translateY","translateX","scale","backdropOpacity","rotation","listRef","dataLength","length","adjustedInitialIndex","constrainTranslation","scrollTo","index","animated","scrollAction","current","emitZoomChange","currentScale","prevScale","emitRotationChange","currentRotation","prevRotation","value","previousScale","previousRotation","handleManagerChange","getState","subscribe","state","unsubscribeFromRegistry","subscribeToManager","setDataLength","setEnableSwipeGesture","setWidth","setHeight","setZoomSharedValues","setRotation","setEnableLoop","notifyStateChange","setListRef","runAfterInteractions","cancel","onMomentumScrollEnd","event","contentOffset","nativeEvent","scrollIndex","Math","round","x","isLoopHandled","handleMomentumScrollEnd","realIndex","needsJump","jumpToIndex","undefined","dismissGesture","Pan","minDistance","averageTouches","activeCursor","activeOffsetY","failOffsetX","enabled","onUpdate","translationY","onEnd","damping","stiffness","zoomPinchGesture","Pinch","onBegin","newScale","deltaScale","centerX","focalX","centerY","focalY","newTranslateX","newTranslateY","constrainedTranslateX","constrainedTranslateY","duration","easing","bezier","zoomPanGesture","translationX","doubleTapGesture","Tap","numberOfTaps","nextScale","y","zoomGesture","Race","Exclusive","animatedStyle","transform","rotate","backdropStyle","opacity","onScrollBeginDrag","handleScrollBeginDrag"],"sourceRoot":"../../src","sources":["useGestureViewer.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SACEC,kBAAkB,EAGlBC,mBAAmB,QACd,cAAc;AACrB,SAASC,OAAO,QAAQ,8BAA8B;AACtD,SACEC,MAAM,EACNC,WAAW,EACXC,OAAO,EACPC,mBAAmB,EACnBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAEhC,SAASC,QAAQ,QAAQ,4BAAyB;AAElD,SAASC,sBAAsB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,YAAS;AAO1F,OAAO,MAAMC,gBAAgB,GAAGA,CAAU;EACxCC,I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,CAACqB,KAAK,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC;IAExE,OAAO;MAAE6E;IAAQ,CAAC;EACpB,CAAC,EAAE,CAAC5H,eAAe,CAAC,CAAC;EAErB,MAAM6H,iBAAiB,GAAG1J,WAAW,CAAC,MAAM;IAC1CiD,OAAO,EAAE0G,qBAAqB,CAAC,CAAC;EAClC,CAAC,EAAE,CAAC1G,OAAO,CAAC,CAAC;EAEb,OAAO;IACLF,YAAY;IACZc,UAAU;IACVN,UAAU;IACVK,OAAO;IACPjB,QAAQ;IACRE,SAAS;IACTiE,cAAc;IACdoC,WAAW;IAEXlD,mBAAmB;IACnB0D,iBAAiB;IAEjBL,aAAa;IACbG;EACF,CAAC;AACH,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useEffect","useMemo","useRef","useState","InteractionManager","useWindowDimensions","Gesture","Easing","interpolate","useAnimatedReaction","useAnimatedStyle","useSharedValue","withSpring","withTiming","runOnJS","registry","createBoundsConstraint","createScrollAction","getLoopAdjustedIndex","useGestureViewer","data","initialIndex","onIndexChange","onDismiss","width","customWidth","dismissThreshold","resistance","animateBackdrop","enableDismissGesture","enableSwipeGesture","enableZoomGesture","enableDoubleTapGesture","enableZoomPanGesture","enableLoop","maxZoomScale","itemSpacing","useSnap","id","screenWidth","height","screenHeight","isZoomed","setIsZoomed","isRotated","setIsRotated","currentIndex","setCurrentIndex","manager","setManager","unsubscribeRef","initialTranslateY","initialTranslateX","startScale","translateY","translateX","scale","backdropOpacity","rotation","listRef","dataLength","length","adjustedInitialIndex","constrainTranslation","scrollTo","index","animated","scrollAction","current","emitZoomChange","currentScale","prevScale","emitRotationChange","currentRotation","prevRotation","value","previousScale","previousRotation","handleManagerChange","getState","subscribe","state","unsubscribeFromRegistry","subscribeToManager","setDataLength","setEnableSwipeGesture","setWidth","setHeight","setZoomSharedValues","setRotation","setEnableLoop","notifyStateChange","setListRef","runAfterInteractions","cancel","onMomentumScrollEnd","event","contentOffset","nativeEvent","scrollIndex","Math","round","x","isLoopHandled","handleMomentumScrollEnd","realIndex","needsJump","jumpToIndex","undefined","dismissGesture","Pan","minDistance","averageTouches","activeCursor","activeOffsetY","failOffsetX","enabled","onUpdate","translationY","onEnd","stiffness","damping","mass","overshootClamping","energyThreshold","zoomPinchGesture","Pinch","onBegin","newScale","deltaScale","centerX","focalX","centerY","focalY","newTranslateX","newTranslateY","constrainedTranslateX","constrainedTranslateY","duration","easing","bezier","zoomPanGesture","translationX","doubleTapGesture","Tap","numberOfTaps","nextScale","y","zoomGesture","Race","Exclusive","animatedStyle","transform","rotate","backdropStyle","opacity","onScrollBeginDrag","handleScrollBeginDrag"],"sourceRoot":"../../src","sources":["useGestureViewer.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AACzE,SACEC,kBAAkB,EAGlBC,mBAAmB,QACd,cAAc;AACrB,SAASC,OAAO,QAAQ,8BAA8B;AACtD,SACEC,MAAM,EACNC,WAAW,EACXC,mBAAmB,EACnBC,gBAAgB,EAChBC,cAAc,EACdC,UAAU,EACVC,UAAU,QACL,yBAAyB;AAChC,SAASC,OAAO,QAAQ,uBAAuB;AAE/C,SAASC,QAAQ,QAAQ,4BAAyB;AAElD,SAASC,sBAAsB,EAAEC,kBAAkB,EAAEC,oBAAoB,QAAQ,YAAS;AAO1F,OAAO,MAAMC,gBAAgB,GAAGA,CAAU;EACxCC,IAAI;EACJC,YAAY,GAAG,CAAC;EAChBC,aAAa;EACbC,SAAS;EACTC,KAAK,EAAEC,WAAW;EAClBC,gBAAgB,GAAG,EAAE;EACrBC,UAAU,GAAG,CAAC;EACd;EACA;EACAC,eAAe,GAAG,IAAI;EACtBC,oBAAoB,GAAG,IAAI;EAC3BC,kBAAkB,GAAG,IAAI;EACzBC,iBAAiB,GAAG,IAAI;EACxBC,sBAAs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B,MAAMgI,iBAAiB,GAAG7J,WAAW,CAAC,MAAM;IAC1CiD,OAAO,EAAE6G,qBAAqB,CAAC,CAAC;EAClC,CAAC,EAAE,CAAC7G,OAAO,CAAC,CAAC;EAEb,OAAO;IACLF,YAAY;IACZc,UAAU;IACVN,UAAU;IACVK,OAAO;IACPjB,QAAQ;IACRE,SAAS;IACTiE,cAAc;IACduC,WAAW;IAEXrD,mBAAmB;IACnB6D,iBAAiB;IAEjBL,aAAa;IACbG;EACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"useGestureViewer.d.ts","sourceRoot":"","sources":["../../../src/useGestureViewer.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAC;AActB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGlD,KAAK,qBAAqB,CAAC,CAAC,GAAG,GAAG,IAAI,IAAI,CACxC,kBAAkB,CAAC,CAAC,CAAC,EACrB,YAAY,GAAG,iBAAiB,GAAG,eAAe,GAAG,WAAW,GAAG,gBAAgB,GAAG,eAAe,CACtG,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,GAAG,GAAG,EAAE,qRAqBvC,qBAAqB,CAAC,CAAC,CAAC;;;;;;;;;iCA6Kf,oBAAoB,CAAC,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+RlD,CAAC"}
1
+ {"version":3,"file":"useGestureViewer.d.ts","sourceRoot":"","sources":["../../../src/useGestureViewer.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EAE1B,MAAM,cAAc,CAAC;AActB,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAGlD,KAAK,qBAAqB,CAAC,CAAC,GAAG,GAAG,IAAI,IAAI,CACxC,kBAAkB,CAAC,CAAC,CAAC,EACrB,YAAY,GAAG,iBAAiB,GAAG,eAAe,GAAG,WAAW,GAAG,gBAAgB,GAAG,eAAe,CACtG,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAI,CAAC,GAAG,GAAG,EAAE,qRAqBvC,qBAAqB,CAAC,CAAC,CAAC;;;;;;;;;iCA6Kf,oBAAoB,CAAC,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkSlD,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gesture-image-viewer",
3
- "version": "1.6.1",
3
+ "version": "2.0.0-beta.0",
4
4
  "description": "🖼️ A highly customizable and easy-to-use React Native image viewer with gesture support and external controls",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -74,7 +74,7 @@
74
74
  "bugs": {
75
75
  "url": "https://github.com/saseungmin/react-native-gesture-image-viewer/issues"
76
76
  },
77
- "homepage": "https://github.com/saseungmin/react-native-gesture-image-viewer#readme",
77
+ "homepage": "https://react-native-gesture-image-viewer.pages.dev",
78
78
  "publishConfig": {
79
79
  "registry": "https://registry.npmjs.org/"
80
80
  },
@@ -95,18 +95,21 @@
95
95
  "react-native": "0.79.5",
96
96
  "react-native-builder-bob": "^0.40.12",
97
97
  "react-native-gesture-handler": "^2.24.0",
98
- "react-native-reanimated": "^3.18.0",
98
+ "react-native-reanimated": "^4.0.1",
99
+ "react-native-worklets": "^0.4.1",
99
100
  "typescript": "^5.8.3"
100
101
  },
101
102
  "peerDependencies": {
102
103
  "react": ">=18.0.0",
103
104
  "react-native": ">=0.75.0",
104
105
  "react-native-gesture-handler": ">=2.24.0",
105
- "react-native-reanimated": ">=3.0.0"
106
+ "react-native-reanimated": ">=4.0.0",
107
+ "react-native-worklets": "*"
106
108
  },
107
109
  "workspaces": [
108
110
  ".",
109
- "example"
111
+ "example",
112
+ "docs"
110
113
  ],
111
114
  "packageManager": "yarn@4.9.2",
112
115
  "jest": {
@@ -9,13 +9,13 @@ import { Gesture } from 'react-native-gesture-handler';
9
9
  import {
10
10
  Easing,
11
11
  interpolate,
12
- runOnJS,
13
12
  useAnimatedReaction,
14
13
  useAnimatedStyle,
15
14
  useSharedValue,
16
15
  withSpring,
17
16
  withTiming,
18
17
  } from 'react-native-reanimated';
18
+ import { runOnJS } from 'react-native-worklets';
19
19
  import type GestureViewerManager from './GestureViewerManager';
20
20
  import { registry } from './GestureViewerRegistry';
21
21
  import type { GestureViewerProps } from './types';
@@ -293,8 +293,11 @@ export const useGestureViewer = <T = any>({
293
293
  }
294
294
 
295
295
  translateY.value = withSpring(0, {
296
- damping: 15,
297
- stiffness: 150,
296
+ stiffness: 600,
297
+ damping: 50,
298
+ mass: 4,
299
+ overshootClamping: false,
300
+ energyThreshold: 6e-9,
298
301
  });
299
302
  });
300
303
  }, [translateY, dismissThreshold, enableDismissGesture, onDismiss, resistance, isZoomed]);