3.3.5 • Published 3 years ago

react-native-images-collage v3.3.5

Weekly downloads
259
License
MIT
Repository
github
Last release
3 years ago

To keep up to date with the latest fixes. See CHANGELOG.md.

Install

Install via npm:

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

Usage

To use in React Native. Import:

 import { DynamicCollage, StaticCollage } from 'react-native-images-collage';

Dynamic Collage

A dynamic collage includes panning, scaling and image arrangement.

  <DynamicCollage
    width={400}
    height={400}
    images={ photos }
    matrix={ [ 1, 1, 1, 1 ] } />

Static Collage

A static collage does not include any panning, scaling or arrangement logic. Use this if you want to render multiple non-interactive collages. Same props as the dynamic collage.

  <StaticCollage
    width={400}
    height={400}
    images={ photos }
    matrix={ [ 1, 1, 1, 1 ] } />

Layouts

Instead of building your own matrix of collage layouts. There is a JSON file you can import which includes multiple layouts. Up to 6 images.

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

You can then access a layout like so:

 matrix={ LayoutData[NumberOfImages][i].matrix }
 direction={ LayoutData[NumberOfImages][i].direction }

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.

Notes

Props

PropTypeOptionalDefaultDescription
widthfloatNoWidth of component. REQUIRED. Used to calculate image boundaries for switching.
heightfloatNoHeight of component. REQUIRED. Used to calculate image boundaries for switching.
imagesarrayNoImages for the collage.
matrixarrayNoAn array 1, 1, 1 equal to the number of images. Used to define the layout.
directionstringYesrowDirection of the collage: 'row' or 'column'.
panningLeftPaddingnumberYes15Distance image can go beyond the left edge before it is restricted.
panningRightPaddingnumberYes15Distance image can go beyond the right edge before it is restricted.
panningTopPaddingnumberYes15Distance image can go beyond the top edge before it is restricted.
panningBottomPaddingnumberYes15Distance image can go beyond the bottom edge before it is restricted.
scaleAmplifiernumberYes1.0Amplifier applied to scaling. Increase this for faster scaling of images.
retainScaleOnSwapbooleanYestrueKeep the scale (width/height) of image when it is swapped.
longPressDelaynumberYes500Delay before long press is activated.
longPressSensitivitynumberYes3Sensitivity of the long press, float of 1 (low) to 10+ (high).
imageStyleobjectYesstyleDefault image style.
imageSelectedStyleobjectYesstyleThe style applied to the image when it has been selected. Long Pressed.
imageSwapStyleobjectYesstyleThe style applied to the target image which is being swapped. E.g red borders
imageSwapStyleResetobjectYesstyleThe reverse of imageSwapStyle to reset style after swap. Vital for direct manipulation.
separatorStyleobjectYesstyleStyle applied to image container. Use border width to create margin between images.
containerStyleobjectYesstyleStyle applied to the container of the collage. Collage border can be applied here.

Showcase

  • Qeepsake - The Text Message Baby Journal on iOS and Android.

    If you use the collage in your application then create a pull request to feature it here.

Authors

License

This project is licensed under the MIT License

3.3.1

3 years ago

3.3.5

3 years ago

3.3.4

3 years ago

3.3.3

3 years ago

3.3.2

3 years ago

3.3.0

3 years ago

3.2.6

4 years ago

3.2.5

5 years ago

3.2.4

5 years ago

3.2.3

5 years ago

3.2.2

5 years ago

3.2.1

5 years ago

3.2.0

5 years ago

3.1.8

5 years ago

3.1.7

5 years ago

3.1.6

5 years ago

3.1.5

5 years ago

3.1.4

5 years ago

3.1.3

5 years ago

3.1.2

5 years ago

3.1.1

5 years ago

3.1.0

5 years ago

3.0.7

5 years ago

3.0.6

5 years ago

3.0.5

5 years ago

3.0.4

5 years ago

3.0.3

6 years ago

3.0.2

6 years ago

3.0.1

6 years ago

3.0.0

6 years ago

2.1.3

6 years ago

2.1.2

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.6

6 years ago

2.0.5

6 years ago

2.0.4

6 years ago

2.0.3

6 years ago

2.0.2

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.0

6 years ago