react-native-gesture-image-viewer 2.0.0-beta.2 → 2.0.0-beta.4
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 +13 -6
- package/lib/module/GestureViewer.js +5 -5
- package/lib/module/GestureViewer.js.map +1 -1
- package/lib/module/GestureViewerManager.js +5 -5
- package/lib/module/GestureViewerManager.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/useGestureViewer.js +40 -63
- package/lib/module/useGestureViewer.js.map +1 -1
- package/lib/module/useGestureViewerController.js +39 -58
- package/lib/module/useGestureViewerController.js.map +1 -1
- package/lib/module/useGestureViewerState.js +78 -0
- package/lib/module/useGestureViewerState.js.map +1 -0
- package/lib/typescript/src/GestureViewer.d.ts +2 -2
- package/lib/typescript/src/GestureViewer.d.ts.map +1 -1
- package/lib/typescript/src/GestureViewerManager.d.ts +5 -8
- package/lib/typescript/src/GestureViewerManager.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +60 -57
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/useGestureViewer.d.ts +1 -1
- package/lib/typescript/src/useGestureViewer.d.ts.map +1 -1
- package/lib/typescript/src/useGestureViewerController.d.ts +10 -21
- package/lib/typescript/src/useGestureViewerController.d.ts.map +1 -1
- package/lib/typescript/src/useGestureViewerState.d.ts +35 -0
- package/lib/typescript/src/useGestureViewerState.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/GestureViewer.tsx +7 -7
- package/src/GestureViewerManager.ts +9 -9
- package/src/index.tsx +2 -1
- package/src/types.ts +60 -59
- package/src/useGestureViewer.ts +41 -69
- package/src/useGestureViewerController.ts +43 -62
- package/src/useGestureViewerState.ts +85 -0
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { useEffect, useMemo, useRef
|
|
3
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
4
4
|
import { registry } from "./GestureViewerRegistry.js";
|
|
5
5
|
/**
|
|
6
6
|
* Hook to control the gesture viewer programmatically.
|
|
7
7
|
*
|
|
8
8
|
* @param id - Viewer instance identifier (default: 'default')
|
|
9
|
-
* @returns Methods
|
|
9
|
+
* @returns Methods for controlling the viewer
|
|
10
10
|
*
|
|
11
11
|
* **Available methods:**
|
|
12
12
|
* - `goToIndex(index: number)` - Navigate to specific index (0 to totalCount-1)
|
|
@@ -15,83 +15,64 @@ import { registry } from "./GestureViewerRegistry.js";
|
|
|
15
15
|
* - `zoomIn(multiplier?: number)` - Zoom in (default: 0.25)
|
|
16
16
|
* - `zoomOut(multiplier?: number)` - Zoom out (default: 0.25)
|
|
17
17
|
* - `resetZoom(scale?: number)` - Reset zoom level (default: 1.0)
|
|
18
|
-
* - `rotate(angle?:
|
|
19
|
-
*
|
|
20
|
-
* **Available state:**
|
|
21
|
-
* - `currentIndex: number` - Current active index (read-only)
|
|
22
|
-
* - `totalCount: number` - Total number of items (read-only)
|
|
18
|
+
* - `rotate(angle?: RotationAngle, clockwise?: boolean)` - Rotate content (default: 90° clockwise)
|
|
23
19
|
*
|
|
24
20
|
* @example
|
|
25
21
|
* ```tsx
|
|
26
|
-
* const
|
|
22
|
+
* const controller = useGestureViewerController();
|
|
27
23
|
*
|
|
28
24
|
* // Navigate to specific index
|
|
29
|
-
* goToIndex(2);
|
|
25
|
+
* controller.goToIndex(2);
|
|
30
26
|
*
|
|
31
27
|
* // Go to next image
|
|
32
|
-
* goToNext();
|
|
28
|
+
* controller.goToNext();
|
|
33
29
|
*
|
|
34
30
|
* // Zoom in by 25%
|
|
35
|
-
* zoomIn();
|
|
31
|
+
* controller.zoomIn();
|
|
36
32
|
*
|
|
37
33
|
* // Zoom out by 50%
|
|
38
|
-
* zoomOut(0.5);
|
|
34
|
+
* controller.zoomOut(0.5);
|
|
39
35
|
*
|
|
40
36
|
* // Reset to original size
|
|
41
|
-
* resetZoom();
|
|
37
|
+
* controller.resetZoom();
|
|
42
38
|
*
|
|
43
39
|
* // Rotate 90 degrees clockwise
|
|
44
|
-
* rotate();
|
|
40
|
+
* controller.rotate();
|
|
45
41
|
*
|
|
46
42
|
* // Rotate 180 degrees
|
|
47
|
-
* rotate(180);
|
|
48
|
-
*
|
|
49
|
-
* // Check current state
|
|
50
|
-
* console.log(`Image ${currentIndex + 1} of ${totalCount}`);
|
|
51
|
-
*
|
|
52
|
-
* // Check navigation availability
|
|
53
|
-
* const canGoNext = currentIndex < totalCount - 1;
|
|
54
|
-
* const canGoPrevious = currentIndex > 0;
|
|
43
|
+
* controller.rotate(180);
|
|
55
44
|
* ```
|
|
56
45
|
*/
|
|
57
46
|
export const useGestureViewerController = (id = 'default') => {
|
|
58
|
-
const
|
|
59
|
-
currentIndex: 0,
|
|
60
|
-
totalCount: 0
|
|
61
|
-
});
|
|
62
|
-
const [manager, setManager] = useState(null);
|
|
63
|
-
const unsubscribeRef = useRef(null);
|
|
47
|
+
const managerRef = useRef(null);
|
|
64
48
|
useEffect(() => {
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
if (newManager) {
|
|
70
|
-
setState(newManager.getState());
|
|
71
|
-
unsubscribeRef.current = newManager.subscribe(setState);
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
setState({
|
|
75
|
-
currentIndex: 0,
|
|
76
|
-
totalCount: 0
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
const unsubscribeFromRegistry = registry.subscribeToManager(id, handleManagerChange);
|
|
80
|
-
return () => {
|
|
81
|
-
unsubscribeFromRegistry();
|
|
82
|
-
unsubscribeRef.current?.();
|
|
83
|
-
};
|
|
49
|
+
const unsubscribe = registry.subscribeToManager(id, manager => {
|
|
50
|
+
managerRef.current = manager;
|
|
51
|
+
});
|
|
52
|
+
return unsubscribe;
|
|
84
53
|
}, [id]);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
54
|
+
return useMemo(() => ({
|
|
55
|
+
goToIndex: index => {
|
|
56
|
+
managerRef.current?.goToIndex(index);
|
|
57
|
+
},
|
|
58
|
+
goToPrevious: () => {
|
|
59
|
+
managerRef.current?.goToPrevious();
|
|
60
|
+
},
|
|
61
|
+
goToNext: () => {
|
|
62
|
+
managerRef.current?.goToNext();
|
|
63
|
+
},
|
|
64
|
+
zoomIn: multiplier => {
|
|
65
|
+
managerRef.current?.zoomIn(multiplier);
|
|
66
|
+
},
|
|
67
|
+
zoomOut: multiplier => {
|
|
68
|
+
managerRef.current?.zoomOut(multiplier);
|
|
69
|
+
},
|
|
70
|
+
resetZoom: scale => {
|
|
71
|
+
managerRef.current?.resetZoom(scale);
|
|
72
|
+
},
|
|
73
|
+
rotate: (angle, clockwise) => {
|
|
74
|
+
managerRef.current?.rotate(angle, clockwise);
|
|
75
|
+
}
|
|
76
|
+
}), []);
|
|
96
77
|
};
|
|
97
78
|
//# sourceMappingURL=useGestureViewerController.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["useEffect","useMemo","useRef","
|
|
1
|
+
{"version":3,"names":["useEffect","useMemo","useRef","registry","useGestureViewerController","id","managerRef","unsubscribe","subscribeToManager","manager","current","goToIndex","index","goToPrevious","goToNext","zoomIn","multiplier","zoomOut","resetZoom","scale","rotate","angle","clockwise"],"sourceRoot":"../../src","sources":["useGestureViewerController.ts"],"mappings":";;AAAA,SAASA,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAElD,SAASC,QAAQ,QAAQ,4BAAyB;AAGlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useCallback, useRef, useSyncExternalStore } from 'react';
|
|
4
|
+
import { registry } from "./GestureViewerRegistry.js";
|
|
5
|
+
/**
|
|
6
|
+
* Hook to access the current state of the gesture viewer.
|
|
7
|
+
*
|
|
8
|
+
* @param id - Viewer instance identifier (default: 'default')
|
|
9
|
+
* @returns Current state of the viewer
|
|
10
|
+
*
|
|
11
|
+
* **Available state:**
|
|
12
|
+
* - `currentIndex: number` - Current active index (read-only)
|
|
13
|
+
* - `totalCount: number` - Total number of items (read-only)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
* const { currentIndex, totalCount } = useGestureViewerState();
|
|
18
|
+
*
|
|
19
|
+
* // Display current position
|
|
20
|
+
* return (
|
|
21
|
+
* <Text>
|
|
22
|
+
* {currentIndex + 1} / {totalCount}
|
|
23
|
+
* </Text>
|
|
24
|
+
* );
|
|
25
|
+
*
|
|
26
|
+
* // React to index changes
|
|
27
|
+
* useEffect(() => {
|
|
28
|
+
* console.log(`Moved to image ${currentIndex + 1}`);
|
|
29
|
+
* trackPageView(currentIndex);
|
|
30
|
+
* }, [currentIndex]);
|
|
31
|
+
*
|
|
32
|
+
* // Check navigation availability
|
|
33
|
+
* const canGoNext = currentIndex < totalCount - 1;
|
|
34
|
+
* const canGoPrevious = currentIndex > 0;
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export const useGestureViewerState = (id = 'default') => {
|
|
38
|
+
const stateRef = useRef({
|
|
39
|
+
currentIndex: 0,
|
|
40
|
+
totalCount: 0
|
|
41
|
+
});
|
|
42
|
+
const updateState = useCallback((newState, onStoreChange) => {
|
|
43
|
+
if (stateRef.current.currentIndex !== newState.currentIndex || stateRef.current.totalCount !== newState.totalCount) {
|
|
44
|
+
stateRef.current = {
|
|
45
|
+
...newState
|
|
46
|
+
};
|
|
47
|
+
onStoreChange();
|
|
48
|
+
}
|
|
49
|
+
}, []);
|
|
50
|
+
const subscribe = useCallback(onStoreChange => {
|
|
51
|
+
let unsubscribeFromManager = null;
|
|
52
|
+
const unsubscribeFromRegistry = registry.subscribeToManager(id, newManager => {
|
|
53
|
+
unsubscribeFromManager?.();
|
|
54
|
+
unsubscribeFromManager = null;
|
|
55
|
+
if (newManager) {
|
|
56
|
+
unsubscribeFromManager = newManager.subscribe(newState => {
|
|
57
|
+
updateState(newState, onStoreChange);
|
|
58
|
+
});
|
|
59
|
+
updateState(newManager.getState(), onStoreChange);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
updateState({
|
|
63
|
+
currentIndex: 0,
|
|
64
|
+
totalCount: 0
|
|
65
|
+
}, onStoreChange);
|
|
66
|
+
});
|
|
67
|
+
return () => {
|
|
68
|
+
unsubscribeFromRegistry();
|
|
69
|
+
unsubscribeFromManager?.();
|
|
70
|
+
};
|
|
71
|
+
}, [id, updateState]);
|
|
72
|
+
const getSnapshot = useCallback(() => {
|
|
73
|
+
return stateRef.current;
|
|
74
|
+
}, []);
|
|
75
|
+
const state = useSyncExternalStore(subscribe, getSnapshot);
|
|
76
|
+
return state;
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=useGestureViewerState.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useCallback","useRef","useSyncExternalStore","registry","useGestureViewerState","id","stateRef","currentIndex","totalCount","updateState","newState","onStoreChange","current","subscribe","unsubscribeFromManager","unsubscribeFromRegistry","subscribeToManager","newManager","getState","getSnapshot","state"],"sourceRoot":"../../src","sources":["useGestureViewerState.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,MAAM,EAAEC,oBAAoB,QAAQ,OAAO;AACjE,SAASC,QAAQ,QAAQ,4BAAyB;AAGlD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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EAAEI,WAAW,CAClB,CAAC;EAED,MAAMU,WAAW,GAAGnB,WAAW,CAAC,MAAM;IACpC,OAAOM,QAAQ,CAACM,OAAO;EACzB,CAAC,EAAE,EAAE,CAAC;EAEN,MAAMQ,KAAK,GAAGlB,oBAAoB,CAACW,SAAS,EAAEM,WAAW,CAAC;EAE1D,OAAOC,KAAK;AACd,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type ScrollView } from 'react-native';
|
|
2
2
|
import type { GestureViewerProps } from './types';
|
|
3
|
-
export declare function GestureViewer<T = any, LC = typeof
|
|
3
|
+
export declare function GestureViewer<T = any, LC = typeof ScrollView>({ id, data, renderItem: renderItemProp, renderContainer, ListComponent, width: customWidth, listProps, backdropStyle: backdropStyleProps, containerStyle, initialIndex, itemSpacing, enableSnapMode, enableLoop, ...props }: GestureViewerProps<T, LC>): import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
//# sourceMappingURL=GestureViewer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GestureViewer.d.ts","sourceRoot":"","sources":["../../../src/GestureViewer.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"GestureViewer.d.ts","sourceRoot":"","sources":["../../../src/GestureViewer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,UAAU,EAA+D,MAAM,cAAc,CAAC;AAItH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,OAAO,UAAU,EAAE,EAC7D,EAAc,EACd,IAAI,EACJ,UAAU,EAAE,cAAc,EAC1B,eAAe,EACf,aAAa,EACb,KAAK,EAAE,WAAW,EAClB,SAAS,EACT,aAAa,EAAE,kBAAkB,EACjC,cAAc,EACd,YAAgB,EAChB,WAAe,EACf,cAAsB,EACtB,UAAkB,EAClB,GAAG,KAAK,EACT,EAAE,kBAAkB,CAAC,CAAC,EAAE,EAAE,CAAC,2CAwJ3B"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type SharedValue } from 'react-native-reanimated';
|
|
2
|
-
import type {
|
|
2
|
+
import type { GestureViewerEventCallback, GestureViewerEventType, GestureViewerState } from './types';
|
|
3
3
|
declare class GestureViewerManager {
|
|
4
4
|
private currentIndex;
|
|
5
5
|
private dataLength;
|
|
6
6
|
private width;
|
|
7
7
|
private height;
|
|
8
8
|
private maxZoomScale;
|
|
9
|
-
private
|
|
9
|
+
private enableHorizontalSwipe;
|
|
10
10
|
private enableLoop;
|
|
11
11
|
private listRef;
|
|
12
12
|
private scale;
|
|
@@ -17,21 +17,18 @@ declare class GestureViewerManager {
|
|
|
17
17
|
private listeners;
|
|
18
18
|
private eventListeners;
|
|
19
19
|
private notifyListeners;
|
|
20
|
-
subscribe(listener: (state:
|
|
20
|
+
subscribe(listener: (state: GestureViewerState) => void): () => void;
|
|
21
21
|
addEventListener<T extends GestureViewerEventType>(eventType: T, callback: GestureViewerEventCallback<T>): () => void;
|
|
22
22
|
private emitEvent;
|
|
23
23
|
emitZoomChange: (scale: number, previousScale: number | null) => void;
|
|
24
24
|
emitRotationChange: (rotation: number, previousRotation: number | null) => void;
|
|
25
|
-
getState():
|
|
26
|
-
currentIndex: number;
|
|
27
|
-
totalCount: number;
|
|
28
|
-
};
|
|
25
|
+
getState(): GestureViewerState;
|
|
29
26
|
setEnableLoop(enabled: boolean): void;
|
|
30
27
|
setWidth(width: number): void;
|
|
31
28
|
setHeight(height: number): void;
|
|
32
29
|
setListRef(ref: any): void;
|
|
33
30
|
setDataLength(length: number): void;
|
|
34
|
-
|
|
31
|
+
setEnableHorizontalSwipe(enabled: boolean): void;
|
|
35
32
|
setCurrentIndex(index: number): void;
|
|
36
33
|
setZoomSharedValues(scale: SharedValue<number>, translateX: SharedValue<number>, translateY: SharedValue<number>, maxZoomScale: number): void;
|
|
37
34
|
notifyStateChange(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GestureViewerManager.d.ts","sourceRoot":"","sources":["../../../src/GestureViewerManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"GestureViewerManager.d.ts","sourceRoot":"","sources":["../../../src/GestureViewerManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAc,MAAM,yBAAyB,CAAC;AACvE,OAAO,KAAK,EACV,0BAA0B,EAE1B,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,SAAS,CAAC;AAGjB,cAAM,oBAAoB;IACxB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,UAAU,CAAK;IACvB,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,qBAAqB,CAAQ;IACrC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,OAAO,CAAoB;IAEnC,OAAO,CAAC,KAAK,CAAoC;IACjD,OAAO,CAAC,QAAQ,CAAoC;IACpD,OAAO,CAAC,UAAU,CAAoC;IACtD,OAAO,CAAC,UAAU,CAAoC;IAEtD,OAAO,CAAC,YAAY,CAA6B;IAEjD,OAAO,CAAC,SAAS,CAAkD;IACnE,OAAO,CAAC,cAAc,CAA+D;IAErF,OAAO,CAAC,eAAe;IAMvB,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI;IAQvD,gBAAgB,CAAC,CAAC,SAAS,sBAAsB,EAAE,SAAS,EAAE,CAAC,EAAE,QAAQ,EAAE,0BAA0B,CAAC,CAAC,CAAC;IAoBxG,OAAO,CAAC,SAAS;IAQjB,cAAc,GAAI,OAAO,MAAM,EAAE,eAAe,MAAM,GAAG,IAAI,UAE3D;IAEF,kBAAkB,GAAI,UAAU,MAAM,EAAE,kBAAkB,MAAM,GAAG,IAAI,UAErE;IAEF,QAAQ,IAAI,kBAAkB;IAO9B,aAAa,CAAC,OAAO,EAAE,OAAO;IAI9B,QAAQ,CAAC,KAAK,EAAE,MAAM;IAItB,SAAS,CAAC,MAAM,EAAE,MAAM;IAIxB,UAAU,CAAC,GAAG,EAAE,GAAG;IAInB,aAAa,CAAC,MAAM,EAAE,MAAM;IAI5B,wBAAwB,CAAC,OAAO,EAAE,OAAO;IAIzC,eAAe,CAAC,KAAK,EAAE,MAAM;IAM7B,mBAAmB,CACjB,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,EAC/B,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,EAC/B,YAAY,EAAE,MAAM;IAQtB,iBAAiB;IAIjB,WAAW,CAAC,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC;IAIzC,MAAM,GAAI,QAAO,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,GAAQ,EAAE,mBAAgB,UA2B9D;IAEF,MAAM,GAAI,mBAAiB,UAoBzB;IAEF,OAAO,GAAI,mBAAiB,UA0B1B;IAEF,SAAS,GAAI,cAAS,UAQpB;IAEF,SAAS,GAAI,OAAO,MAAM,UA4CxB;IAEF,uBAAuB,GAAI,aAAa,MAAM,aAY5C;IAEF,qBAAqB,aAEnB;IAEF,YAAY,aAEV;IAEF,QAAQ,aAEN;IAEF,OAAO;IAeP,OAAO,CAAC,kBAAkB,CAGxB;CACH;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { GestureViewer } from './GestureViewer';
|
|
2
|
-
export type { GestureViewerController,
|
|
2
|
+
export type { GestureViewerController, GestureViewerEventCallback, GestureViewerEventData, GestureViewerEventType, GestureViewerProps, GestureViewerState, } from './types';
|
|
3
3
|
export { useGestureViewerController } from './useGestureViewerController';
|
|
4
4
|
export { useGestureViewerEvent } from './useGestureViewerEvent';
|
|
5
|
+
export { useGestureViewerState } from './useGestureViewerState';
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,uBAAuB,EACvB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EACV,uBAAuB,EACvB,0BAA0B,EAC1B,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC"}
|
|
@@ -5,7 +5,7 @@ export type FlatListComponent = typeof RNFlatList | typeof GHFlatList;
|
|
|
5
5
|
export type ScrollViewComponent = typeof RNScrollView | typeof GHScrollView;
|
|
6
6
|
type GetComponentProps<T> = T extends React.ComponentType<infer P> ? P : never;
|
|
7
7
|
type ConditionalListProps<LC> = LC extends FlatListComponent ? React.ComponentProps<LC> : LC extends ScrollViewComponent ? React.ComponentProps<LC> : GetComponentProps<LC>;
|
|
8
|
-
export interface GestureViewerProps<T = any, LC = typeof
|
|
8
|
+
export interface GestureViewerProps<T = any, LC = typeof RNScrollView> {
|
|
9
9
|
/**
|
|
10
10
|
* When you want to efficiently manage multiple `GestureViewer` instances, you can use the `id` prop to use multiple `GestureViewer` components.
|
|
11
11
|
* @remark `GestureViewer` automatically removes instances from memory when components are unmounted, so no manual memory management is required.
|
|
@@ -21,10 +21,6 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
|
|
|
21
21
|
* @defaultValue 0
|
|
22
22
|
*/
|
|
23
23
|
initialIndex?: number;
|
|
24
|
-
/**
|
|
25
|
-
* A callback function that is called when the index of the item changes.
|
|
26
|
-
*/
|
|
27
|
-
onIndexChange?: (index: number) => void;
|
|
28
24
|
/**
|
|
29
25
|
* A callback function that is called when the `GestureViewer` is dismissed.
|
|
30
26
|
*/
|
|
@@ -47,42 +43,6 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
|
|
|
47
43
|
* @defaultValue screen width
|
|
48
44
|
*/
|
|
49
45
|
width?: number;
|
|
50
|
-
/**
|
|
51
|
-
* Enables snap scrolling mode.
|
|
52
|
-
*
|
|
53
|
-
* @remark
|
|
54
|
-
* **`false` (default)**: Paging mode (`pagingEnabled: true`)
|
|
55
|
-
* - Scrolls by full screen size increments
|
|
56
|
-
*
|
|
57
|
-
* **`true`**: Snap mode (`snapToInterval` auto-calculated)
|
|
58
|
-
* - `snapToInterval` is automatically calculated based on `width` and `itemSpacing` values
|
|
59
|
-
* - Use this option when you need item spacing
|
|
60
|
-
* @defaultValue false
|
|
61
|
-
*
|
|
62
|
-
*/
|
|
63
|
-
useSnap?: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* `dismissThreshold` controls when `onDismiss` is called by applying a threshold value during vertical gestures.
|
|
66
|
-
* @defaultValue 80
|
|
67
|
-
*/
|
|
68
|
-
dismissThreshold?: number;
|
|
69
|
-
/**
|
|
70
|
-
* Calls `onDismiss` function when swiping down.
|
|
71
|
-
* @remark Useful for closing modals with downward swipe gestures.
|
|
72
|
-
* @defaultValue true
|
|
73
|
-
*/
|
|
74
|
-
enableDismissGesture?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Controls left/right swipe gestures.
|
|
77
|
-
* @remark When `false`, horizontal gestures are disabled.
|
|
78
|
-
* @defaultValue true
|
|
79
|
-
*/
|
|
80
|
-
enableSwipeGesture?: boolean;
|
|
81
|
-
/**
|
|
82
|
-
* `resistance` controls the range of vertical movement by applying resistance during vertical gestures.
|
|
83
|
-
* @defaultValue 2
|
|
84
|
-
*/
|
|
85
|
-
resistance?: number;
|
|
86
46
|
/**
|
|
87
47
|
* The props to pass to the list component.
|
|
88
48
|
* @remark The `listProps` provides **type inference based on the selected list component**, ensuring accurate autocompletion and type safety in your IDE.
|
|
@@ -97,45 +57,86 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
|
|
|
97
57
|
*/
|
|
98
58
|
containerStyle?: StyleProp<ViewStyle>;
|
|
99
59
|
/**
|
|
100
|
-
*
|
|
101
|
-
* @remark
|
|
60
|
+
* Dismiss gesture options. Calls `onDismiss` function when swiping down.
|
|
61
|
+
* @remark Useful for closing modals with downward swipe gestures.
|
|
62
|
+
*/
|
|
63
|
+
dismiss?: {
|
|
64
|
+
/**
|
|
65
|
+
* When `false`, dismiss gesture is disabled.
|
|
66
|
+
* @defaultValue true
|
|
67
|
+
*/
|
|
68
|
+
enabled?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* `threshold` controls when `onDismiss` is called by applying a threshold value during vertical gestures.
|
|
71
|
+
* @defaultValue 80
|
|
72
|
+
*/
|
|
73
|
+
threshold?: number;
|
|
74
|
+
/**
|
|
75
|
+
* `resistance` controls the range of vertical movement by applying resistance during dismiss gestures.
|
|
76
|
+
* @defaultValue 2
|
|
77
|
+
*/
|
|
78
|
+
resistance?: number;
|
|
79
|
+
/**
|
|
80
|
+
* By default, the background `opacity` gradually decreases from 1 to 0 during downward swipe gestures.
|
|
81
|
+
* @remark When `false`, this animation is disabled.
|
|
82
|
+
* @defaultValue true
|
|
83
|
+
*/
|
|
84
|
+
fadeBackdrop?: boolean;
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* Controls left/right swipe gestures.
|
|
88
|
+
* @remark When `false`, horizontal gestures are disabled.
|
|
102
89
|
* @defaultValue true
|
|
103
90
|
*/
|
|
104
|
-
|
|
91
|
+
enableHorizontalSwipe?: boolean;
|
|
105
92
|
/**
|
|
106
93
|
* Only works when zoom is active, allows moving item position when zoomed.
|
|
107
94
|
* @remark When `false`, gesture movement is disabled during zoom.
|
|
108
95
|
* @defaultValue true
|
|
109
96
|
*/
|
|
110
|
-
|
|
97
|
+
enablePanWhenZoomed?: boolean;
|
|
111
98
|
/**
|
|
112
99
|
* Controls two-finger pinch gestures.
|
|
113
100
|
* @remark When `false`, two-finger zoom gestures are disabled.
|
|
114
101
|
* @defaultValue true
|
|
115
102
|
*/
|
|
116
|
-
|
|
103
|
+
enablePinchZoom?: boolean;
|
|
117
104
|
/**
|
|
118
105
|
* Controls double-tap zoom gestures.
|
|
119
106
|
* @remark When `false`, double-tap zoom gestures are disabled.
|
|
120
107
|
* @defaultValue true
|
|
121
108
|
*/
|
|
122
|
-
|
|
109
|
+
enableDoubleTapZoom?: boolean;
|
|
123
110
|
/**
|
|
124
111
|
* Enables infinite loop navigation.
|
|
125
112
|
* @defaultValue false
|
|
126
113
|
*/
|
|
127
114
|
enableLoop?: boolean;
|
|
128
115
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
116
|
+
* Enables snap scrolling mode.
|
|
117
|
+
*
|
|
118
|
+
* @remark
|
|
119
|
+
* **`false` (default)**: Paging mode (`pagingEnabled: true`)
|
|
120
|
+
* - Scrolls by full screen size increments
|
|
121
|
+
*
|
|
122
|
+
* **`true`**: Snap mode (`snapToInterval` auto-calculated)
|
|
123
|
+
* - `snapToInterval` is automatically calculated based on `width` and `itemSpacing` values
|
|
124
|
+
* - Use this option when you need item spacing
|
|
125
|
+
* @defaultValue false
|
|
126
|
+
*
|
|
131
127
|
*/
|
|
132
|
-
|
|
128
|
+
enableSnapMode?: boolean;
|
|
133
129
|
/**
|
|
134
130
|
* The spacing between items in pixels.
|
|
135
|
-
* @remark Only applied when `
|
|
131
|
+
* @remark Only applied when `enableSnapMode` is `true`.
|
|
136
132
|
* @defaultValue 0
|
|
137
133
|
*/
|
|
138
134
|
itemSpacing?: number;
|
|
135
|
+
/**
|
|
136
|
+
* The maximum zoom scale.
|
|
137
|
+
* @defaultValue 2
|
|
138
|
+
*/
|
|
139
|
+
maxZoomScale?: number;
|
|
139
140
|
}
|
|
140
141
|
/**
|
|
141
142
|
* Supported rotation angles in degrees.
|
|
@@ -155,8 +156,10 @@ export type GestureViewerController = {
|
|
|
155
156
|
*
|
|
156
157
|
* @example
|
|
157
158
|
* ```typescript
|
|
159
|
+
* const { totalCount } = useGestureViewerState();
|
|
160
|
+
*
|
|
158
161
|
* controller.goToIndex(0); // Go to first item
|
|
159
|
-
* controller.goToIndex(
|
|
162
|
+
* controller.goToIndex(totalCount - 1); // Go to last item
|
|
160
163
|
* ```
|
|
161
164
|
*/
|
|
162
165
|
goToIndex: (index: number) => void;
|
|
@@ -234,12 +237,12 @@ export type GestureViewerController = {
|
|
|
234
237
|
* ```
|
|
235
238
|
*/
|
|
236
239
|
rotate: (angle?: RotationAngle, clockwise?: boolean) => void;
|
|
237
|
-
}
|
|
240
|
+
};
|
|
238
241
|
/**
|
|
239
242
|
* State information for the gesture viewer controller.
|
|
240
243
|
* Contains read-only properties that reflect the current state.
|
|
241
244
|
*/
|
|
242
|
-
export type
|
|
245
|
+
export type GestureViewerState = {
|
|
243
246
|
/**
|
|
244
247
|
* The current index of the active item in the viewer.
|
|
245
248
|
*
|
|
@@ -248,7 +251,7 @@ export type GestureViewerControllerState = {
|
|
|
248
251
|
*
|
|
249
252
|
* @example
|
|
250
253
|
* ```typescript
|
|
251
|
-
* console.log(`Currently viewing item ${
|
|
254
|
+
* console.log(`Currently viewing item ${currentIndex + 1} of ${totalCount}`);
|
|
252
255
|
* ```
|
|
253
256
|
*/
|
|
254
257
|
readonly currentIndex: number;
|
|
@@ -260,8 +263,8 @@ export type GestureViewerControllerState = {
|
|
|
260
263
|
*
|
|
261
264
|
* @example
|
|
262
265
|
* ```typescript
|
|
263
|
-
* const hasNext =
|
|
264
|
-
* const hasPrevious =
|
|
266
|
+
* const hasNext = currentIndex < totalCount - 1;
|
|
267
|
+
* const hasPrevious = currentIndex > 0;
|
|
265
268
|
* ```
|
|
266
269
|
*/
|
|
267
270
|
readonly totalCount: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,IAAI,UAAU,EAAE,UAAU,IAAI,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC7G,OAAO,KAAK,EAAE,QAAQ,IAAI,UAAU,EAAE,UAAU,IAAI,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAEvG,MAAM,MAAM,iBAAiB,GAAG,OAAO,UAAU,GAAG,OAAO,UAAU,CAAC;AACtE,MAAM,MAAM,mBAAmB,GAAG,OAAO,YAAY,GAAG,OAAO,YAAY,CAAC;AAE5E,KAAK,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE/E,KAAK,oBAAoB,CAAC,EAAE,IAAI,EAAE,SAAS,iBAAiB,GACxD,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,GACxB,EAAE,SAAS,mBAAmB,GAC5B,KAAK,CAAC,cAAc,CAAC,EAAE,CAAC,GACxB,iBAAiB,CAAC,EAAE,CAAC,CAAC;AAE5B,MAAM,WAAW,kBAAkB,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,QAAQ,IAAI,UAAU,EAAE,UAAU,I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;OAWG;IACH,MAAM,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAEtC;;;;;;;;;;;OAWG;IACH,OAAO,EAAE,CAAC,UAAU,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAEvC;;;;;;;;;;;OAWG;IACH,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAEpC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,EAAE,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAE9B;;;;;;;;;;;OAWG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,YAAY,GAAG,gBAAgB,CAAC;AAErE,MAAM,MAAM,sBAAsB,GAAG;IACnC,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAC5D,cAAc,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;CACvE,CAAC;AAEF,MAAM,MAAM,0BAA0B,CAAC,CAAC,SAAS,sBAAsB,IAAI,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type NativeScrollEvent, type NativeSyntheticEvent } from 'react-native';
|
|
2
2
|
import type { GestureViewerProps } from './types';
|
|
3
3
|
type UseGestureViewerProps<T = any> = Omit<GestureViewerProps<T>, 'renderItem' | 'renderContainer' | 'ListComponent' | 'listProps' | 'containerStyle' | 'backdropStyle'>;
|
|
4
|
-
export declare const useGestureViewer: <T = any>({ data, initialIndex,
|
|
4
|
+
export declare const useGestureViewer: <T = any>({ data, initialIndex, onDismiss, width: customWidth, dismiss, enableDoubleTapZoom, enablePinchZoom, enableHorizontalSwipe, enablePanWhenZoomed, enableLoop, maxZoomScale, itemSpacing, enableSnapMode, id, }: UseGestureViewerProps<T>) => {
|
|
5
5
|
dataLength: number;
|
|
6
6
|
translateY: import("react-native-reanimated").SharedValue<number>;
|
|
7
7
|
listRef: import("react").RefObject<any>;
|
|
@@ -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,
|
|
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,8MAevC,qBAAqB,CAAC,CAAC,CAAC;;;;;;;;iCA+Jf,oBAAoB,CAAC,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiSlD,CAAC"}
|
|
@@ -3,7 +3,7 @@ import type { GestureViewerController } from './types';
|
|
|
3
3
|
* Hook to control the gesture viewer programmatically.
|
|
4
4
|
*
|
|
5
5
|
* @param id - Viewer instance identifier (default: 'default')
|
|
6
|
-
* @returns Methods
|
|
6
|
+
* @returns Methods for controlling the viewer
|
|
7
7
|
*
|
|
8
8
|
* **Available methods:**
|
|
9
9
|
* - `goToIndex(index: number)` - Navigate to specific index (0 to totalCount-1)
|
|
@@ -12,43 +12,32 @@ import type { GestureViewerController } from './types';
|
|
|
12
12
|
* - `zoomIn(multiplier?: number)` - Zoom in (default: 0.25)
|
|
13
13
|
* - `zoomOut(multiplier?: number)` - Zoom out (default: 0.25)
|
|
14
14
|
* - `resetZoom(scale?: number)` - Reset zoom level (default: 1.0)
|
|
15
|
-
* - `rotate(angle?:
|
|
16
|
-
*
|
|
17
|
-
* **Available state:**
|
|
18
|
-
* - `currentIndex: number` - Current active index (read-only)
|
|
19
|
-
* - `totalCount: number` - Total number of items (read-only)
|
|
15
|
+
* - `rotate(angle?: RotationAngle, clockwise?: boolean)` - Rotate content (default: 90° clockwise)
|
|
20
16
|
*
|
|
21
17
|
* @example
|
|
22
18
|
* ```tsx
|
|
23
|
-
* const
|
|
19
|
+
* const controller = useGestureViewerController();
|
|
24
20
|
*
|
|
25
21
|
* // Navigate to specific index
|
|
26
|
-
* goToIndex(2);
|
|
22
|
+
* controller.goToIndex(2);
|
|
27
23
|
*
|
|
28
24
|
* // Go to next image
|
|
29
|
-
* goToNext();
|
|
25
|
+
* controller.goToNext();
|
|
30
26
|
*
|
|
31
27
|
* // Zoom in by 25%
|
|
32
|
-
* zoomIn();
|
|
28
|
+
* controller.zoomIn();
|
|
33
29
|
*
|
|
34
30
|
* // Zoom out by 50%
|
|
35
|
-
* zoomOut(0.5);
|
|
31
|
+
* controller.zoomOut(0.5);
|
|
36
32
|
*
|
|
37
33
|
* // Reset to original size
|
|
38
|
-
* resetZoom();
|
|
34
|
+
* controller.resetZoom();
|
|
39
35
|
*
|
|
40
36
|
* // Rotate 90 degrees clockwise
|
|
41
|
-
* rotate();
|
|
37
|
+
* controller.rotate();
|
|
42
38
|
*
|
|
43
39
|
* // Rotate 180 degrees
|
|
44
|
-
* rotate(180);
|
|
45
|
-
*
|
|
46
|
-
* // Check current state
|
|
47
|
-
* console.log(`Image ${currentIndex + 1} of ${totalCount}`);
|
|
48
|
-
*
|
|
49
|
-
* // Check navigation availability
|
|
50
|
-
* const canGoNext = currentIndex < totalCount - 1;
|
|
51
|
-
* const canGoPrevious = currentIndex > 0;
|
|
40
|
+
* controller.rotate(180);
|
|
52
41
|
* ```
|
|
53
42
|
*/
|
|
54
43
|
export declare const useGestureViewerController: (id?: string) => GestureViewerController;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGestureViewerController.d.ts","sourceRoot":"","sources":["../../../src/useGestureViewerController.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,
|
|
1
|
+
{"version":3,"file":"useGestureViewerController.d.ts","sourceRoot":"","sources":["../../../src/useGestureViewerController.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAEvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,0BAA0B,GAAI,WAAc,KAAG,uBAqC3D,CAAC"}
|