react-native-instagram-like-image-cropper
The component like instagram image cropper
Preview
Getting started
First, install peer packages
Second, install package
npm install react-native-instagram-like-image-cropper --save
or
yarn add react-native-instagram-like-image-cropper
Thired, pod install
cd ios && pod install && cd ..
Usage
import React, {useState} from 'react';
import {Image, StyleSheet, Text, View} from 'react-native';
import InstagramLikeImageCropper from '../src';
const App = () => {
const [croppedImage, setCroppedImage] = useState<string | null>(null);
return (
<View >
<InstagramLikeImageCropper
onCropped={data => setCroppedImage(data.croppedUri)}
image={{
width: 1600,
height: 700,
uri: 'https://dummyimage.com/1600x700/b5b5b5/ffffff.png',
}}
/>
<Text>Cropped image</Text>
{croppedImage && (
<Image source={{uri: croppedImage}} style={styles.image} />
)}
</View>
);
};
Props
export interface InstagramLikeImageCropperProps {
image: {
uri: string;
width: number;
height: number;
};
width?: number;
height?: number;
grid?: boolean;
gridVerticalNum?: number;
gridHorizontalNum?: number;
gridColor?: string;
onCropped?: (data: CroppedData) => void;
maxScale?: number;
}
export interface CroppedData {
croppedUri: string;
originalUri: string;
}