react-native-gesture-image-viewer 2.0.0-beta.3 → 2.0.0-beta.5
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 +43 -19
- package/lib/module/GestureTrigger.js +82 -0
- package/lib/module/GestureTrigger.js.map +1 -0
- package/lib/module/GestureViewer.js +14 -8
- 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/GestureViewerRegistry.js +11 -0
- package/lib/module/GestureViewerRegistry.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/useGestureViewer.js +140 -71
- package/lib/module/useGestureViewer.js.map +1 -1
- package/lib/module/useGestureViewerController.js +17 -66
- 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/GestureTrigger.d.ts +55 -0
- package/lib/typescript/src/GestureTrigger.d.ts.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/GestureViewerRegistry.d.ts +5 -0
- package/lib/typescript/src/GestureViewerRegistry.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +116 -58
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/useGestureViewer.d.ts +9 -8
- 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/GestureTrigger.tsx +86 -0
- package/src/GestureViewer.tsx +15 -9
- package/src/GestureViewerManager.ts +9 -9
- package/src/GestureViewerRegistry.ts +16 -0
- package/src/index.tsx +4 -1
- package/src/types.ts +116 -60
- package/src/useGestureViewer.ts +180 -77
- package/src/useGestureViewerController.ts +19 -76
- package/src/useGestureViewerState.ts +85 -0
|
@@ -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","getSn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AC,CAAC,EAAEP,aAAa,CAAC;QACjD;MACF;MAEAF,WAAW,CAAC;QAAEF,YAAY,EAAE,CAAC;QAAEC,UAAU,EAAE;MAAE,CAAC,EAAEG,aAAa,CAAC;IAChE,CAAC,CAAC;IAEF,OAAO,MAAM;MACXI,uBAAuB,CAAC,CAAC;MACzBD,sBAAsB,GAAG,CAAC;IAC5B,CAAC;EACH,CAAC,EACD,CAACT,EAAE,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":[]}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ReactElement } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Minimal contract for a pressable child's props.
|
|
4
|
+
* The child must optionally accept an `onPress` handler.
|
|
5
|
+
*/
|
|
6
|
+
type WithOnPress = {
|
|
7
|
+
onPress?: (...args: unknown[]) => void;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Props for `GestureTrigger`.
|
|
11
|
+
*
|
|
12
|
+
* @typeParam T - The child's props type. Must include an optional `onPress` handler.
|
|
13
|
+
*
|
|
14
|
+
* @property id - Optional identifier to associate this trigger with a `GestureViewer`.
|
|
15
|
+
* @property children - A single React element whose props include `onPress` (e.g., `Pressable`, `Touchable*`).
|
|
16
|
+
* @property onPress - Optional handler invoked after the child's own `onPress`.
|
|
17
|
+
*/
|
|
18
|
+
export type GestureTriggerProps<T extends WithOnPress> = {
|
|
19
|
+
id?: string;
|
|
20
|
+
children: ReactElement<T>;
|
|
21
|
+
onPress?: (...args: unknown[]) => void;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Wraps a pressable child element and registers its native view as a trigger for `GestureViewer`.
|
|
25
|
+
*
|
|
26
|
+
* @remark
|
|
27
|
+
* Behavior on press:
|
|
28
|
+
* - Registers the child's native node to the internal registry under the given `id`.
|
|
29
|
+
* - Invokes the child's own `onPress` first (if provided).
|
|
30
|
+
* - Invokes the `onPress` passed to `GestureTrigger` next (if provided).
|
|
31
|
+
*
|
|
32
|
+
* Type parameters:
|
|
33
|
+
* - `T` — The child's props type. Must include an optional `onPress` handler, ensuring the child is pressable.
|
|
34
|
+
*
|
|
35
|
+
* Props:
|
|
36
|
+
* - `id` — Optional identifier to associate this trigger with a `GestureViewer`. Defaults to `"default"`.
|
|
37
|
+
* - `children` — A single React element whose props include `onPress` (e.g., `Pressable`, `Touchable*`, custom button).
|
|
38
|
+
* - `onPress` — Optional handler invoked after the child's `onPress`. Receives the same arguments as the child's handler.
|
|
39
|
+
*
|
|
40
|
+
* Notes:
|
|
41
|
+
* - If neither the child nor this component provides `onPress`, a dev warning is logged and nothing happens on press.
|
|
42
|
+
* - Only a single child is allowed; wrap lists using `React.Children.map` when needed.
|
|
43
|
+
*
|
|
44
|
+
* Example:
|
|
45
|
+
* ```tsx
|
|
46
|
+
* <GestureTrigger id="gallery" onPress={() => openModal(index)}>
|
|
47
|
+
* <Pressable style={styles.thumb}>
|
|
48
|
+
* <Image source={{ uri }} style={styles.thumbImage} />
|
|
49
|
+
* </Pressable>
|
|
50
|
+
* </GestureTrigger>
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export declare function GestureTrigger<T extends WithOnPress>({ id, children, onPress }: GestureTriggerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=GestureTrigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GestureTrigger.d.ts","sourceRoot":"","sources":["../../../src/GestureTrigger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAK1C;;;GAGG;AACH,KAAK,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAA;CAAE,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,SAAS,WAAW,IAAI;IACvD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAC1B,OAAO,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;CACxC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,WAAW,EAAE,EAAE,EAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,mBAAmB,CAAC,CAAC,CAAC,2CA6BlH"}
|
|
@@ -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,2CA8J3B"}
|
|
@@ -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,c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,aAEV;IAEF,QAAQ,aAEN;IAEF,OAAO;IAeP,OAAO,CAAC,kBAAkB,CAGxB;CACH;AAED,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
import type { View } from 'react-native';
|
|
1
2
|
import GestureViewerManager from './GestureViewerManager';
|
|
2
3
|
declare class GestureViewerRegistry {
|
|
3
4
|
private managers;
|
|
4
5
|
private subscribers;
|
|
6
|
+
private triggers;
|
|
5
7
|
subscribeToManager(id: string, callback: (manager: GestureViewerManager | null) => void): () => void;
|
|
6
8
|
createManager(id: string): GestureViewerManager | null;
|
|
7
9
|
getManager(id: string): GestureViewerManager | null;
|
|
8
10
|
deleteManager(id: string): void;
|
|
9
11
|
notifySubscribers(id: string, manager: GestureViewerManager | null): void;
|
|
12
|
+
setTriggerNode(id: string, node: View | null): void;
|
|
13
|
+
getTriggerNode(id: string): View | null;
|
|
14
|
+
clearTriggerNode(id: string): void;
|
|
10
15
|
}
|
|
11
16
|
export declare const registry: GestureViewerRegistry;
|
|
12
17
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GestureViewerRegistry.d.ts","sourceRoot":"","sources":["../../../src/GestureViewerRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,cAAM,qBAAqB;IACzB,OAAO,CAAC,QAAQ,CAA2C;IAC3D,OAAO,CAAC,WAAW,CAA0E;
|
|
1
|
+
{"version":3,"file":"GestureViewerRegistry.d.ts","sourceRoot":"","sources":["../../../src/GestureViewerRegistry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAE1D,cAAM,qBAAqB;IACzB,OAAO,CAAC,QAAQ,CAA2C;IAC3D,OAAO,CAAC,WAAW,CAA0E;IAC7F,OAAO,CAAC,QAAQ,CAAkC;IAElD,kBAAkB,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,OAAO,EAAE,oBAAoB,GAAG,IAAI,KAAK,IAAI;IAsBvF,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI;IAatD,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,oBAAoB,GAAG,IAAI;IAInD,aAAa,CAAC,EAAE,EAAE,MAAM;IAaxB,iBAAiB,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,IAAI;IAQlE,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,IAAI;IAI5C,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI;IAIvC,gBAAgB,CAAC,EAAE,EAAE,MAAM;CAG5B;AAED,eAAO,MAAM,QAAQ,uBAA8B,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
export type { GestureTriggerProps } from './GestureTrigger';
|
|
2
|
+
export { GestureTrigger } from './GestureTrigger';
|
|
1
3
|
export { GestureViewer } from './GestureViewer';
|
|
2
|
-
export type { GestureViewerController,
|
|
4
|
+
export type { GestureViewerController, GestureViewerEventCallback, GestureViewerEventData, GestureViewerEventType, GestureViewerProps, GestureViewerState, } from './types';
|
|
3
5
|
export { useGestureViewerController } from './useGestureViewerController';
|
|
4
6
|
export { useGestureViewerEvent } from './useGestureViewerEvent';
|
|
7
|
+
export { useGestureViewerState } from './useGestureViewerState';
|
|
5
8
|
//# 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,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,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"}
|
|
@@ -1,11 +1,34 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { FlatList as RNFlatList, ScrollView as RNScrollView, StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type { FlatList as GHFlatList, ScrollView as GHScrollView } from 'react-native-gesture-handler';
|
|
4
|
+
import type { WithTimingConfig } from 'react-native-reanimated';
|
|
4
5
|
export type FlatListComponent = typeof RNFlatList | typeof GHFlatList;
|
|
5
6
|
export type ScrollViewComponent = typeof RNScrollView | typeof GHScrollView;
|
|
6
7
|
type GetComponentProps<T> = T extends React.ComponentType<infer P> ? P : never;
|
|
7
8
|
type ConditionalListProps<LC> = LC extends FlatListComponent ? React.ComponentProps<LC> : LC extends ScrollViewComponent ? React.ComponentProps<LC> : GetComponentProps<LC>;
|
|
8
|
-
export
|
|
9
|
+
export type TriggerRect = {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
};
|
|
15
|
+
export interface TriggerAnimationConfig extends WithTimingConfig {
|
|
16
|
+
/**
|
|
17
|
+
* Animation duration in milliseconds
|
|
18
|
+
* @defaultValue 300
|
|
19
|
+
*/
|
|
20
|
+
duration?: WithTimingConfig['duration'];
|
|
21
|
+
/**
|
|
22
|
+
* Animation easing function
|
|
23
|
+
* @defaultValue Easing.bezier(0.25, 0.1, 0.25, 1.0)
|
|
24
|
+
*/
|
|
25
|
+
easing?: WithTimingConfig['easing'];
|
|
26
|
+
/**
|
|
27
|
+
* Callback function called after animation completion
|
|
28
|
+
*/
|
|
29
|
+
onAnimationComplete?: () => void;
|
|
30
|
+
}
|
|
31
|
+
export interface GestureViewerProps<T = any, LC = typeof RNScrollView> {
|
|
9
32
|
/**
|
|
10
33
|
* When you want to efficiently manage multiple `GestureViewer` instances, you can use the `id` prop to use multiple `GestureViewer` components.
|
|
11
34
|
* @remark `GestureViewer` automatically removes instances from memory when components are unmounted, so no manual memory management is required.
|
|
@@ -21,22 +44,31 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
|
|
|
21
44
|
* @defaultValue 0
|
|
22
45
|
*/
|
|
23
46
|
initialIndex?: number;
|
|
24
|
-
/**
|
|
25
|
-
* A callback function that is called when the index of the item changes.
|
|
26
|
-
*/
|
|
27
|
-
onIndexChange?: (index: number) => void;
|
|
28
47
|
/**
|
|
29
48
|
* A callback function that is called when the `GestureViewer` is dismissed.
|
|
30
49
|
*/
|
|
31
50
|
onDismiss?: () => void;
|
|
51
|
+
/**
|
|
52
|
+
* A callback function that is called when the dismiss interaction starts.
|
|
53
|
+
* @remarks Useful to hide external UI (e.g., headers, buttons) while the dismiss gesture/animation is in progress.
|
|
54
|
+
*/
|
|
55
|
+
onDismissStart?: () => void;
|
|
32
56
|
/**
|
|
33
57
|
* A callback function that is called to render the item.
|
|
34
58
|
*/
|
|
35
59
|
renderItem: (item: T, index: number) => React.ReactElement;
|
|
36
60
|
/**
|
|
37
61
|
* A callback function that is called to render the container.
|
|
62
|
+
* @remarks Useful for composing additional UI (e.g., close button, toolbars) around the viewer.
|
|
63
|
+
* The second argument provides control helpers such as `dismiss()` to close the viewer.
|
|
64
|
+
*
|
|
65
|
+
* @param children - The viewer content to be rendered inside your container.
|
|
66
|
+
* @param helpers - Control helpers for the viewer. Currently includes `dismiss()`.
|
|
67
|
+
* @returns A React element that wraps and renders the provided `children`.
|
|
38
68
|
*/
|
|
39
|
-
renderContainer?: (children: React.ReactElement
|
|
69
|
+
renderContainer?: (children: React.ReactElement, helpers: {
|
|
70
|
+
dismiss: () => void;
|
|
71
|
+
}) => React.ReactElement;
|
|
40
72
|
/**
|
|
41
73
|
* Support for any list component like `ScrollView`, `FlatList`, `FlashList` through the `ListComponent` prop.
|
|
42
74
|
*/
|
|
@@ -47,42 +79,6 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
|
|
|
47
79
|
* @defaultValue screen width
|
|
48
80
|
*/
|
|
49
81
|
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
82
|
/**
|
|
87
83
|
* The props to pass to the list component.
|
|
88
84
|
* @remark The `listProps` provides **type inference based on the selected list component**, ensuring accurate autocompletion and type safety in your IDE.
|
|
@@ -97,45 +93,105 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
|
|
|
97
93
|
*/
|
|
98
94
|
containerStyle?: StyleProp<ViewStyle>;
|
|
99
95
|
/**
|
|
100
|
-
*
|
|
101
|
-
* @remark
|
|
96
|
+
* Dismiss gesture options. Calls `onDismiss` function when swiping down.
|
|
97
|
+
* @remark Useful for closing modals with downward swipe gestures.
|
|
98
|
+
*/
|
|
99
|
+
dismiss?: {
|
|
100
|
+
/**
|
|
101
|
+
* When `false`, dismiss gesture is disabled.
|
|
102
|
+
* @defaultValue true
|
|
103
|
+
*/
|
|
104
|
+
enabled?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* `threshold` controls when `onDismiss` is called by applying a threshold value during vertical gestures.
|
|
107
|
+
* @defaultValue 80
|
|
108
|
+
*/
|
|
109
|
+
threshold?: number;
|
|
110
|
+
/**
|
|
111
|
+
* `resistance` controls the range of vertical movement by applying resistance during dismiss gestures.
|
|
112
|
+
* @defaultValue 2
|
|
113
|
+
*/
|
|
114
|
+
resistance?: number;
|
|
115
|
+
/**
|
|
116
|
+
* By default, the background `opacity` gradually decreases from 1 to 0 during downward swipe gestures.
|
|
117
|
+
* @remark When `false`, this animation is disabled.
|
|
118
|
+
* @defaultValue true
|
|
119
|
+
*/
|
|
120
|
+
fadeBackdrop?: boolean;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Controls left/right swipe gestures.
|
|
124
|
+
* @remark When `false`, horizontal gestures are disabled.
|
|
102
125
|
* @defaultValue true
|
|
103
126
|
*/
|
|
104
|
-
|
|
127
|
+
enableHorizontalSwipe?: boolean;
|
|
105
128
|
/**
|
|
106
129
|
* Only works when zoom is active, allows moving item position when zoomed.
|
|
107
130
|
* @remark When `false`, gesture movement is disabled during zoom.
|
|
108
131
|
* @defaultValue true
|
|
109
132
|
*/
|
|
110
|
-
|
|
133
|
+
enablePanWhenZoomed?: boolean;
|
|
111
134
|
/**
|
|
112
135
|
* Controls two-finger pinch gestures.
|
|
113
136
|
* @remark When `false`, two-finger zoom gestures are disabled.
|
|
114
137
|
* @defaultValue true
|
|
115
138
|
*/
|
|
116
|
-
|
|
139
|
+
enablePinchZoom?: boolean;
|
|
117
140
|
/**
|
|
118
141
|
* Controls double-tap zoom gestures.
|
|
119
142
|
* @remark When `false`, double-tap zoom gestures are disabled.
|
|
120
143
|
* @defaultValue true
|
|
121
144
|
*/
|
|
122
|
-
|
|
145
|
+
enableDoubleTapZoom?: boolean;
|
|
123
146
|
/**
|
|
124
147
|
* Enables infinite loop navigation.
|
|
125
148
|
* @defaultValue false
|
|
126
149
|
*/
|
|
127
150
|
enableLoop?: boolean;
|
|
128
151
|
/**
|
|
129
|
-
*
|
|
130
|
-
*
|
|
152
|
+
* Enables snap scrolling mode.
|
|
153
|
+
*
|
|
154
|
+
* @remark
|
|
155
|
+
* **`false` (default)**: Paging mode (`pagingEnabled: true`)
|
|
156
|
+
* - Scrolls by full screen size increments
|
|
157
|
+
*
|
|
158
|
+
* **`true`**: Snap mode (`snapToInterval` auto-calculated)
|
|
159
|
+
* - `snapToInterval` is automatically calculated based on `width` and `itemSpacing` values
|
|
160
|
+
* - Use this option when you need item spacing
|
|
161
|
+
* @defaultValue false
|
|
162
|
+
*
|
|
131
163
|
*/
|
|
132
|
-
|
|
164
|
+
enableSnapMode?: boolean;
|
|
133
165
|
/**
|
|
134
166
|
* The spacing between items in pixels.
|
|
135
|
-
* @remark Only applied when `
|
|
167
|
+
* @remark Only applied when `enableSnapMode` is `true`.
|
|
136
168
|
* @defaultValue 0
|
|
137
169
|
*/
|
|
138
170
|
itemSpacing?: number;
|
|
171
|
+
/**
|
|
172
|
+
* The maximum zoom scale.
|
|
173
|
+
* @defaultValue 2
|
|
174
|
+
*/
|
|
175
|
+
maxZoomScale?: number;
|
|
176
|
+
/**
|
|
177
|
+
* Trigger-based animation settings
|
|
178
|
+
* @remarks You can customize animation duration, easing, and system reduce-motion behavior.
|
|
179
|
+
*
|
|
180
|
+
* @example
|
|
181
|
+
* ```tsx
|
|
182
|
+
* <GestureViewer
|
|
183
|
+
* triggerAnimation={{
|
|
184
|
+
* duration: 250,
|
|
185
|
+
* easing: Easing.out(Easing.cubic),
|
|
186
|
+
* reduceMotion: 'system',
|
|
187
|
+
* onAnimationComplete: () => {
|
|
188
|
+
* console.log('Animation complete');
|
|
189
|
+
* },
|
|
190
|
+
* }}
|
|
191
|
+
* />
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
triggerAnimation?: TriggerAnimationConfig;
|
|
139
195
|
}
|
|
140
196
|
/**
|
|
141
197
|
* Supported rotation angles in degrees.
|
|
@@ -155,8 +211,10 @@ export type GestureViewerController = {
|
|
|
155
211
|
*
|
|
156
212
|
* @example
|
|
157
213
|
* ```typescript
|
|
214
|
+
* const { totalCount } = useGestureViewerState();
|
|
215
|
+
*
|
|
158
216
|
* controller.goToIndex(0); // Go to first item
|
|
159
|
-
* controller.goToIndex(
|
|
217
|
+
* controller.goToIndex(totalCount - 1); // Go to last item
|
|
160
218
|
* ```
|
|
161
219
|
*/
|
|
162
220
|
goToIndex: (index: number) => void;
|
|
@@ -234,12 +292,12 @@ export type GestureViewerController = {
|
|
|
234
292
|
* ```
|
|
235
293
|
*/
|
|
236
294
|
rotate: (angle?: RotationAngle, clockwise?: boolean) => void;
|
|
237
|
-
}
|
|
295
|
+
};
|
|
238
296
|
/**
|
|
239
297
|
* State information for the gesture viewer controller.
|
|
240
298
|
* Contains read-only properties that reflect the current state.
|
|
241
299
|
*/
|
|
242
|
-
export type
|
|
300
|
+
export type GestureViewerState = {
|
|
243
301
|
/**
|
|
244
302
|
* The current index of the active item in the viewer.
|
|
245
303
|
*
|
|
@@ -248,7 +306,7 @@ export type GestureViewerControllerState = {
|
|
|
248
306
|
*
|
|
249
307
|
* @example
|
|
250
308
|
* ```typescript
|
|
251
|
-
* console.log(`Currently viewing item ${
|
|
309
|
+
* console.log(`Currently viewing item ${currentIndex + 1} of ${totalCount}`);
|
|
252
310
|
* ```
|
|
253
311
|
*/
|
|
254
312
|
readonly currentIndex: number;
|
|
@@ -260,8 +318,8 @@ export type GestureViewerControllerState = {
|
|
|
260
318
|
*
|
|
261
319
|
* @example
|
|
262
320
|
* ```typescript
|
|
263
|
-
* const hasNext =
|
|
264
|
-
* const hasPrevious =
|
|
321
|
+
* const hasNext = currentIndex < totalCount - 1;
|
|
322
|
+
* const hasPrevious = currentIndex > 0;
|
|
265
323
|
* ```
|
|
266
324
|
*/
|
|
267
325
|
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;
|
|
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,I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C,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,9 +1,8 @@
|
|
|
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, onDismissStart, triggerAnimation, }: UseGestureViewerProps<T>) => {
|
|
5
5
|
dataLength: number;
|
|
6
|
-
translateY: import("react-native-reanimated").SharedValue<number>;
|
|
7
6
|
listRef: import("react").RefObject<any>;
|
|
8
7
|
isZoomed: boolean;
|
|
9
8
|
isRotated: boolean;
|
|
@@ -11,26 +10,28 @@ export declare const useGestureViewer: <T = any>({ data, initialIndex, onIndexCh
|
|
|
11
10
|
zoomGesture: import("react-native-gesture-handler/lib/typescript/handlers/gestures/gestureComposition").ComposedGesture;
|
|
12
11
|
onMomentumScrollEnd: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
|
|
13
12
|
onScrollBeginDrag: () => void;
|
|
13
|
+
handleDismiss: () => void;
|
|
14
14
|
animatedStyle: {
|
|
15
|
+
opacity: number;
|
|
15
16
|
transform: ({
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
translateX: number;
|
|
18
|
+
translateY?: undefined;
|
|
18
19
|
scale?: undefined;
|
|
19
20
|
rotate?: undefined;
|
|
20
21
|
} | {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
translateY: number;
|
|
23
|
+
translateX?: undefined;
|
|
23
24
|
scale?: undefined;
|
|
24
25
|
rotate?: undefined;
|
|
25
26
|
} | {
|
|
26
27
|
scale: number;
|
|
27
|
-
translateY?: undefined;
|
|
28
28
|
translateX?: undefined;
|
|
29
|
+
translateY?: undefined;
|
|
29
30
|
rotate?: undefined;
|
|
30
31
|
} | {
|
|
31
32
|
rotate: string;
|
|
32
|
-
translateY?: undefined;
|
|
33
33
|
translateX?: undefined;
|
|
34
|
+
translateY?: undefined;
|
|
34
35
|
scale?: undefined;
|
|
35
36
|
})[];
|
|
36
37
|
};
|
|
@@ -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,
|
|
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;AAG/D,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,gPAiBvC,qBAAqB,CAAC,CAAC,CAAC;;;;;;;iCAuRf,oBAAoB,CAAC,iBAAiB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0SlD,CAAC"}
|