For AI agents: the complete documentation index is available at https://react-native-gesture-image-viewer.pages.dev/1.x/ko/llms.txt, the full documentation bundle is available at https://react-native-gesture-image-viewer.pages.dev/1.x/ko/llms-full.txt, and this page is available as Markdown at https://react-native-gesture-image-viewer.pages.dev/1.x/ko/guide/usage/gesture-viewer-props.md.
v3 정식 출시. 변경 사항 보기
  • 한국어
  • 1.x
  • GestureViewer Props

    enableLoop (기본값: false)

    루프 모드를 활성화합니다. true일 때 마지막 아이템에서 다음으로 가면 첫 번째로, 첫 번째에서 이전으로 가면 마지막으로 돌아갑니다.

    import { GestureViewer } from 'react-native-gesture-image-viewer';
    
    function App() {
      const [currentIndex, setCurrentIndex] = useState(0);
    
      return <GestureViewer enableLoop={true} />;
    }

    onIndexChange

    index 값이 변경될 때 onIndexChange 콜백함수가 호출됩니다.

    import { GestureViewer } from 'react-native-gesture-image-viewer';
    
    function App() {
      const [currentIndex, setCurrentIndex] = useState(0);
    
      return <GestureViewer onIndexChange={setCurrentIndex} />;
    }

    useSnap (기본값: false)

    스크롤 동작 모드를 설정합니다. false(기본값)는 페이징 모드, true는 스냅 모드를 사용합니다.

    import { GestureViewer } from 'react-native-gesture-image-viewer';
    
    function App() {
      return <GestureViewer data={data} renderItem={renderItem} useSnap={true} />;
    }

    itemSpacing (기본값: 0)

    아이템 간의 간격을 픽셀 단위로 설정합니다. useSnap이 true일 때만 적용됩니다.

    import { GestureViewer } from 'react-native-gesture-image-viewer';
    
    function App() {
      return (
        <GestureViewer
          data={data}
          renderItem={renderItem}
          useSnap={true}
          itemSpacing={16} // 16px spacing between items
        />
      );
    }

    autoPlay (기본값: false)

    자동 재생 모드를 활성화합니다. true일 때 지정된 간격 후 다음 아이템으로 자동으로 재생됩니다.

    • enableLoop이 활성화되면 마지막 아이템에서 다음으로 가면 첫 번째로, 첫 번째에서 이전으로 가면 마지막으로 돌아갑니다.
    • enableLoop이 비활성화되면 마지막 아이템에서 정지됩니다.
    • 아이템이 하나만 있을 때 자동 재생이 비활성화됩니다.
    • 줌 또는 회전 제스처가 감지되면 자동 재생이 일시 중지됩니다.
    import { GestureViewer } from 'react-native-gesture-image-viewer';
    
    function App() {
      return <GestureViewer autoPlay={true} />;
    }

    autoPlayInterval (기본값: 3000)

    자동 재생 간격을 밀리초 단위로 설정합니다.
    양수 정수여야 합니다. 값이 250ms 미만이면 런타임에서 250ms로 제한됩니다.

    import { GestureViewer } from 'react-native-gesture-image-viewer';
    
    function App() {
      return <GestureViewer autoPlay={true} autoPlayInterval={3000} />;
    }

    initialIndex (기본값: 0)

    초기 인덱스 값을 설정할 수 있습니다.

    dismissThreshold (기본값: 80)

    dismissThreshold는 수직 제스처 시 임계값을 적용하여 onDismiss 호출 시점을 제어할 수 있습니다.

    resistance (기본값: 2)

    resistance는 수직 제스처 시 저항값을 적용하여 수직으로 이동하는 범위를 제어할 수 있습니다.

    maxZoomScale (기본값: 2)

    최대 줌 배율을 제어할 수 있습니다.

    GestureViewerProps interface

    Go to source

    GestureViewerProps
    export interface GestureViewerProps<ItemT, LC> {
      /**
       * When you want to efficiently manage multiple `GestureViewer` instances, you can use the `id` prop to use multiple `GestureViewer` components.
       * @remarks `GestureViewer` automatically removes instances from memory when components are unmounted, so no manual memory management is required.
       * @defaultValue 'default'
       */
      id?: string;
      /**
       * The data to display in the `GestureViewer`.
       */
      data: ItemT[];
      /**
       * The index of the item to display in the `GestureViewer` when the component is mounted.
       * @defaultValue 0
       */
      initialIndex?: number;
      /**
       * A callback function that is called when the index of the item changes.
       */
      onIndexChange?: (index: number) => void;
      /**
       * A callback function that is called when the `GestureViewer` is dismissed.
       */
      onDismiss?: () => void;
      /**
       * A callback function that is called when the dismiss interaction starts.
       * @remarks Useful to hide external UI (e.g., headers, buttons) while the dismiss gesture/animation is in progress.
       */
      onDismissStart?: () => void;
      /**
       * A callback function that is called to render the item.
       */
      renderItem: (item: ItemT, index: number) => React.ReactElement;
      /**
       * A callback function that is called to render the container.
       * @remarks Useful for composing additional UI (e.g., close button, toolbars) around the viewer.
       * The second argument provides control helpers such as `dismiss()` to close the viewer.
       *
       * @param children - The viewer content to be rendered inside your container.
       * @param helpers - Control helpers for the viewer. Currently includes `dismiss()`.
       * @returns A React element that wraps and renders the provided `children`.
       */
      renderContainer?: (
        children: React.ReactElement,
        helpers: { dismiss: () => void },
      ) => React.ReactElement;
      /**
       * Support for any list component like `ScrollView`, `FlatList`, `FlashList` through the `ListComponent` prop.
       */
      ListComponent: LC;
      /**
       * The width of the `GestureViewer`.
       * @remarks If you don't set this prop, the width of the `GestureViewer` will be the same as the width of the screen.
       * @defaultValue screen width
       */
      width?: number;
      /**
       * The height of the `GestureViewer`.
       * @remarks If you don't set this prop, the height of the `GestureViewer` will be the same as the height of the screen.
       * @defaultValue screen height
       */
      height?: number;
      /**
       * Auto play mode.
       * @remarks
       * - When `true`, the viewer will automatically play the next item after the specified interval.
       * - When `enableLoop` is enabled, the viewer will loop back to the first item after the last item.
       * - When `enableLoop` is disabled, the viewer will stop at the last item.
       * - When there is only one item, auto-play is disabled.
       * - When zoom or rotate gestures are detected, the auto-play will be paused.
       * @defaultValue false
       */
      autoPlay?: boolean;
      /**
       * Auto play interval.
       * @remarks
       * - When `autoPlay` is enabled, the viewer advances to the next item after the specified interval (ms).
       * - Must be a positive integer. Values below 250ms are clamped to 250ms at runtime.
       * @defaultValue 3000
       */
      autoPlayInterval?: number;
      /**
       * Enables snap scrolling mode.
       *
       * @remarks
       * **`false` (default)**: Paging mode (`pagingEnabled: true`)
       * - Scrolls by full screen size increments
       *
       * **`true`**: Snap mode (`snapToInterval` auto-calculated)
       * - `snapToInterval` is automatically calculated based on `width` and `itemSpacing` values
       * - Use this option when you need item spacing
       * @defaultValue false
       *
       */
      useSnap?: boolean;
      /**
       * `dismissThreshold` controls when `onDismiss` is called by applying a threshold value during vertical gestures.
       * @defaultValue 80
       */
      dismissThreshold?: number;
      /**
       * Calls `onDismiss` function when swiping down.
       * @remarks Useful for closing modals with downward swipe gestures.
       * @defaultValue true
       */
      enableDismissGesture?: boolean;
      /**
       * Controls left/right swipe gestures.
       * @remarks When `false`, horizontal gestures are disabled.
       * @defaultValue true
       */
      enableSwipeGesture?: boolean;
      /**
       * `resistance` controls the range of vertical movement by applying resistance during vertical gestures.
       * @defaultValue 2
       */
      resistance?: number;
      /**
       * The props to pass to the list component.
       * @remarks The `listProps` provides **type inference based on the selected list component**, ensuring accurate autocompletion and type safety in your IDE.
       */
      listProps?: Partial<ConditionalListProps<ItemT, LC>>;
      /**
       * The style of the backdrop.
       */
      backdropStyle?: StyleProp<ViewStyle>;
      /**
       * The style of the container.
       */
      containerStyle?: StyleProp<ViewStyle>;
      /**
       * By default, the background `opacity` gradually decreases from 1 to 0 during downward swipe gestures.
       * @remarks When `false`, this animation is disabled.
       * @defaultValue true
       */
      animateBackdrop?: boolean;
      /**
       * Only works when zoom is active, allows moving item position when zoomed.
       * @remarks When `false`, gesture movement is disabled during zoom.
       * @defaultValue true
       */
      enableZoomPanGesture?: boolean;
      /**
       * Controls two-finger pinch gestures.
       * @remarks When `false`, two-finger zoom gestures are disabled.
       * @defaultValue true
       */
      enableZoomGesture?: boolean;
      /**
       * Controls double-tap zoom gestures.
       * @remarks When `false`, double-tap zoom gestures are disabled.
       * @defaultValue true
       */
      enableDoubleTapGesture?: boolean;
      /**
       * Enables infinite loop navigation.
       * @defaultValue false
       */
      enableLoop?: boolean;
      /**
       * The maximum zoom scale.
       * @defaultValue 2
       */
      maxZoomScale?: number;
      /**
       * The spacing between items in pixels.
       * @remarks Only applied when `useSnap` is `true`.
       * @defaultValue 0
       */
      itemSpacing?: number;
      /**
       * Trigger-based animation settings
       * @remarks You can customize animation duration, easing, and system reduce-motion behavior.
       *
       * @example
       * ```tsx
       * <GestureViewer
       *   triggerAnimation={{
       *     duration: 250,
       *     easing: Easing.out(Easing.cubic),
       *     reduceMotion: 'system',
       *     onAnimationComplete: () => {
       *       console.log('Animation complete');
       *     },
       *   }}
       * />
       * ```
       */
      triggerAnimation?: TriggerAnimationConfig;
    }