All Projects → ascoders → React Native Image Viewer

ascoders / React Native Image Viewer

Licence: mit
🚀 tiny & fast lib for react native image viewer pan and zoom

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Native Image Viewer

Reactopt
A CLI React performance optimization tool that identifies potential unnecessary re-rendering
Stars: ✭ 1,975 (-15.38%)
Mutual labels:  react-component
React Translated
A dead simple way to add complex translations (i18n) in a React (DOM/Native) project 🌎🌍🌏
Stars: ✭ 176 (-92.46%)
Mutual labels:  react-component
React Native Card Flip
Card flip animation for React Native
Stars: ✭ 183 (-92.16%)
Mutual labels:  react-component
React Tradingview Widget
React component for rendering the TradingView Advanced Real-Time Chart Widget.
Stars: ✭ 170 (-92.72%)
Mutual labels:  react-component
Video React
A web video player built for the HTML5 world using React library.
Stars: ✭ 2,227 (-4.58%)
Mutual labels:  react-component
Pqiv
Powerful image viewer with minimal UI
Stars: ✭ 177 (-92.42%)
Mutual labels:  image-viewer
React Tiny Virtual List
A tiny but mighty 3kb list virtualization library, with zero dependencies 💪 Supports variable heights/widths, sticky items, scrolling to index, and more!
Stars: ✭ 2,057 (-11.87%)
Mutual labels:  react-component
React Anchor Link Smooth Scroll
React component for anchor links using the smooth scroll polyfill.
Stars: ✭ 186 (-92.03%)
Mutual labels:  react-component
React Awesome Slider
React content transition slider. Awesome Slider is a 60fps, light weight, performant component that renders an animated set of production ready UI general purpose sliders with fullpage transition support for NextJS and GatsbyJS. 🖥️ 📱
Stars: ✭ 2,343 (+0.39%)
Mutual labels:  react-component
React Mobile Picker
An iOS like select box component for React
Stars: ✭ 180 (-92.29%)
Mutual labels:  react-component
Cassette
📼 A flexible media player component library for React that requires no up-front config
Stars: ✭ 171 (-92.67%)
Mutual labels:  react-component
React Component Echarts
React component echarts. 组件式百度图表。
Stars: ✭ 175 (-92.5%)
Mutual labels:  react-component
React Sticky El
Stars: ✭ 179 (-92.33%)
Mutual labels:  react-component
React Terminal Component
Terminal emulator component for React. Emulate a terminal/console with autocomplete, commands, a file-system and themes.
Stars: ✭ 169 (-92.76%)
Mutual labels:  react-component
Ybimagebrowser
iOS image browser / iOS 图片浏览器 (支持视频)
Stars: ✭ 2,230 (-4.46%)
Mutual labels:  image-viewer
Miniprogram
猫眼电影/Taro/微信小程序/React
Stars: ✭ 163 (-93.02%)
Mutual labels:  react-component
React Credit Cards
Beautiful credit cards for your payment forms
Stars: ✭ 2,239 (-4.07%)
Mutual labels:  react-component
React Country Region Selector
Country / region React select boxes for your forms.
Stars: ✭ 189 (-91.9%)
Mutual labels:  react-component
Vue Twentytwenty
Image comparison utility
Stars: ✭ 182 (-92.2%)
Mutual labels:  image-viewer
React Rater
⭐️ Interative & customizable star rater
Stars: ✭ 180 (-92.29%)
Mutual labels:  react-component

Show Cases

Swiper image

Zoom while sliding

Swipe down

Getting Started

Installation

npm i react-native-image-zoom-viewer --save

Basic Usage

  • Install create-react-native-app first
$ npm install -g create-react-native-app
  • Initialization of a react-native project
$ create-react-native-app AwesomeProject
  • Then, edit AwesomeProject/App.js, like this:
import { Modal } from 'react-native';
import ImageViewer from 'react-native-image-zoom-viewer';

const images = [{
    // Simplest usage.
    url: 'https://avatars2.githubusercontent.com/u/7970947?v=3&s=460',

    // width: number
    // height: number
    // Optional, if you know the image size, you can set the optimization performance

    // You can pass props to <Image />.
    props: {
        // headers: ...
    }
}, {
    url: '',
    props: {
        // Or you can set source directory.
        source: require('../background.png')
    }
}]

export default class App extends React.Component {
    render: function() {
        return (
            <Modal visible={true} transparent={true}>
                <ImageViewer imageUrls={images}/>
            </Modal>
        )
    }
}

Props

parameter type required description default
imageUrls array yes Image Source
enableImageZoom boolean no Enable image zoom true
onShowModal function

(content?: JSX.Element) => void
no The callback for show modal () => {}
onCancel function

() => void
no The callback for cancel modal () => {}
flipThreshold number no Swipe threshold of the next page 80
maxOverflow number no The X position maximum, that current page can slide to the next page 300
index number no Init index of images 0
failImageSource string, object

{url: string}
no placeholder for fail ''
loadingRender function

() => React.ReactElement<any>
no placeholder for loading () => null
onSaveToCamera function

(index?: number => void
no The callback for save to camera () => {}
onChange function

(index?: number => void
no When the image changed () => {}
onMove ( position: IOnMove )=>void reports movement position data (helpful to build overlays) ()=> {}
saveToLocalByLongPress boolean no Enable save to camera when long press true
onClick function

(onCancel?: function) => void
no Onclick (onCancel) => {onCancel()}
onDoubleClick function

(onCancel?: function) => void
no OnDoubleClick (onCancel) => {onCancel()}
onSave function

(url: string) => void
no The picture is saved to the local method, if you write this method will not call the system default method for Android does not support saveToCameraRoll remote picture, you can call this callback in Android call native interface
renderHeader function

(currentIndex?: number) => React.ReactElement<any>
no Custom header () => null
renderFooter function

(currentIndex?: number) => React.ReactElement<any>
no Custom footer () => null
renderIndicator function

(currentIndex?: number, allSize?) => React.ReactElement<any>: number
no Custom indicator (currentIndex, allSize) => currentIndex + "/" + allSize
renderImage function

(props: any) => React.ReactElement<any>
no Custom image component (props) => <Image {...props} />
renderArrowLeft function

() => React.ReactElement<any>
no Custom left arrow () => null
renderArrowRight function

() => React.ReactElement<any>
no Custom right arrow () => null
onSwipeDown function

() => void
no Callback for swipe down () => null
footerContainerStyle object

{someStyle: someValue}
no custom style props for container that will be holding your footer that you pass bottom: 0, position: "absolute", zIndex: 9999
backgroundColor string

white
no Component background color black
enableSwipeDown boolean no Enable swipe down to close image viewer. When swipe down, will trigger onCancel. false
swipeDownThreshold number no Threshold for firing swipe down function
doubleClickInterval number no Double click interval.
pageAnimateTime number no Set the animation time for page flipping. 100
enablePreload boolean no Preload the next image false
useNativeDriver boolean no Whether to animate using useNativeDriver false
menus function

({cancel,saveToLocal}) => React.ReactElement<any>
no Custom menus, with 2 methods:cancel to hide menus and saveToLocal to save image to camera
menuContext object

{someKey: someValue}
no Custom menu context. { saveToLocal: 'save to the album', cancel: 'cancel' }

Development pattern

Step 1, run TS listener

After clone this repo, then:

npm install
npm start

Step 2, run demo

cd demo
npm install
npm start

Then, scan the QR, use your expo app.

Dependence

Depend on react-native-image-pan-zoom: https://github.com/ascoders/react-native-image-zoom

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].