### Setup Project Dependencies Source: https://github.com/dariyd/react-native-document-scanner/blob/main/example/vendor/bundle/ruby/3.1.0/gems/logger-1.7.0/README.md Run bin/setup to install project dependencies after cloning the repository. ```bash $ bin/setup ``` -------------------------------- ### Setup Development Environment Source: https://github.com/dariyd/react-native-document-scanner/blob/main/example/vendor/bundle/ruby/3.1.0/gems/atomos-0.1.3/README.md Run this command after cloning the repository to install necessary development dependencies. ```bash bin/setup ``` -------------------------------- ### Basic Request Setup with Ethon Source: https://github.com/dariyd/react-native-document-scanner/blob/main/example/vendor/bundle/ruby/3.1.0/gems/ethon-0.15.0/README.md Initialize an Ethon::Easy object with a URL and perform a request. This is the most basic way to start using the gem. ```ruby easy = Ethon::Easy.new(url: "www.example.com") easy.perform #=> :ok ``` -------------------------------- ### Install @dariyd/react-native-document-scanner Source: https://context7.com/dariyd/react-native-document-scanner/llms.txt Use npm or yarn to install the library. Remember to run `pod install` for iOS after installation. ```bash # npm npm install @dariyd/react-native-document-scanner # yarn yarn add @dariyd/react-native-document-scanner # iOS β€” run pod install after npm install cd ios && pod install ``` -------------------------------- ### Install iOS Pods Source: https://github.com/dariyd/react-native-document-scanner/blob/main/README.md After installing the library, navigate to the 'ios' directory and run 'pod install' to link the native dependencies. ```bash cd ios && pod install ``` -------------------------------- ### Setup TestChat Server Dependencies Source: https://github.com/dariyd/react-native-document-scanner/blob/main/example/ios/Pods/SocketRocket/README.md Install necessary Python packages for the TestChat server using pip within a virtual environment. Ensure 'make test' has been run previously to set up the virtual environment. ```bash source .env/bin/activate pip install git+https://github.com/tornadoweb/tornado.git ``` -------------------------------- ### Install Benchmark Gem Source: https://github.com/dariyd/react-native-document-scanner/blob/main/example/vendor/bundle/ruby/3.1.0/gems/benchmark-0.4.1/README.md Add the benchmark gem to your Gemfile and run bundle, or install it directly using gem install. ```ruby gem 'benchmark' ``` -------------------------------- ### Install Cocoapods Try Plugin Source: https://github.com/dariyd/react-native-document-scanner/blob/main/example/vendor/bundle/ruby/3.1.0/gems/cocoapods-try-1.2.0/README.md Install the cocoapods-try plugin using the gem command. ```bash $ gem install cocoapods-try ``` -------------------------------- ### Install Ruby-FFI with System libffi Source: https://github.com/dariyd/react-native-document-scanner/blob/main/example/vendor/bundle/ruby/3.1.0/gems/ffi-1.17.2/README.md Use these commands to install the FFI gem while enforcing the use of the system's libffi library. This can speed up installation. ```bash gem install ffi -- --enable-system-libffi ``` ```bash bundle config build.ffi --enable-system-libffi ``` -------------------------------- ### Unit Tests with Minitest::Test Source: https://github.com/dariyd/react-native-document-scanner/blob/main/example/vendor/bundle/ruby/3.1.0/gems/minitest-5.26.0/README.rdoc Define unit tests using methods starting with 'test_'. Use 'setup' for common test initialization. Assertions like 'assert_equal' and 'refute_match' are available. Tests can be skipped using 'skip'. ```ruby require "minitest/autorun" class TestMeme < Minitest::Test def setup @meme = Meme.new end def test_that_kitty_can_eat assert_equal "OHAI!", @meme.i_can_has_cheezburger? end def test_that_it_will_not_blend refute_match /^no/i, @meme.will_it_blend? end def test_that_will_be_skipped skip "test this later" end end ``` -------------------------------- ### Full Document Scanner Component Example Source: https://context7.com/dariyd/react-native-document-scanner/llms.txt This component demonstrates how to use the `launchScanner` function to capture documents. It handles scanner results, including cancellation and errors, and displays the scanned images. Ensure the necessary permissions and setup are done before using this component. ```tsx import React, { useState } from 'react'; import { Alert, Button, Image, SafeAreaView, ScrollView, StyleSheet, Text, View, } from 'react-native'; import { launchScanner, ImageObject } from '@dariyd/react-native-document-scanner'; export default function DocumentScannerScreen() { const [pages, setPages] = useState([]); const [status, setStatus] = useState(''); const scan = async () => { try { setStatus('Opening scanner…'); const result = await launchScanner({ quality: 0.8, includeExif: true, includeLocationExif: true, }); if (result.didCancel) { setStatus('Cancelled'); } else if (result.error) { setStatus(`Error: ${result.errorMessage}`); Alert.alert('Scanner Error', result.errorMessage); } else { setPages(result.images ?? []); setStatus(`Scanned ${result.images?.length} page(s)`); } } catch (err: any) { setStatus(`Exception: ${err.message}`); } }; return (