1.0.7 • Published 4 years ago

react-native-fb-collage v1.0.7

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

react-native-fb-collage

Image Grid or Collage component for React Native

NPM

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

Show Cases

IOSAndroid
npm.ionpm.io

Getting Started

Installation

npm i react-native-fb-collage --save

Basic Usage

  • Install react-native-cli first
$ npm install -g react-native-cli

Note: GUIDE

  • Initialization of a react-native project
$ react-native init AwesomeProject
  • Then, edit AwesomeProject/App.js, like this:
import { View } from 'react-native';
import FBCollage from 'react-native-fb-collage';

export default class App extends React.Component {
    render: function() {
        return (
            <View 
                style={{ 
                    flex: 1, 
                    justifyContent: "center" 
                }}
            >
                <FBCollage 
                  images={[
                      // static image using require.
                      //require('../assets/image-file.ext')
                      //OR
                      //fetch from server using url.
                      //'https://imageURL...'
                      //for Example
                      'https://www.inovex.de/blog/wp-content/uploads/2018/03/react-native-800x450.png',
                      'https://www.inovex.de/blog/wp-content/uploads/2018/03/react-native-800x450.png',
                      'https://www.inovex.de/blog/wp-content/uploads/2018/03/react-native-800x450.png',
                      'https://www.inovex.de/blog/wp-content/uploads/2018/03/react-native-800x450.png',
                      'https://www.inovex.de/blog/wp-content/uploads/2018/03/react-native-800x450.png',
                      'https://www.inovex.de/blog/wp-content/uploads/2018/03/react-native-800x450.png',
                      'https://www.inovex.de/blog/wp-content/uploads/2018/03/react-native-800x450.png'
                  ]}
                  imageOnPress={() => {}}
                />
            </View>
        )
    }
}

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
resizeModestringnovisit me for resize modecover
styleobjectnoTo override the main view styledefault
overlayStyleobjectnoTo override the text view overlay styledefault
textStyleobjectnoTo override the text styledefault

Development pattern

Step 1, run TS listener

After clone this repo, then:

npm install
npm start

Step 2, run demo

cd demo
npm install
react-native run-android (For android)
react-native run-ios (For ios)

In case of any issue follow the GUIDE.

Supported React Native Versions

This project aims to support any version of React Native.

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