react-native-gesture-image-viewer 1.7.0 → 1.7.2

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.
@@ -22,7 +22,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
22
22
  /**
23
23
  * Wraps a pressable child element and registers its native view as a trigger for `GestureViewer`.
24
24
  *
25
- * @remark
25
+ * @remarks
26
26
  * Behavior on press:
27
27
  * - Registers the child's native node to the internal registry under the given `id`.
28
28
  * - Invokes the child's own `onPress` first (if provided).
@@ -28,7 +28,8 @@ export function GestureViewer({
28
28
  const Component = ListComponent;
29
29
  const dataRef = useRef(data);
30
30
  const {
31
- width: screenWidth
31
+ width: screenWidth,
32
+ height: screenHeight
32
33
  } = useWindowDimensions();
33
34
  const width = useSnap ? customWidth || screenWidth : screenWidth;
34
35
  const loopData = useMemo(() => createLoopData(dataRef, enableLoop), [enableLoop]);
@@ -67,14 +68,12 @@ export function GestureViewer({
67
68
  return /*#__PURE__*/_jsx(View, {
68
69
  style: [{
69
70
  width,
70
- height: '100%',
71
- justifyContent: 'center',
72
- alignItems: 'center',
71
+ height: screenHeight,
73
72
  marginHorizontal: itemSpacing / 2
74
- }],
73
+ }, styles.item],
75
74
  children: renderItemProp(item, index)
76
75
  }, isScrollView ? keyExtractor(item, index) : undefined);
77
- }, [width, itemSpacing, renderItemProp, keyExtractor, isScrollView]);
76
+ }, [width, itemSpacing, renderItemProp, keyExtractor, isScrollView, screenHeight]);
78
77
  const getItemLayout = useCallback((_, index) => ({
79
78
  length: width + itemSpacing,
80
79
  offset: (width + itemSpacing) * index,
@@ -138,11 +137,12 @@ export function GestureViewer({
138
137
  renderItem: renderItem,
139
138
  initialScrollIndex: enableLoop && data.length > 1 ? initialIndex + 1 : initialIndex,
140
139
  keyExtractor: keyExtractor,
141
- windowSize: 3,
142
- maxToRenderPerBatch: 3,
143
140
  getItemLayout: getItemLayout,
144
- ...(isFlashListLike(Component) && {
141
+ ...(isFlashListLike(Component) ? {
145
142
  estimatedItemSize: width + itemSpacing
143
+ } : {
144
+ windowSize: 3,
145
+ maxToRenderPerBatch: 3
146
146
  }),
147
147
  ...(Platform.OS === 'web' && isFlatListLike(Component) && {
148
148
  dataSet: {
@@ -163,6 +163,10 @@ const styles = StyleSheet.create({
163
163
  container: {
164
164
  flex: 1
165
165
  },
166
+ item: {
167
+ justifyContent: 'center',
168
+ alignItems: 'center'
169
+ },
166
170
  content: {
167
171
  flex: 1,
168
172
  width: '100%',
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useEffect","useMemo","useRef","Platform","StyleSheet","useWindowDimensions","View","Gesture","GestureDetector","GestureHandlerRootView","Animated","registry","useGestureViewer","createLoopData","isFlashListLike","isFlatListLike","isScrollViewLike","WebPagingFixStyle","jsx","_jsx","jsxs","_jsxs","GestureViewer","id","data","renderItem","renderItemProp","renderContainer","ListComponent","width","customWidth","listProps","backdropStyle","backdropStyleProps","containerStyle","initialIndex","itemSpacing","useSnap","enableLoop","props","Component","dataRef","screenWidth","loopData","isScrollView","listRef","isZoomed","isRotated","dismissGesture","zoomGesture","onMomentumScrollEnd","onScrollBeginDrag","handleDismiss","animatedStyle","keyExtractor","item","index","style","height","justifyContent","alignItems","marginHorizontal","children","undefined","getItemLayout","_","length","offset","gesture","Race","current","createManager","deleteManager","commonProps","horizontal","scrollEnabled","showsHorizontalScrollIndicator","snapToInterval","snapToAlignment","decelerationRate","pagingEnabled","scrollEventThrottle","removeClippedSubviews","control","dismiss","listComponent","styles","container","background","content","OS","dataSet","ref","map","initialScrollIndex","windowSize","maxToRenderPerBatch","estimatedItemSize","create","flex","position","top","left","right","bottom","backgroundColor"],"sourceRoot":"../../src","sources":["GestureViewer.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC/D,SAAwBC,QAAQ,EAAwBC,UAAU,EAAEC,mBAAmB,EAAEC,IAAI,QAAQ,cAAc;AACnH,S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AAEyD,iBAAiB,EAAEpE,KAAK,GAAGO;YAAY,CAAC;YAAA,IAExEjC,QAAQ,CAACuF,EAAE,KAAK,KAAK,IACxB3E,cAAc,CAACyB,SAAS,CAAC,IAAI;cAAEmD,OAAO,EAAE;gBAAE,8BAA8B,EAAE;cAAK;YAAE,CAAC;YAAA,GAChF5D;UAAS,CACd;QAEJ,CACY,CAAC,eAChBZ,IAAA,CAACF,iBAAiB;UAACuB,SAAS,EAAEA;QAAU,CAAE,CAAC;MAAA,CACvC;IAAC,CACQ;EAAC,CACI,CACzB;EAED,OAAOb,eAAe,GAAGA,eAAe,CAAC0D,aAAa,EAAEF,OAAO,CAAC,GAAGE,aAAa;AAClF;AAEA,MAAMC,MAAM,GAAGlF,UAAU,CAAC8F,MAAM,CAAC;EAC/BX,SAAS,EAAE;IACTY,IAAI,EAAE;EACR,CAAC;EACDV,OAAO,EAAE;IACPU,IAAI,EAAE,CAAC;IACPtE,KAAK,EAAE,MAAM;IACb6B,MAAM,EAAE;EACV,CAAC;EACD8B,UAAU,EAAE;IACVY,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,eAAe,EAAE;EACnB;AACF,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["useCallback","useEffect","useMemo","useRef","Platform","StyleSheet","useWindowDimensions","View","Gesture","GestureDetector","GestureHandlerRootView","Animated","registry","useGestureViewer","createLoopData","isFlashListLike","isFlatListLike","isScrollViewLike","WebPagingFixStyle","jsx","_jsx","jsxs","_jsxs","GestureViewer","id","data","renderItem","renderItemProp","renderContainer","ListComponent","width","customWidth","listProps","backdropStyle","backdropStyleProps","containerStyle","initialIndex","itemSpacing","useSnap","enableLoop","props","Component","dataRef","screenWidth","height","screenHeight","loopData","isScrollView","listRef","isZoomed","isRotated","dismissGesture","zoomGesture","onMomentumScrollEnd","onScrollBeginDrag","handleDismiss","animatedStyle","keyExtractor","item","index","style","marginHorizontal","styles","children","undefined","getItemLayout","_","length","offset","gesture","Race","current","createManager","deleteManager","commonProps","horizontal","scrollEnabled","showsHorizontalScrollIndicator","snapToInterval","snapToAlignment","decelerationRate","pagingEnabled","scrollEventThrottle","removeClippedSubviews","control","dismiss","listComponent","container","background","content","OS","dataSet","ref","map","initialScrollIndex","estimatedItemSize","windowSize","maxToRenderPerBatch","create","flex","justifyContent","alignItems","position","top","left","right","bottom","backgroundColor"],"sourceRoot":"../../src","sources":["GestureViewer.tsx"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,MAAM,QAAQ,OAAO;AAC/D,SAAwBC,QAAQ,EAAwBC,UAAU,EAAEC,mBAAmB,EAAEC,IAAI,QAAQ,cAAc;AACnH,SAASC,OAAO,EAAEC,eAAe,EAAEC,sBAAsB,QAAQ,8BAA8B;AAC/F,OAAOC,QAAQ,MAAM,yBAAyB;AAC9C,SAASC,QAAQ,QAAQ,4BAAyB;AAElD,SAASC,gBAAgB,QAAQ,uBAAoB;AACrD,SAASC,cAAc,EAAEC,eAAe,EAAEC,cAAc,EAAEC,gBAAgB,QAAQ,YAAS;AAC3F,OAAOC,iBAAiB,MAAM,wBAAqB;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEpD,OAAO,SAASC,aAAaA,CAAgC;EAC3DC,EAAE,GAAG,SAAS;EACdC,IAAI;EACJC,UAAU,EAAEC,cAAc;EAC1BC,eAAe;EACfC,aAAa;EACbC,KAAK,EAAEC,WAAW;EAClBC,SAAS;EACTC,aAAa,EAAEC,kBAAkB;EACjCC,cAAc;EACdC,YAAY,GAAG,CAAC;EAChBC,WAAW,GAAG,CAAC;EACfC,OAAO,GAAG,KAAK;EACfC,UAAU,GAAG,KAAK;EAClB,GAAGC;AACsB,CAAC,EAAE;EAC5B,MAAMC,SAAS,GAAGZ,aAAyC;EAE3D,MAAMa,OAA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AE,MAAM;IACbc,MAAM,EAAE;EACV,CAAC;EACD4C,UAAU,EAAE;IACVc,QAAQ,EAAE,UAAU;IACpBC,GAAG,EAAE,CAAC;IACNC,IAAI,EAAE,CAAC;IACPC,KAAK,EAAE,CAAC;IACRC,MAAM,EAAE,CAAC;IACTC,eAAe,EAAE;EACnB;AACF,CAAC,CAAC","ignoreList":[]}
@@ -23,7 +23,7 @@ export type GestureTriggerProps<T extends WithOnPress> = {
23
23
  /**
24
24
  * Wraps a pressable child element and registers its native view as a trigger for `GestureViewer`.
25
25
  *
26
- * @remark
26
+ * @remarks
27
27
  * Behavior on press:
28
28
  * - Registers the child's native node to the internal registry under the given `id`.
29
29
  * - Invokes the child's own `onPress` first (if provided).
@@ -1 +1 @@
1
- {"version":3,"file":"GestureViewer.d.ts","sourceRoot":"","sources":["../../../src/GestureViewer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAyE,MAAM,cAAc,CAAC;AAIpH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,OAAO,QAAQ,EAAE,EAC3D,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,OAAe,EACf,UAAkB,EAClB,GAAG,KAAK,EACT,EAAE,kBAAkB,CAAC,CAAC,EAAE,EAAE,CAAC,2CA8J3B"}
1
+ {"version":3,"file":"GestureViewer.d.ts","sourceRoot":"","sources":["../../../src/GestureViewer.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAyE,MAAM,cAAc,CAAC;AAIpH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAKlD,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,EAAE,GAAG,OAAO,QAAQ,EAAE,EAC3D,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,OAAe,EACf,UAAkB,EAClB,GAAG,KAAK,EACT,EAAE,kBAAkB,CAAC,CAAC,EAAE,EAAE,CAAC,2CA6J3B"}
@@ -31,7 +31,7 @@ export interface TriggerAnimationConfig extends WithTimingConfig {
31
31
  export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
32
32
  /**
33
33
  * When you want to efficiently manage multiple `GestureViewer` instances, you can use the `id` prop to use multiple `GestureViewer` components.
34
- * @remark `GestureViewer` automatically removes instances from memory when components are unmounted, so no manual memory management is required.
34
+ * @remarks `GestureViewer` automatically removes instances from memory when components are unmounted, so no manual memory management is required.
35
35
  * @defaultValue 'default'
36
36
  */
37
37
  id?: string;
@@ -79,14 +79,14 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
79
79
  ListComponent: LC;
80
80
  /**
81
81
  * The width of the `GestureViewer`.
82
- * @remark If you don't set this prop, the width of the `GestureViewer` will be the same as the width of the screen.
82
+ * @remarks If you don't set this prop, the width of the `GestureViewer` will be the same as the width of the screen.
83
83
  * @defaultValue screen width
84
84
  */
85
85
  width?: number;
86
86
  /**
87
87
  * Enables snap scrolling mode.
88
88
  *
89
- * @remark
89
+ * @remarks
90
90
  * **`false` (default)**: Paging mode (`pagingEnabled: true`)
91
91
  * - Scrolls by full screen size increments
92
92
  *
@@ -104,13 +104,13 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
104
104
  dismissThreshold?: number;
105
105
  /**
106
106
  * Calls `onDismiss` function when swiping down.
107
- * @remark Useful for closing modals with downward swipe gestures.
107
+ * @remarks Useful for closing modals with downward swipe gestures.
108
108
  * @defaultValue true
109
109
  */
110
110
  enableDismissGesture?: boolean;
111
111
  /**
112
112
  * Controls left/right swipe gestures.
113
- * @remark When `false`, horizontal gestures are disabled.
113
+ * @remarks When `false`, horizontal gestures are disabled.
114
114
  * @defaultValue true
115
115
  */
116
116
  enableSwipeGesture?: boolean;
@@ -121,7 +121,7 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
121
121
  resistance?: number;
122
122
  /**
123
123
  * The props to pass to the list component.
124
- * @remark The `listProps` provides **type inference based on the selected list component**, ensuring accurate autocompletion and type safety in your IDE.
124
+ * @remarks The `listProps` provides **type inference based on the selected list component**, ensuring accurate autocompletion and type safety in your IDE.
125
125
  */
126
126
  listProps?: Partial<ConditionalListProps<LC>>;
127
127
  /**
@@ -134,25 +134,25 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
134
134
  containerStyle?: StyleProp<ViewStyle>;
135
135
  /**
136
136
  * By default, the background `opacity` gradually decreases from 1 to 0 during downward swipe gestures.
137
- * @remark When `false`, this animation is disabled.
137
+ * @remarks When `false`, this animation is disabled.
138
138
  * @defaultValue true
139
139
  */
140
140
  animateBackdrop?: boolean;
141
141
  /**
142
142
  * Only works when zoom is active, allows moving item position when zoomed.
143
- * @remark When `false`, gesture movement is disabled during zoom.
143
+ * @remarks When `false`, gesture movement is disabled during zoom.
144
144
  * @defaultValue true
145
145
  */
146
146
  enableZoomPanGesture?: boolean;
147
147
  /**
148
148
  * Controls two-finger pinch gestures.
149
- * @remark When `false`, two-finger zoom gestures are disabled.
149
+ * @remarks When `false`, two-finger zoom gestures are disabled.
150
150
  * @defaultValue true
151
151
  */
152
152
  enableZoomGesture?: boolean;
153
153
  /**
154
154
  * Controls double-tap zoom gestures.
155
- * @remark When `false`, double-tap zoom gestures are disabled.
155
+ * @remarks When `false`, double-tap zoom gestures are disabled.
156
156
  * @defaultValue true
157
157
  */
158
158
  enableDoubleTapGesture?: boolean;
@@ -168,7 +168,7 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
168
168
  maxZoomScale?: number;
169
169
  /**
170
170
  * The spacing between items in pixels.
171
- * @remark Only applied when `useSnap` is `true`.
171
+ * @remarks Only applied when `useSnap` is `true`.
172
172
  * @defaultValue 0
173
173
  */
174
174
  itemSpacing?: number;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "react-native-gesture-image-viewer",
3
- "version": "1.7.0",
4
- "description": "🖼️ A highly customizable and easy-to-use React Native image viewer with gesture support and external controls",
3
+ "version": "1.7.2",
4
+ "description": "🖼️ React Native Image Viewer - Reanimated-powered image gestures with full control",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
7
7
  "exports": {
@@ -59,11 +59,20 @@
59
59
  "photo-viewer",
60
60
  "image-carousel",
61
61
  "touch-gestures",
62
- "react-native-reanimated",
63
- "react-native-gesture-handler",
64
62
  "lightbox",
65
63
  "gallery",
66
- "viewer"
64
+ "viewer",
65
+ "zoomable",
66
+ "double-tap",
67
+ "image viewer",
68
+ "react native image viewer",
69
+ "react-native-reanimated",
70
+ "react-native-gesture-handler",
71
+ "react-native-viewer",
72
+ "react-native-image-viewer",
73
+ "react-native-image-gallery",
74
+ "react-native-reanimated-image-viewer",
75
+ "react-native-image-zoom-viewer"
67
76
  ],
68
77
  "repository": {
69
78
  "type": "git",
@@ -27,7 +27,7 @@ export type GestureTriggerProps<T extends WithOnPress> = {
27
27
  /**
28
28
  * Wraps a pressable child element and registers its native view as a trigger for `GestureViewer`.
29
29
  *
30
- * @remark
30
+ * @remarks
31
31
  * Behavior on press:
32
32
  * - Registers the child's native node to the internal registry under the given `id`.
33
33
  * - Invokes the child's own `onPress` first (if provided).
@@ -28,7 +28,7 @@ export function GestureViewer<T = any, LC = typeof FlatList>({
28
28
 
29
29
  const dataRef = useRef(data);
30
30
 
31
- const { width: screenWidth } = useWindowDimensions();
31
+ const { width: screenWidth, height: screenHeight } = useWindowDimensions();
32
32
 
33
33
  const width = useSnap ? customWidth || screenWidth : screenWidth;
34
34
 
@@ -77,18 +77,17 @@ export function GestureViewer<T = any, LC = typeof FlatList>({
77
77
  style={[
78
78
  {
79
79
  width,
80
- height: '100%',
81
- justifyContent: 'center',
82
- alignItems: 'center',
80
+ height: screenHeight,
83
81
  marginHorizontal: itemSpacing / 2,
84
82
  },
83
+ styles.item,
85
84
  ]}
86
85
  >
87
86
  {renderItemProp(item, index)}
88
87
  </View>
89
88
  );
90
89
  },
91
- [width, itemSpacing, renderItemProp, keyExtractor, isScrollView],
90
+ [width, itemSpacing, renderItemProp, keyExtractor, isScrollView, screenHeight],
92
91
  );
93
92
 
94
93
  const getItemLayout = useCallback(
@@ -162,10 +161,10 @@ export function GestureViewer<T = any, LC = typeof FlatList>({
162
161
  renderItem={renderItem}
163
162
  initialScrollIndex={enableLoop && data.length > 1 ? initialIndex + 1 : initialIndex}
164
163
  keyExtractor={keyExtractor}
165
- windowSize={3}
166
- maxToRenderPerBatch={3}
167
164
  getItemLayout={getItemLayout}
168
- {...(isFlashListLike(Component) && { estimatedItemSize: width + itemSpacing })}
165
+ {...(isFlashListLike(Component)
166
+ ? { estimatedItemSize: width + itemSpacing }
167
+ : { windowSize: 3, maxToRenderPerBatch: 3 })}
169
168
  // NOTE - https://github.com/necolas/react-native-web/issues/1299
170
169
  {...(Platform.OS === 'web' &&
171
170
  isFlatListLike(Component) && { dataSet: { 'flat-list-paging-enabled-fix': true } })}
@@ -187,6 +186,10 @@ const styles = StyleSheet.create({
187
186
  container: {
188
187
  flex: 1,
189
188
  },
189
+ item: {
190
+ justifyContent: 'center',
191
+ alignItems: 'center',
192
+ },
190
193
  content: {
191
194
  flex: 1,
192
195
  width: '100%',
package/src/types.ts CHANGED
@@ -41,7 +41,7 @@ export interface TriggerAnimationConfig extends WithTimingConfig {
41
41
  export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
42
42
  /**
43
43
  * When you want to efficiently manage multiple `GestureViewer` instances, you can use the `id` prop to use multiple `GestureViewer` components.
44
- * @remark `GestureViewer` automatically removes instances from memory when components are unmounted, so no manual memory management is required.
44
+ * @remarks `GestureViewer` automatically removes instances from memory when components are unmounted, so no manual memory management is required.
45
45
  * @defaultValue 'default'
46
46
  */
47
47
  id?: string;
@@ -87,14 +87,14 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
87
87
  ListComponent: LC;
88
88
  /**
89
89
  * The width of the `GestureViewer`.
90
- * @remark If you don't set this prop, the width of the `GestureViewer` will be the same as the width of the screen.
90
+ * @remarks If you don't set this prop, the width of the `GestureViewer` will be the same as the width of the screen.
91
91
  * @defaultValue screen width
92
92
  */
93
93
  width?: number;
94
94
  /**
95
95
  * Enables snap scrolling mode.
96
96
  *
97
- * @remark
97
+ * @remarks
98
98
  * **`false` (default)**: Paging mode (`pagingEnabled: true`)
99
99
  * - Scrolls by full screen size increments
100
100
  *
@@ -112,13 +112,13 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
112
112
  dismissThreshold?: number;
113
113
  /**
114
114
  * Calls `onDismiss` function when swiping down.
115
- * @remark Useful for closing modals with downward swipe gestures.
115
+ * @remarks Useful for closing modals with downward swipe gestures.
116
116
  * @defaultValue true
117
117
  */
118
118
  enableDismissGesture?: boolean;
119
119
  /**
120
120
  * Controls left/right swipe gestures.
121
- * @remark When `false`, horizontal gestures are disabled.
121
+ * @remarks When `false`, horizontal gestures are disabled.
122
122
  * @defaultValue true
123
123
  */
124
124
  enableSwipeGesture?: boolean;
@@ -129,7 +129,7 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
129
129
  resistance?: number;
130
130
  /**
131
131
  * The props to pass to the list component.
132
- * @remark The `listProps` provides **type inference based on the selected list component**, ensuring accurate autocompletion and type safety in your IDE.
132
+ * @remarks The `listProps` provides **type inference based on the selected list component**, ensuring accurate autocompletion and type safety in your IDE.
133
133
  */
134
134
  listProps?: Partial<ConditionalListProps<LC>>;
135
135
  /**
@@ -142,25 +142,25 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
142
142
  containerStyle?: StyleProp<ViewStyle>;
143
143
  /**
144
144
  * By default, the background `opacity` gradually decreases from 1 to 0 during downward swipe gestures.
145
- * @remark When `false`, this animation is disabled.
145
+ * @remarks When `false`, this animation is disabled.
146
146
  * @defaultValue true
147
147
  */
148
148
  animateBackdrop?: boolean;
149
149
  /**
150
150
  * Only works when zoom is active, allows moving item position when zoomed.
151
- * @remark When `false`, gesture movement is disabled during zoom.
151
+ * @remarks When `false`, gesture movement is disabled during zoom.
152
152
  * @defaultValue true
153
153
  */
154
154
  enableZoomPanGesture?: boolean;
155
155
  /**
156
156
  * Controls two-finger pinch gestures.
157
- * @remark When `false`, two-finger zoom gestures are disabled.
157
+ * @remarks When `false`, two-finger zoom gestures are disabled.
158
158
  * @defaultValue true
159
159
  */
160
160
  enableZoomGesture?: boolean;
161
161
  /**
162
162
  * Controls double-tap zoom gestures.
163
- * @remark When `false`, double-tap zoom gestures are disabled.
163
+ * @remarks When `false`, double-tap zoom gestures are disabled.
164
164
  * @defaultValue true
165
165
  */
166
166
  enableDoubleTapGesture?: boolean;
@@ -176,7 +176,7 @@ export interface GestureViewerProps<T = any, LC = typeof RNFlatList> {
176
176
  maxZoomScale?: number;
177
177
  /**
178
178
  * The spacing between items in pixels.
179
- * @remark Only applied when `useSnap` is `true`.
179
+ * @remarks Only applied when `useSnap` is `true`.
180
180
  * @defaultValue 0
181
181
  */
182
182
  itemSpacing?: number;