0.5.7 • Published 9 months ago

react-fb-collage v0.5.7

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

react-fb-collage

Image Grid or Collage component for React

NPM

  • stable release version: version
  • package downloads: downloads
  • MIT license

Show Case

npm.io

Getting Started

Installation

npm i react-fb-collage --save

Basic Usage

  • Initialization of a react project
$ npx create-react-app AwesomeProject

Note: GUIDE

  • Then, cd AwesomeProject

  • Install library

$ npm i react-fb-collage
  • Then, edit AwesomeProject/App.js, like this:
import React from "react";
import FBCollage from "react-fb-collage";

function App() {
    const images = [
        "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1200px-React-icon.svg.png",
        "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1200px-React-icon.svg.png",
        "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1200px-React-icon.svg.png",
        "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1200px-React-icon.svg.png",
        "https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1200px-React-icon.svg.png",
        "https://upl/oad.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/1200px-React-icon.svg.png",
  ];

  return (
    <div className="App">
      <FBCollage
        style={{ backgroundColor: "black" }}
        images={images}
        height={720}
        width={592}
        borderRadius={40}
      />
    </div>
  );
}

export default App;

Props

parametertyperequireddescriptiondefault
imagesarrayyesThe array of image sources of require('../image-file') or 'imageURL' or both
imageOnPressfunction(index, images) => voidnoThe callback for image on press listener() => {}
widthnumbernoThe width of the view357
heightnumbernoThe height of the view200
borderRadiusnumbernoThe border radius of the images12
spacingnumbernoThe spacing between the images and the viewauto
styleobjectnoTo override the main view styledefault
overlayStyleobjectnoTo override the text view overlay styledefault
textStyleobjectnoTo override the text styledefault

Development pattern

Step 1,

After clone this repo, then:

cd react-fb-collage

Step 2,

npm install

Step 3, choose demo

cd demo

Step 4, run demo

npm install
npm start

In case of any issue follow the GUIDE.

Supported React Versions

This project aims to support any version of React.

If you require new features or bug fixes for older versions you can fork this project.

Credits

The idea for this modules came from facebook collage.

Licenses

FBCollage - MIT © MeharBhutta