Giter VIP home page Giter VIP logo

react-native-images-collage's Introduction

react-native-images-collage

npm npm licence npm downloads

Customizable image grid component for React Native

alt text

Install

To get started install via npm:

 npm install react-native-images-collage --save

Usage

To use in React Native. Import:

 import { CollageMatrix } from 'react-native-images-collage';

Then add this to your code:

<CollageMatrix
  images={ photos }
  matrix={ [ 1, 1, 1, 1 ] }
  direction={ 'row' } />

Instead of building your own matrix of collage layouts. There is a JSON file you can import which supports various layouts up to 6 images.

 import { CollageMatrix, LayoutData } from 'react-native-images-collage';

You can then access a layout like so:

 LayoutData[NumberOfImages][i]

The number in the first bracket will be the configuration you want to access. E.g. configuration for 5 images. The second number is the specific layout you want to access e.g. [2, 2, 1]. You will have to inspect the JSON file to find this out.

Props

Note: For this to work as expected, the number of images has to be equal to the result of all numbers in the matrix. e.g. if matrix is [ 1, 2, 1 ] there has to be 4 images.

Prop Type Optional Default Description
images array No Images for the collage.
matrix centered No An array like this [ 1, 1, 1 ] equal to the number of images. Used to define the layout
separators int Yes 0 Amount of space between images.
direction string Yes row Direction of the collage: 'row' or 'column'.
borders int Yes 4 Width of borders.
borderColor string Yes white Border colour.
backgroundColor string Yes white Background color of collage.
containerStyle object Optional 100% Style applied to the container of the collage

Examples

Todo

  • Add examples to README
  • Fix some of the JSON layouts for 5 and 6 images
  • Test on Android

Contributing

If you want to issue a PR, go ahead ;)

Authors

License

This project is licensed under the MIT License

react-native-images-collage's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.