All Projects → aspect-apps → React Native Images Collage

aspect-apps / React Native Images Collage

Licence: mit
Robust interactive image collage component for React Native

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Native Images Collage

Llama Archive
Loss & LAtency MAtrix
Stars: ✭ 44 (-35.29%)
Mutual labels:  matrix
Pesdk React Native Demo
React Native example for PhotoEditor SDK
Stars: ✭ 57 (-16.18%)
Mutual labels:  photo
Spmp
sparse matrix pre-processing library
Stars: ✭ 62 (-8.82%)
Mutual labels:  matrix
Matrix Notepad
A buggy way to collaborate on text documents using the Matrix protocol. When it works, consider this the Matrix Console of collaboration!
Stars: ✭ 50 (-26.47%)
Mutual labels:  matrix
Pycm
Multi-class confusion matrix library in Python
Stars: ✭ 1,076 (+1482.35%)
Mutual labels:  matrix
Continuum Desktop
Matrix client in kotlin
Stars: ✭ 60 (-11.76%)
Mutual labels:  matrix
Matrix Puppet Hangouts
Matrix bridge for Google Hangouts
Stars: ✭ 42 (-38.24%)
Mutual labels:  matrix
Matrix Bot Sdk
TypeScript/JavaScript SDK for Matrix bots
Stars: ✭ 63 (-7.35%)
Mutual labels:  matrix
Homeserver
A Matrix homeserver written in Rust.
Stars: ✭ 1,089 (+1501.47%)
Mutual labels:  matrix
Imageselector
图片选择器, 支持多图选择和图片预览
Stars: ✭ 62 (-8.82%)
Mutual labels:  photo
Octoslack
OctoPrint plugin for Slack, Mattermost, Pushbullet, Pushover, Rocket.Chat, Discord, Riot/Matrix, & Microsoft Teams
Stars: ✭ 50 (-26.47%)
Mutual labels:  matrix
Imageviewer.swift
An easy to use Image Viewer that is inspired by Facebook
Stars: ✭ 1,071 (+1475%)
Mutual labels:  photo
Element Android
A glossy Matrix collaboration client for Android.
Stars: ✭ 1,109 (+1530.88%)
Mutual labels:  matrix
Unplug
unplug : desktop client for matrix.org (work-in-progress)
Stars: ✭ 45 (-33.82%)
Mutual labels:  matrix
Cloud Volume
Read and write Neuroglancer datasets programmatically.
Stars: ✭ 63 (-7.35%)
Mutual labels:  matrix
Color.js
Extract colors from an image (0.75 KB) 🎨
Stars: ✭ 42 (-38.24%)
Mutual labels:  photo
Mrthumb
【拇指先生】 a simple easy video thumbnail provider,顺滑的获取视频缩略图,支持本地和网络视频,有问题大胆提Issues
Stars: ✭ 60 (-11.76%)
Mutual labels:  photo
Fest
A GTK+ 3 Matrix client written in Rust [work in progress]
Stars: ✭ 67 (-1.47%)
Mutual labels:  matrix
Korma
Mathematics library focused on geometry for Multiplatform Kotlin 1.3
Stars: ✭ 65 (-4.41%)
Mutual labels:  matrix
Tm16xx
Arduino TM16xx library for LED & KEY and LED Matrix modules based on TM1638, TM1637, TM1640 and similar chips. Simply use print() on 7-segment and use Adafruit GFX on matrix.
Stars: ✭ 61 (-10.29%)
Mutual labels:  matrix

[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors-)
version license downloads


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, replacing and image arrangement.

  <DynamicCollage
    width={400}
    height={400}
    images={ photos }
    matrix={ [ 1, 1, 1, 1 ] }
    isEditButtonVisible: { true | false },
    EditButtonComponent: { ( <YourCustomComponent/> ) }
    editButtonPosition: { 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' },
    onEditButtonPress: { (m, i) => { collageRef.current.replaceImage( 'NewImage' , m , i ) } }
    />

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

  • If you want to capture the collage as a single image. Take a look at react-native-view-shot.
  • The number of images has to be equal to the sum of the matrix. e.g. Matrix is [ 1, 2, 1 ] ( 1 + 2 + 1 = 4), there has to be 4 images.
  • The collage scaling will not work when in a Modal component. Multiple touches are not registered.

## Replacing Images

There is a API in DynamicCollage which can be used to replace images. It can be accessed via reference. Setup the ref with the DynamicCollage like so:

const collageRef = useRef(null);

<DynamicCollage
  ref={collageRef}
  ...

You can then pass the source (url or file asset) m (matrix index) and i (relative image index) to the replaceImage function:

collageRef.current.replaceImage("https://picsum.photos/200", m, i);

Props

Prop Type Optional Default Description
width float No Width of component. REQUIRED. Used to calculate image boundaries for switching.
height float No Height of component. REQUIRED. Used to calculate image boundaries for switching.
images array No Images for the collage.
matrix array No An array [ 1, 1, 1 ] equal to the number of images. Used to define the layout.
isEditButtonVisible boolean No A boolean value for the edit button. Used to display the edit button on layout.
EditButtonComponent function Yes Custom Edit button component to be displayed on each image in the layout if the value isEditButtonVisible will be true.
editButtonPosition enum Yes top-left Enum value to set the position of EditButtonComponent on each collage image layout.
editButtonIndent number Yes 20 Number value to set the indentation of EditButtonComponent on each collage image layout.
onEditButtonPress function Yes EditButtonComponent when pressed will be triggered to replace the respective image.
direction string Yes row Direction of the collage: 'row' or 'column'.
panningLeftPadding number Yes 15 Distance image can go beyond the left edge before it is restricted.
panningRightPadding number Yes 15 Distance image can go beyond the right edge before it is restricted.
panningTopPadding number Yes 15 Distance image can go beyond the top edge before it is restricted.
panningBottomPadding number Yes 15 Distance image can go beyond the bottom edge before it is restricted.
scaleAmplifier number Yes 1.0 Amplifier applied to scaling. Increase this for faster scaling of images.
retainScaleOnSwap boolean Yes true Keep the scale (width/height) of image when it is swapped.
longPressDelay number Yes 500 Delay before long press is activated.
longPressSensitivity number Yes 3 Sensitivity of the long press, float of 1 (low) to 10+ (high).
imageStyle object Yes style Default image style.
imageSelectedStyle object Yes style The style applied to the image when it has been selected. Long Pressed.
imageSwapStyle object Yes style The style applied to the target image which is being swapped. E.g red borders
imageSwapStyleReset object Yes style The reverse of imageSwapStyle to reset style after swap. Vital for direct manipulation.
separatorStyle object Yes style Style applied to image container. Use border width to create margin between images.
containerStyle object Yes style Style applied to the container of the collage. Collage border can be applied here.
imageContainerStyle object Yes style Style applied to each image container.
imageFocussedStyle object Yes style Style applied to the focused image container.

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.

License

This project is licensed under the MIT License

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Luke Brandon Farrell

💻 📖 🚇

Amogh Jahagirdar

🐛

Muhammad Jasim

💻 📖

Henry Arbolaez

💻 📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].