0.3.0 • Published 6 years ago

react-native-thumbnail-grid v0.3.0

Weekly downloads
132
License
MIT
Repository
-
Last release
6 years ago

React Native Photo Grid

Code:

const images = [
  'https://cdn.pixabay.com/photo/2017/06/09/09/39/adler-2386314_960_720.jpg',
  'https://cdn.pixabay.com/photo/2017/06/02/18/24/fruit-2367029_960_720.jpg',
  'https://cdn.pixabay.com/photo/2016/08/12/22/34/apple-1589869_960_720.jpg'
]
...
<PhotoGrid source={images} onPressImage={uri => this.showImage(uri)} />

Custom Image source object

The source prop also accepts an Array of source objects like so:

const images = [
  {
    uri: 'https://cdn.pixabay.com/photo/2017/06/09/09/39/adler-2386314_960_720.jpg',
    headers: {
      Authorization: 'Bearer xyz'
    }
  },
  {
    uri: 'https://cdn.pixabay.com/photo/2017/06/02/18/24/fruit-2367029_960_720.jpg',
    headers: {
      Authorization: 'Bearer xyz'
    }
  },
  {
    uri: 'https://cdn.pixabay.com/photo/2016/08/12/22/34/apple-1589869_960_720.jpg'
    headers: {
      Authorization: 'Bearer xyz'
    }
  }
]
...
<PhotoGrid source={images} onPressImage={source => this.showImage(source.uri)} />

Props

PropertyTypeDescription
sourcePropTypes.arrayArray containing Image uri string or source object
widthPropTypes.numberContainer width
heightPropTypes.numberContainer height
ratioPropTypes.floatSplit screen ratio
stylePropTypes.objectContainer styles
imageStylePropTypes.objectImage styles
imagePropsPropTypes.objectImage props
onPressImagePropTypes.funcCallback when press image

Image props

PropertyDescription
placeholderSourceShow placeholderSource if the source can't be loaded or error.
loadingStyleStyle ActivityIndicator {size: 'small'; color: 'gray'}
isShowActivityShow ActivityIndicator loading
placeholderStyleStyle placeholder image
0.3.0

6 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.5

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago