Skip to content

Commit 217a0ea

Browse files
committed
chore: refactor type imports and add types file
-Update import paths for type definitions in ImageViewer and index files -Create a new types.ts file to define ImageViewerProps and GalleryProps
1 parent a5ec70d commit 217a0ea

File tree

5 files changed

+7
-31
lines changed

5 files changed

+7
-31
lines changed

example/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
View,
88
} from 'react-native';
99
import React, { useRef } from 'react';
10-
import Gallery, { GalleryRef } from '../../src/index';
10+
import Gallery, { GalleryRef } from '../../src';
1111

1212
const image1 = require('../assets/image1.jpeg');
1313
const image2 = require('../assets/image2.jpeg');

src/Gallery.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import {
1919
SCREEN_HEIGHT,
2020
VERTICAL_ACTIVATION_THRESHOLD,
2121
} from './constants';
22-
import type { GalleryProps, GalleryRef } from './Type';
22+
import type { GalleryProps, GalleryRef } from './types';
2323
import { GestureHandlerRootView } from 'react-native-gesture-handler';
2424

2525
const Gallery = forwardRef<GalleryRef, GalleryProps>(

src/ImageViewer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
SCREEN_WIDTH,
2121
VERTICAL_ACTIVATION_THRESHOLD,
2222
} from './constants';
23-
import type { ImageViewerProps } from './Type';
23+
import type { ImageViewerProps } from './types';
2424

2525
const ImageViewer = ({
2626
source,

src/index.tsx

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import type {
2-
GalleryRef as GalleryRefType,
3-
GalleryProps as GalleryPropsType,
4-
ImageViewerProps as ImageViewerPropsType,
5-
} from './Type';
1+
import type { GalleryRef, GalleryProps, ImageViewerProps } from './types';
62
import type {
73
ComponentType,
84
ForwardRefExoticComponent,
@@ -12,13 +8,10 @@ import GalleryComponent from './Gallery';
128
import ImageViewerComponent from './ImageViewer';
139

1410
const Gallery: ForwardRefExoticComponent<
15-
GalleryPropsType & RefAttributes<GalleryRefType>
11+
GalleryProps & RefAttributes<GalleryRef>
1612
> = GalleryComponent;
17-
const ImageViewer: ComponentType<ImageViewerPropsType> = ImageViewerComponent;
18-
19-
export type GalleryRef = GalleryRefType;
20-
export type GalleryProps = GalleryPropsType;
21-
export type ImageViewerProps = ImageViewerPropsType;
13+
const ImageViewer: ComponentType<ImageViewerProps> = ImageViewerComponent;
2214

15+
export type { GalleryRef, GalleryProps };
2316
export { ImageViewer };
2417
export default Gallery;

src/Type.ts renamed to src/types.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type {
22
ImageStyle,
33
ImageSourcePropType,
44
ViewStyle,
5-
FlatList,
65
FlatListProps,
76
} from 'react-native';
87
import type { SharedValue } from 'react-native-reanimated';
@@ -61,19 +60,3 @@ export interface GalleryRef {
6160
/** Whether the gallery is currently visible */
6261
isVisible: boolean;
6362
}
64-
65-
/**
66-
* Internal control interface for the Gallery component
67-
*/
68-
export interface GalleryControl {
69-
/** Show the gallery at the specified index */
70-
show: (index?: number) => void;
71-
/** Hide the gallery */
72-
hide: () => void;
73-
/** Shared value indicating whether the gallery is visible */
74-
isVisible: SharedValue<boolean>;
75-
/** Shared value for translation on Y axis */
76-
translateY: SharedValue<number>;
77-
/** Reference to the FlatList component */
78-
flatListRef: React.RefObject<FlatList>;
79-
}

0 commit comments

Comments
 (0)