update example
This commit is contained in:
parent
7531e8ca3a
commit
92bc830d98
@ -20,7 +20,7 @@
|
|||||||
"react-native-camera-kit": "^14.0.0-beta15",
|
"react-native-camera-kit": "^14.0.0-beta15",
|
||||||
"react-native-paper": "^5.12.1",
|
"react-native-paper": "^5.12.1",
|
||||||
"react-native-safe-area-context": "^4.8.2",
|
"react-native-safe-area-context": "^4.8.2",
|
||||||
"react-native-update": "^10.11.2",
|
"react-native-update": "^10.11.3",
|
||||||
"react-native-vector-icons": "^10.0.3"
|
"react-native-vector-icons": "^10.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/* eslint-disable react/no-unstable-nested-components */
|
/* eslint-disable react/no-unstable-nested-components */
|
||||||
/* eslint-disable react-native/no-inline-styles */
|
/* eslint-disable react-native/no-inline-styles */
|
||||||
import React, {useState} from 'react';
|
import React, {useRef, useState} from 'react';
|
||||||
import {
|
import {
|
||||||
StyleSheet,
|
StyleSheet,
|
||||||
Platform,
|
Platform,
|
||||||
@ -47,6 +47,7 @@ function App() {
|
|||||||
const snackbarVisible =
|
const snackbarVisible =
|
||||||
!useDefaultAlert && showUpdateSnackbar && updateInfo?.update;
|
!useDefaultAlert && showUpdateSnackbar && updateInfo?.update;
|
||||||
const [showCamera, setShowCamera] = useState(false);
|
const [showCamera, setShowCamera] = useState(false);
|
||||||
|
const lastParsedCode = useRef('');
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
@ -73,9 +74,16 @@ function App() {
|
|||||||
style={{minHeight: 320}}
|
style={{minHeight: 320}}
|
||||||
scanBarcode={true}
|
scanBarcode={true}
|
||||||
onReadCode={({nativeEvent: {codeStringValue}}) => {
|
onReadCode={({nativeEvent: {codeStringValue}}) => {
|
||||||
console.log(codeStringValue);
|
// 防止重复扫码
|
||||||
parseTestQrCode(codeStringValue);
|
if (lastParsedCode.current === codeStringValue) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lastParsedCode.current = codeStringValue;
|
||||||
|
setTimeout(() => {
|
||||||
|
lastParsedCode.current = '';
|
||||||
|
}, 1000);
|
||||||
setShowCamera(false);
|
setShowCamera(false);
|
||||||
|
parseTestQrCode(codeStringValue);
|
||||||
}} // optional
|
}} // optional
|
||||||
showFrame={true} // (default false) optional, show frame with transparent layer (qr code or barcode will be read on this area ONLY), start animation for scanner, that stops when a code has been found. Frame always at center of the screen
|
showFrame={true} // (default false) optional, show frame with transparent layer (qr code or barcode will be read on this area ONLY), start animation for scanner, that stops when a code has been found. Frame always at center of the screen
|
||||||
laserColor="red" // (default red) optional, color of laser in scanner frame
|
laserColor="red" // (default red) optional, color of laser in scanner frame
|
||||||
|
@ -6236,10 +6236,10 @@ react-native-safe-area-context@^4.8.2:
|
|||||||
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.8.2.tgz#e6b3d8acf3c6afcb4b5db03a97f9c37df7668f65"
|
resolved "https://registry.yarnpkg.com/react-native-safe-area-context/-/react-native-safe-area-context-4.8.2.tgz#e6b3d8acf3c6afcb4b5db03a97f9c37df7668f65"
|
||||||
integrity sha512-ffUOv8BJQ6RqO3nLml5gxJ6ab3EestPiyWekxdzO/1MQ7NF8fW1Mzh1C5QE9yq573Xefnc7FuzGXjtesZGv7cQ==
|
integrity sha512-ffUOv8BJQ6RqO3nLml5gxJ6ab3EestPiyWekxdzO/1MQ7NF8fW1Mzh1C5QE9yq573Xefnc7FuzGXjtesZGv7cQ==
|
||||||
|
|
||||||
react-native-update@^10.11.2:
|
react-native-update@^10.11.3:
|
||||||
version "10.11.2"
|
version "10.11.3"
|
||||||
resolved "https://registry.yarnpkg.com/react-native-update/-/react-native-update-10.11.2.tgz#d80f0c0f3705713d302b6c36d3fd8ff2f0fba340"
|
resolved "https://registry.yarnpkg.com/react-native-update/-/react-native-update-10.11.3.tgz#5fa44fdd12514eb5e7901a5d664f00fd082d6774"
|
||||||
integrity sha512-5WlJ3TRodHSftqDxi3OCAnI/OIq70Kh8gr1xa9OqEG2+UwD1SA+gqHRHunKED4J7N7OUtmxIDX+hvdf8xJEgRA==
|
integrity sha512-adI3sly0yFt1DfaPqICJ9VwzUoa/XAngv/N7SnICkLxO3jgccBgy0OrXDBxRn43Zeumdq40Z+ADTE5qrY4BWAw==
|
||||||
dependencies:
|
dependencies:
|
||||||
nanoid "^3.3.3"
|
nanoid "^3.3.3"
|
||||||
react-native-url-polyfill "^2.0.0"
|
react-native-url-polyfill "^2.0.0"
|
||||||
|
Loading…
Reference in New Issue
Block a user