1.0.2 • Published 4 years ago

rn-masonry-list v1.0.2

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

Features

  • Dynamic Column Rendering
  • Device Rotation
  • On-press Handlers
  • Custom Headers & Captions
  • Optimized to Rendering Large List
  • Automatic Sizing Based on Available Space

Table of Contents

  1. Installation
  2. Usage
  3. Props
  4. Credits
  5. License

installation

yarn add rn-masonry-list
# or
npm install rn-masonry-list

Also, you need to install react-native-fast-image and follow theirs installation instructions.

Usage

    import Masonry from 'rn-masonry-list';
    <Masonry
      columns={4} // optional - Default: 2
      data={[
        { uri: 'http://image1.jpg' },
        { uri: 'http://image2.jpg' },
        { uri: 'http://image3.jpg' }
      ]}
    />

Props

namerequiredtypedefaultdescription
dataYESDataTypeList data for masonry. Check DataType interface
columnsNOnumber2Desired number of columns
spaceNOnumber2Spacing each column
onEndReachNOfunctionundefinedCalled once when the scroll position gets within onEndReachedThreshold of the rendered content.
canRefreshNOboolfalseEnable/Disable RefreshControl.
onRefreshNOfunctionundefinedCalled when the view starts refreshing.
refreshingNOfunctionundefinedWhether the view should be indicating an active refresh.
refreshColorNOfunctionundefinedThe colors (at least one) that will be used to draw the refresh indicator.
customRenderItemNOfunctionundefinedFunction return React.Element with param DataPassPram.
onPressNOfunctionundefinedFunction when you press an image. Param: DataPassPram.
renderHeaderNOfunctionundefinedFunction return React.Element with param DataPassPram to render Header Image.
renderFooterNOfunctionundefinedFunction return React.Element with param DataPassPram to render Footer Image.
containerImageStyleNOfunctionundefinedStyle for image.

DataType

namerequiredTypedefaultdescription
uriYESstringThe uri of the image location.
dataNoobjectSpecial data if you want to pass when press, render, render Header, render Footer.

DataPassPram

nameTypedescription
uristringThe uri of the image location.
dataobjectSpecial data if you want to pass when press, render, render Header, render Footer.
actualSizeDimensionsSize image get from remote.
columnnumberCurrent column of image.
widthnumberWidth image after handle.
heightnumberHeight image after handle.

Dimensions

nameTypedescription
widthnumberWidth of image.
heightnumberHeight of image.

Built With

License

MIT