2.2.0 • Published 4 years ago

react-native-thumbnail-grid-expo v2.2.0

Weekly downloads
1
License
MIT
Repository
github
Last release
4 years ago

React Native Photo Grid

FOSSA Status

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'
]
...
<MediaGrid 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'
    }
  }
]
...
<MediaGrid 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
emptyImagedefault empty image load

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

License

FOSSA Status

2.2.0

4 years ago

2.1.0

4 years ago

2.0.0

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago