react-native-gesture-image-viewer 1.0.0 → 1.0.1

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.
@@ -6,27 +6,115 @@ 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
8
  export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
9
+ /**
10
+ * When you want to efficiently manage multiple `GestureViewer` instances, you can use the `id` prop to use multiple `GestureViewer` components.
11
+ * @remark `GestureViewer` automatically removes instances from memory when components are unmounted, so no manual memory management is required.
12
+ * @default 'default'
13
+ */
9
14
  id?: string;
15
+ /**
16
+ * The data to display in the `GestureViewer`.
17
+ */
10
18
  data: T[];
19
+ /**
20
+ * The index of the item to display in the `GestureViewer` when the component is mounted.
21
+ * @default 0
22
+ */
11
23
  initialIndex?: number;
24
+ /**
25
+ * A callback function that is called when the index of the item changes.
26
+ */
12
27
  onIndexChange?: (index: number) => void;
28
+ /**
29
+ * A callback function that is called when the `GestureViewer` is dismissed.
30
+ */
13
31
  onDismiss?: () => void;
32
+ /**
33
+ * A callback function that is called to render the item.
34
+ */
14
35
  renderItem: (item: T, index: number) => React.ReactElement;
36
+ /**
37
+ * A callback function that is called to render the container.
38
+ */
15
39
  renderContainer?: (children: React.ReactElement) => React.ReactElement;
40
+ /**
41
+ * Support for any list component like `ScrollView`, `FlatList`, `FlashList` through the `ListComponent` prop.
42
+ */
16
43
  ListComponent: LC;
44
+ /**
45
+ * The width of the `GestureViewer`.
46
+ * @remark If you don't set this prop, the width of the `GestureViewer` will be the same as the width of the screen.
47
+ * @default screen width
48
+ */
17
49
  width?: number;
50
+ /**
51
+ * `dismissThreshold` controls when `onDismiss` is called by applying a threshold value during vertical gestures.
52
+ * @default 80
53
+ */
18
54
  dismissThreshold?: number;
55
+ /**
56
+ * Calls `onDismiss` function when swiping down.
57
+ * @remark Useful for closing modals with downward swipe gestures.
58
+ * @default true
59
+ */
19
60
  enableDismissGesture?: boolean;
61
+ /**
62
+ * Controls left/right swipe gestures.
63
+ * @remark When `false`, horizontal gestures are disabled.
64
+ * @default true
65
+ */
20
66
  enableSwipeGesture?: boolean;
67
+ /**
68
+ * `resistance` controls the range of vertical movement by applying resistance during vertical gestures.
69
+ * @default 2
70
+ */
21
71
  resistance?: number;
72
+ /**
73
+ * The props to pass to the list component.
74
+ * @remark The `listProps` provides **type inference based on the selected list component**, ensuring accurate autocompletion and type safety in your IDE.
75
+ */
22
76
  listProps?: Partial<ConditionalListProps<LC>>;
77
+ /**
78
+ * The style of the backdrop.
79
+ */
23
80
  backdropStyle?: StyleProp<ViewStyle>;
81
+ /**
82
+ * The style of the container.
83
+ */
24
84
  containerStyle?: StyleProp<ViewStyle>;
85
+ /**
86
+ * By default, the background `opacity` gradually decreases from 1 to 0 during downward swipe gestures.
87
+ * @remark When `false`, this animation is disabled.
88
+ * @default true
89
+ */
25
90
  animateBackdrop?: boolean;
91
+ /**
92
+ * Only works when zoom is active, allows moving item position when zoomed.
93
+ * @remark When `false`, gesture movement is disabled during zoom.
94
+ * @default true
95
+ */
26
96
  enableZoomPanGesture?: boolean;
97
+ /**
98
+ * Controls two-finger pinch gestures.
99
+ * @remark When `false`, two-finger zoom gestures are disabled.
100
+ * @default true
101
+ */
27
102
  enableZoomGesture?: boolean;
103
+ /**
104
+ * Controls double-tap zoom gestures.
105
+ * @remark When `false`, double-tap zoom gestures are disabled.
106
+ * @default true
107
+ */
28
108
  enableDoubleTapGesture?: boolean;
109
+ /**
110
+ * The maximum zoom scale.
111
+ * @default 2
112
+ */
29
113
  maxZoomScale?: number;
114
+ /**
115
+ * The spacing between items.
116
+ * @default 0
117
+ */
30
118
  itemSpacing?: number;
31
119
  }
32
120
  export {};
@@ -1 +1 @@
1
- {"version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AAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACrC;;OAEG;IACH,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACtC;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;OAIG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;OAIG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAC;IACjC;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-gesture-image-viewer",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
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",