### Start Example App Packager Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/CONTRIBUTING.md Starts the Metro server for the example application. This is necessary to run and test changes made to the library in the example app. Native code changes may require a rebuild of the example app. ```shell yarn example start ``` -------------------------------- ### Start Documentation Website Development Server Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/CONTRIBUTING.md Starts a local development server for the VitePress documentation website. This allows developers to preview documentation changes in real-time. ```shell yarn docs docs:dev ``` -------------------------------- ### Run Example App on Web Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/CONTRIBUTING.md Builds and runs the example application on a web browser. This command allows testing library functionality in a web environment. ```shell yarn example web ``` -------------------------------- ### Run Example App on iOS Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/CONTRIBUTING.md Builds and runs the example application on an iOS simulator or device. This command is used to test library changes in a real iOS environment. ```shell yarn example ios ``` -------------------------------- ### Run Example App on Android Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/CONTRIBUTING.md Builds and runs the example application on an Android device or emulator. This command is used to test library changes in a real Android environment. ```shell yarn example android ``` -------------------------------- ### Install Project Dependencies with Yarn Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/CONTRIBUTING.md Installs all necessary project dependencies for the monorepo using Yarn workspaces. This command should be run in the root directory of the project to set up the development environment. ```shell yarn ``` -------------------------------- ### Preview Documentation Website Production Build Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/CONTRIBUTING.md Runs a local server to preview the production build of the documentation website. This is useful for testing the final output before deployment. ```shell yarn docs docs:preview ``` -------------------------------- ### Build Documentation Website Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/CONTRIBUTING.md Builds a static production version of the documentation website using VitePress. This command generates the files needed for deployment. ```shell yarn docs docs:build ``` -------------------------------- ### Basic Skia Image Setup with fitContainer Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/docs/docs/guides/skia.md Demonstrates the initial setup for displaying an image using React Native Skia. It utilizes the `useImage` hook to load an image from a URI and `fitContainer` to calculate the appropriate dimensions for displaying the image within the available screen space. The `origin` property is set to center the transformation of the image. ```tsx import React from 'react'; import { View, useWindowDimensions } from 'react-native'; import { Canvas, Image, useImage } from '@shopify/react-native-skia'; import { fitContainer } from 'react-native-zoom-toolkit'; const uri = 'https://assets-global.website-files.com/63634f4a7b868a399577cf37/64665685a870fadf4bb171c2_labrador%20americano.jpg'; const App = () => { const image = useImage(uri); const { width, height } = useWindowDimensions(); if (image === null) { return null; } const aspectRatio = image.width() / image.height(); const imageSize = fitContainer(aspectRatio, { width, height }); const x = 0; const y = (height - imageSize.height) / 2; const centerX = x + imageSize.width / 2; const centerY = y + imageSize.height / 2; return ( ); }; export default App; ``` -------------------------------- ### Install Dependencies for React Native Zoom Toolkit Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/docs/docs/guides/cropzoomexpo.md Installs the react-native-zoom-toolkit and its peer dependencies in an Expo managed project. Requires Node.js and npm/yarn. This command installs packages needed for image cropping and manipulation. ```sh npx create-expo-app "crop-example" --template "blank-typescript" cd crop-example npx expo install react-native-reanimated react-native-gesture-handler @shopify/react-native-skia react-native-zoom-toolkit ``` -------------------------------- ### Publish New Versions with Release-it Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/CONTRIBUTING.md Publishes a new version of the library to npm using the release-it tool. This script automates version bumping, tagging, and release creation. ```shell yarn release ``` -------------------------------- ### Run Unit Tests with Jest Source: https://github.com/glazzes/react-native-zoom-toolkit/blob/main/CONTRIBUTING.md Executes all unit tests defined in the project using Jest. This command is crucial for verifying the correctness of new features and bug fixes. ```shell yarn test ``` -------------------------------- ### React Native CropZoom Image Cropping Example Source: https://context7.com/glazzes/react-native-zoom-toolkit/llms.txt Demonstrates how to use the CropZoom component to crop an image in React Native. It includes functionality for cropping, rotating, and flipping the image, along with handling component references and state updates. This example requires the 'react-native-zoom-toolkit' library. ```tsx import React, { useRef, useState } from 'react'; import { Image, View, Button, Alert } from 'react-native'; import { CropZoom } from 'react-native-zoom-toolkit'; import type { CropZoomRefType } from 'react-native-zoom-toolkit'; const ImageCropper = () => { const cropRef = useRef(null); const [imageResolution] = useState({ width: 1920, height: 1080 }); const handleCrop = () => { if (!cropRef.current) return; const result = cropRef.current.crop(); console.log('Crop coordinates:', { x: result.crop.originX, y: result.crop.originY, width: result.crop.width, height: result.crop.height, }); console.log('Transformations:', { rotation: result.context.rotationAngle, flipHorizontal: result.context.flipHorizontal, flipVertical: result.context.flipVertical, }); if (result.resize) { console.log('Resized dimensions:', result.resize); } }; const handleRotate = () => { cropRef.current?.rotate(true, true, (angle) => { console.log('Rotated to angle:', angle); }); }; const handleFlipHorizontal = () => { cropRef.current?.flipHorizontal(true, (angle) => { console.log('Flipped horizontal:', angle); }); }; const CropOverlay = () => ( ); return ( { console.log('Crop state:', state.scale, state.rotate); }} >