Skip to content

Commit a422b76

Browse files
Fixing wrong links and updated guides
1 parent 2466e24 commit a422b76

File tree

6 files changed

+491
-40
lines changed

6 files changed

+491
-40
lines changed

_includes/sidelist-programming/programming-react-native.html

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
<ul lang="react-native">
55
<li lang="react-native"><a class="otherLinkColour" href="{{ site.dbr_react_native }}user-guide.html" style="cursor:pointer;color:#3c3c3c">Ready-To-Use Guide</a></li>
66
<li lang="react-native"><a class="otherLinkColour" href="{{ site.dbr_react_native }}foundational-user-guide.html" style="cursor:pointer;color:#3c3c3c">Foundational Guide</a></li>
7-
<li lang="react-native"><a class="otherLinkColour" href="{{ site.dbr_react_native }}driver-license-user-guide.html" style="cursor:pointer;color:#3c3c3c">Driver License Guide</a></li>
7+
<!-- <li lang="react-native"><a class="otherLinkColour" href="{{ site.dbr_react_native }}driver-license-user-guide.html" style="cursor:pointer;color:#3c3c3c">Driver License Guide</a></li> -->
88
</ul>
99
</li>
10-
<li lang="react-native"><a style="cursor:pointer;color:#3c3c3c">Explore Features</a>
10+
<!-- <li lang="react-native"><a style="cursor:pointer;color:#3c3c3c">Explore Features</a>
1111
<ul lang="react-native">
1212
<li lang="react-native"><a class="otherLinkColour" href="{{ site.dbr_react_native }}explore-features/ui-customization.html" style="cursor:pointer;color:#3c3c3c">UI Customization</a></li>
1313
<li lang="react-native"><a class="otherLinkColour" href="{{ site.dbr_react_native }}explore-features/advanced-features.html" style="cursor:pointer;color:#3c3c3c">Advanced Features</a></li>
1414
</ul>
15-
</li>
15+
</li> -->
1616
<li lang="react-native"><a href="{{ site.dbr_react_native }}samples/index.html" class="otherLinkColour">Demo &amp; Samples</a></li>
1717

1818
<li lang="react-native"><a href="{{ site.dbr_react_native_api }}barcode-scanner/index.html" style="cursor:pointer;color:#3c3c3c" class="otherLinkColour">BarcodeScanner API</a>
@@ -184,36 +184,6 @@
184184
</li>
185185
</ul>
186186
</li>
187-
<li lang="react-native"><a>DocumentNormalizer</a>
188-
<ul lang="react-native">
189-
<li lang="react-native"><a class="otherLinkColour">Interfaces</a>
190-
<ul lang="react-native">
191-
<li lang="react-native"><a href="{{ site.ddn_react_native_api }}deskewed-image-result-item.html" class="otherLinkColour">DeskewedImageResultItem</a></li>
192-
<li lang="react-native"><a href="{{ site.ddn_react_native_api }}detected-quad-result-item.html" class="otherLinkColour">DetectedQuadResultItem</a></li>
193-
<li lang="react-native"><a href="{{ site.ddn_react_native_api }}enhanced-image-result-item.html" class="otherLinkColour">EnhancedImageResultItem</a></li>
194-
<li lang="react-native"><a href="{{ site.ddn_react_native_api }}processed-document-result.html" class="otherLinkColour">ProcessedDocumentResult</a></li>
195-
<li lang="react-native"><a href="{{ site.ddn_react_native_api }}simplified-document-normalizer-settings.html" class="otherLinkColour">SimplifiedDocumentNormalizerSettings</a></li>
196-
</ul>
197-
</li>
198-
<li lang="react-native"><a class="otherLinkColour">Enumerations</a>
199-
<ul lang="react-native">
200-
<li lang="react-native"><a href="{{ site.ddn_react_native_api }}enum/image-colour-mode.html" class="otherLinkColour">EnumImageColourMode</a></li>
201-
</ul>
202-
</li>
203-
</ul>
204-
</li>
205-
<li lang="react-native"><a>LabelRecognizer</a>
206-
<ul lang="react-native">
207-
<li lang="react-native"><a class="otherLinkColour">Interfaces</a>
208-
<ul lang="react-native">
209-
<li lang="react-native"><a href="{{ site.dlr_react_native_api }}character-result.html" class="otherLinkColour">CharacterResult</a></li>
210-
<li lang="react-native"><a href="{{ site.dlr_react_native_api }}recognized-text-lines-result.html" class="otherLinkColour">RecognizedTextLinesResult</a></li>
211-
<li lang="react-native"><a href="{{ site.dlr_react_native_api }}simplified-label-recognizer-settings.html" class="otherLinkColour">SimplifiedLabelRecognizerSettings</a></li>
212-
<li lang="react-native"><a href="{{ site.dlr_react_native_api }}text-line-result-item.html" class="otherLinkColour">TextLineResultItem</a></li>
213-
</ul>
214-
</li>
215-
</ul>
216-
</li>
217187
</ul>
218188
</li>
219189

programming/react-native/api-reference/barcode-scanner/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@ The BarcodeScanner class is built on top of the Capture Vision Foundational API
2121
[`BarcodeScanner`](barcode-scanner.md) is the main class of the Ready-to-Use edition of the library and contains the API needed to implement the barcode scanning functionality. Please visit the BarcodeScanner Class page to learn about how this class operates.
2222

2323
> [!TIP]
24-
> To learn how to implement the Barcode Reader using the BarcodeScanner API, please read through the [Barcode Reader Integration Guide (Ready-To-Use Edition)](../user-guide.md).
24+
> To learn how to implement the Barcode Reader using the BarcodeScanner API, please read through the [Barcode Reader Integration Guide (Ready-To-Use Edition)](../../user-guide.md).
2525
2626
### BarcodeScannerConfig
2727

2828
[`BarcodeScannerConfig`](barcode-scanner-config.md) is the class that defines the configurations for the Barcode Scanner. These configurations can be from a performance related or UI related. Even though the full set of parameters of the Barcode Reader is not exposed in this class, they can still be set via a JSON template - allowing the developer to fully customize the Barcode Reader's performance while still making use of the benefits of the Ready-To-Use API.
2929

3030
> [!TIP]
31-
> To learn how to configure the BarcodeScanner instance using the BarcodeScannerConfig class, please visit this [section of the Ready-To-Use Guide](../../user-guide.md#configuring-the-barcodescanner-optional).
31+
> To learn how to configure the BarcodeScanner instance using the BarcodeScannerConfig class, please visit this [section of the Ready-To-Use Guide](../../user-guide.md#optional-configure-your-barcode-scanner).
3232
3333
### BarcodeScanResult
3434

35-
[`BarcodeScanResult`](barcode-scan-result.md) is a result class that contains all the decoded barcodes and their associated info. This class is dependent on the [`BarcodeResultItem`](../capture-vision-router/barcode-result-item.md) class which is part of the Capture Vision Foundational API.
35+
[`BarcodeScanResult`](barcode-scan-result.md) is a result class that contains all the decoded barcodes and their associated info. This class is dependent on the [`BarcodeResultItem`](../barcode-reader/barcode-result-item.md) class which is part of the Capture Vision Foundational API.
3636

programming/react-native/api-reference/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ The Dynamsoft Capture Vision Router class is the cornerstone of the Dynamsoft Ca
2020

2121
You can find the CaptureVisionRouter API [here]({{ site.dcv_react_native_api }}capture-vision-router/capture-vision-router.html).
2222

23-
This guide focuses on the Barcode Reader functional product. To learn how to use the foundational Capture Vision API to set up and run the Barcode Reader, please refer to the [User Guide (Foundational Edition)]({{ site.dbr_react_native }}foundational-user-guide.html).
23+
This guide focuses on the Barcode Reader functional product. To learn how to use the foundational Capture Vision API to set up and run the Barcode Reader, please refer to the [User Guide (Foundational Edition)](../foundational-user-guide.md).
2424

2525
### Image Source
2626

27-
[`CameraEnhancer`]({{ site.dce_react_native_api }}primary-api/camera-enhancer.html) is a class that not only implements the video frame obtaining APIs but also enable you to improve the video quality by adjusting the camera settings.
27+
[`CameraEnhancer`]({{ site.dce_react_native_api }}camera-enhancer.html) is a class that not only implements the video frame obtaining APIs but also enable you to improve the video quality by adjusting the camera settings.
2828

2929
### Captured Result Receiver
3030

Lines changed: 235 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,235 @@
1+
---
2+
layout: default-layout
3+
title: Foundational APIs - Dynamsoft Barcode Reader React Native
4+
description: This is the user guide of Dynamsoft Barcode Reader React Native SDK (Foundational-API Edition).
5+
keywords: user guide, React Native, Foundational, barcode, scanner
6+
needAutoGenerateSidebar: true
7+
needGenerateH3Content: true
8+
noTitleIndex: true
9+
---
10+
11+
# Build Your Barcode Scanner First App (with Foundational APIs)
12+
13+
This guide will help you develop a fully-customizable barcode scanning app with the Foundational APIs.
14+
15+
## System Requirements
16+
17+
- React Native
18+
- Supported Version: 0.71.0 or higher
19+
- Android
20+
- Supported OS: Android 5.0 (API Level 21) or higher.
21+
- Supported ABI: armeabi-v7a, arm64-v8a, x86 and x86_64.
22+
- Development Environment: Android Studio 2022.2.1 or higher.
23+
- iOS
24+
- Supported OS: iOS 13+.
25+
- Supported ABI: arm64 and x86_64.
26+
- Development Environment: Xcode 13+ (Xcode 14.1+ recommended).
27+
28+
## Installation
29+
30+
Run the following commands in the root directory of your react-native project to add the required dependencies:
31+
32+
```bash
33+
# using npm
34+
npm install dynamsoft-capture-vision-react-native
35+
npm install dynamsoft-barcode-reader-bundle-react-native
36+
37+
# OR using Yarn
38+
yarn add dynamsoft-capture-vision-react-native
39+
yarn add dynamsoft-barcode-reader-bundle-react-native
40+
```
41+
42+
Than run the command to install all dependencies:
43+
44+
```bash
45+
# using npm
46+
npm install
47+
48+
# OR using Yarn
49+
yarn install
50+
```
51+
52+
For iOS, you must install the necessary native frameworks from CocoaPods by running the pod install command as below:
53+
54+
```bash
55+
cd ios
56+
pod install
57+
```
58+
59+
## License Actication
60+
61+
License is configured when launching the `BarcodeScanner` via `BarcodeScanConfig`. For example:
62+
63+
```js
64+
const License = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
65+
LicenseManager.initLicense(License).catch(e => {
66+
Alert.alert('License error', e.message);
67+
});
68+
```
69+
70+
> [!Note]
71+
>
72+
> - The LICENSE string here grants a time-limited free trial which requires network connection to work.
73+
> - You can request a 30-day trial license via the [Request a Trial License](https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=guide&package=react-native){:target="_blank"} link.
74+
> - If you download the <a href="https://www.dynamsoft.com/barcode-reader/downloads/?utm_source=docs#mobile" target="_blank">Installation Package</a>, it comes with a 30-day trial license by default.
75+
76+
## Build Your Barcode Scanner App
77+
78+
### Preparation
79+
80+
1. Initialize a new React Native project with the following command:
81+
82+
```bash
83+
npx @react-native-community/cli init BarcodeScanner
84+
```
85+
86+
2. Open the project folder and follow the [installation section](#installation) to install the dependencies.
87+
88+
### Implementing the Barcode Scanner
89+
90+
Find the App.tsx file in your project and replace the file with the following code:
91+
92+
```js
93+
import {
94+
CameraEnhancer,
95+
CameraView,
96+
CaptureVisionRouter,
97+
EnumPresetTemplate,
98+
LicenseManager,
99+
} from 'dynamsoft-capture-vision-react-native';
100+
import React, {useEffect, useRef} from 'react';
101+
import {Alert, AppState, SafeAreaView, StyleSheet} from 'react-native';
102+
103+
const License = 'DLS2eyJvcmdhbml6YXRpb25JRCI6IjIwMDAwMSJ9';
104+
LicenseManager.initLicense(License).catch(e => {
105+
Alert.alert('License error', e.message);
106+
});
107+
108+
function App(): React.JSX.Element {
109+
const cameraView = useRef<CameraView>(null!);
110+
const cvr = CaptureVisionRouter.getInstance();
111+
const camera = CameraEnhancer.getInstance();
112+
113+
useEffect(() => {
114+
// Request camera permission once
115+
CameraEnhancer.requestCameraPermission();
116+
117+
// Configure router, camera and view
118+
cvr.setInput(camera);
119+
camera.setCameraView(cameraView.current);
120+
121+
// Barcode result handler
122+
const receiver = cvr.addResultReceiver({
123+
onDecodedBarcodesReceived: ({items}) => {
124+
if (items?.length) {
125+
cvr.stopCapturing();
126+
Alert.alert(
127+
`Barcodes count: ${items.length}`,
128+
items.map((barcode, i) => `${i + 1}. ${barcode.formatString}: ${barcode.text}`).join('\n\n'),
129+
[
130+
{
131+
text: 'OK',
132+
onPress: () => {
133+
cvr.startCapturing(EnumPresetTemplate.PT_READ_BARCODES)
134+
.catch(e => Alert.alert('Start error', e.message));
135+
}
136+
}
137+
]
138+
);
139+
}
140+
},
141+
});
142+
143+
// Helper to start camera + scanning
144+
const startScanning = () => {
145+
console.log('Starting...');
146+
camera.open();
147+
cvr.startCapturing(EnumPresetTemplate.PT_READ_BARCODES)
148+
.catch(e => Alert.alert('Start error', e.message));
149+
};
150+
151+
// Helper to stop camera + scanning
152+
const stopScanning = () => {
153+
console.log('Stopping...');
154+
cvr.stopCapturing();
155+
camera.close();
156+
};
157+
158+
// Initial start when component mounts
159+
startScanning();
160+
161+
// Listen to AppState changes
162+
const sub = AppState.addEventListener('change', nextState => {
163+
if (nextState === 'active') {
164+
startScanning();
165+
} else if (nextState.match(/inactive|background/)) {
166+
stopScanning();
167+
}
168+
});
169+
170+
// Cleanup on unmount
171+
return () => {
172+
sub.remove();
173+
stopScanning();
174+
cvr.removeResultReceiver(receiver);
175+
};
176+
}, [cvr, camera]);
177+
178+
return (
179+
<SafeAreaView style={StyleSheet.absoluteFill}>
180+
<CameraView style={StyleSheet.absoluteFill} ref={cameraView}/>
181+
</SafeAreaView>
182+
);
183+
}
184+
185+
export default App;
186+
```
187+
188+
### Run the App
189+
190+
#### Android
191+
192+
Run the following command to start the app:
193+
194+
```bash
195+
# using npm
196+
npm run android
197+
198+
# OR using Yarn
199+
yarn android
200+
```
201+
202+
#### iOS
203+
204+
1. Include the camera permission via `ios/your-project-name/Info.plist` inside the `<dict>` element:
205+
206+
```xml
207+
<key>NSCameraUsageDescription</key>
208+
<string></string>
209+
```
210+
211+
2. Open the workspace via the Xcode.
212+
213+
3. Configure the *Provisioning* and *Signing* settings.
214+
215+
4. Run the app with the following command:
216+
217+
```bash
218+
# using npm
219+
npm run ios
220+
221+
# OR using Yarn
222+
yarn ios
223+
```
224+
225+
## Full Sample Code
226+
227+
The full sample code is available [here](https://github.com/Dynamsoft/barcode-reader-react-native-samples/tree/main/ScanBarcodes_ReadyToUseComponent).
228+
229+
## License
230+
231+
You can request a 30-day trial license via the [Request Trial License](https://www.dynamsoft.com/customer/license/trialLicense?product=dbr&utm_source=github&package=mobile) link.
232+
233+
## Support
234+
235+
[https://www.dynamsoft.com/company/contact/](https://www.dynamsoft.com/company/contact/)

programming/react-native/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Dynamsoft Barcode Reader (DBR) SDK React Native Edition is a barcode reading too
1313

1414
DBR React Native provides rich API for developers to easily integrate barcode reading functionality into your React Native applications. When you start the development journey with DBR React Native, you can choose the **Ready-To-Use Edition** or the **Foundational Edition** - with each providing its own set of benefits.
1515

16-
- ***Ready-To-Use Edition***: This edition of the library comes with its own, built-in, sophisticated UI for the camera view. This edition also simplifies the Barcode Reader configuration and focuses on the core configurations of the Barcode Reader. Overall, this edition allows the developer to spend less time worrying about the UI and the extra steps needed to configure the Barcode Reader, but takes away some of the more intricate configurations that can be applied to the Barcode Reader.
17-
- ***Foundational Edition***: This edition of the library is built using the foundational Capture Vision API - allowing the user more detailed control over the initialization and configuration of the Barcode Reader. This edition does not come with a built-in UI like the Ready-To-Use Edition, so the UI setup will fall on the developer. However, using the Foundational Edition does open up a larger variety of parameters that can be controlled via the settings (which can still be used in the RTU Edition, but only via a JSON template).
16+
- ***[Ready-To-Use Edition](user-guide.md)***: This edition of the library comes with its own, built-in, sophisticated UI for the camera view. This edition also simplifies the Barcode Reader configuration and focuses on the core configurations of the Barcode Reader. Overall, this edition allows the developer to spend less time worrying about the UI and the extra steps needed to configure the Barcode Reader, but takes away some of the more intricate configurations that can be applied to the Barcode Reader.
17+
- ***[Foundational Edition](foundational-user-guide.md)***: This edition of the library is built using the foundational Capture Vision API - allowing the user more detailed control over the initialization and configuration of the Barcode Reader. This edition does not come with a built-in UI like the Ready-To-Use Edition, so the UI setup will fall on the developer. However, using the Foundational Edition does open up a larger variety of parameters that can be controlled via the settings (which can still be used in the RTU Edition, but only via a JSON template).
1818

1919
Furthermore, DBR provides a powerful parameter system in order to cope with various scenarios. Read <a href="{{ site.dcvb_parameters }}file/index.html">Parameter Reference</a> for details.

0 commit comments

Comments
 (0)