
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
react-native-avatar-crop
Advanced tools
Supports rect and circle cropping. Use cropArea={{width, height}}
for custom aspect ratio.
Download apk to see it in action, click to download
Image Picker | Network Image |
---|---|
![]() | ![]() |
Note: Please migrate to @react-native-masked-view/masked-view if using @react-native-community/masked-view
npm
npm install react-native-avatar-crop vemarav/react-native-image-editor react-native-image-size @react-native-masked-view/masked-view @react-native-gesture-handler --save
yarn
yarn add react-native-avatar-crop vemarav/react-native-image-editor react-native-image-size @react-native-masked-view/masked-view @react-native-gesture-handler
const component = (props) => {
const { uri, setUri } = useState("");
let crop;
const { width: SCREEN_WIDTH } = Dimensions.get("window");
const cropImage = async () => {
// crop accepts quality, default is 1
// uri will have cropped image cache path
const { uri, width, height } = await crop(0.9);
setUri(uri);
};
return (
<View>
{uri ? (
<Image
source={{ uri }}
style={{
width: SCREEN_WIDTH,
height: SCREEN_WIDTH,
resizeMode: "contain",
}}
/>
) : null}
<Crop
source={props.uri}
cropShape={"circle"} // rect || circle
width={SCREEN_WIDTH} // default value
height={SCREEN_WIDTH} // defalt value
cropArea={{
width: SCREEN_WIDTH / 1.3, // required
height: SCREEN_WIDTH / 1.3, // required
}}
borderWidth={0} // default 2
backgroundColor={"#FFFFFF"} // default #FFFFFF, use same format
opacity={0.7} // between 0 and 1, default is 1
maxZoom={3} // default 3
resizeMode={"contain"} // default "cover"
onCrop={(cropCallback) => (crop = cropCallback)} // returns a function
/>
</View>
);
};
see full example here
Whether you are a novice or experienced software developer, all contributions and suggestions are welcome!
Clone repo
git clone https://github.com/vemarav/react-native-avatar-crop.git
Add features or bug fixes
Make a Pull Request
OR
Report a bug here
Feel free to contribute, hosted on ❤️ with Github.
Package published under MIT License
Please use following button to star the, so it can reach others too
FAQs
Crop component to crop profile images
The npm package react-native-avatar-crop receives a total of 595 weekly downloads. As such, react-native-avatar-crop popularity was classified as not popular.
We found that react-native-avatar-crop demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.