0.0.2 • Published 5 years ago

react-native-stickers v0.0.2

Weekly downloads
6
License
MIT
Repository
github
Last release
5 years ago

react-native-stickers

A fully customizable image editing tool that allows the user to add a sticker, and output an updated image.

Install

Install via npm:

 npm install react-native-stickers --save

Usage

 import { StickerPicker } from 'react-native-stickers';
<StickerPicker
  visible={this.state.pickerVisible}
  topContainer={<View style={{paddingTop: 60, paddingBottom: 40, textAlign: 'center', alignItem: 'center', justifyContent: 'center'}}><Text style={{alignSelf: 'center', fontSize: 18}}>Get stickering!</Text></View>}
  bottomContainer={<Text style={styles.actionTitle}>Save Picture</Text>}
  bottomContainerStyle={styles.bottomContainerStyle}
  completedEditing={(imageUri, width, height) => this.setState({ pickerVisible: false, finalImage: {imageUri, width, height} })}
  includeDefaultStickers={true}
  imageStyle={null}
  previewImageSize={50}
  stickerSize={100}
  imageSource={'https://images.unsplash.com/photo-1507146426996-ef05306b995a?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1500&q=80'}
  stickers={null}
 />

Props

PropTypeRequiredDefaultDescription
visiblebooleanYes-Whether the sticker picker modal is visible or not.
topContainercomponentYes-The component that renders at the top of the image editor.
bottomContainercomponentYes-The component that renders at the top of the image editor. Clicking this component saves the image, and returns it to the completedEditing prop.
bottomContainerStylestyle objectNo-The style of the bottom container
completedEditingcallback functionYes-The function called when the user is done editing the image. Receives the final image url, width, and height.
includeDefaultStickersbooleanNoYesWhether the default stickers should be included in the image editor or not.
imageStylestyle objectNo-The style of the sticker.
previewImageSizenumberYes-The size of the preview images, in pt.
stickerSizenumberYes-The size of the selected sticker.
imageSourceurlYes-The url of the image to edit.
stickersarrayNo-An array of image objects to render as possible stickers.

Contributions/Suggestions

Feel free to add issues and PRs. As with any project, there are things to improve!

Author / Share Rights

Dave Barner (dbarner@gmail.com); Code is free for all to use. <3