mirror of
				https://gitcode.com/gh_mirrors/re/react-native-pushy.git
				synced 2025-10-31 13:23:12 +08:00 
			
		
		
		
	update example
This commit is contained in:
		| @@ -20,7 +20,7 @@ | ||||
|     "react-native-camera-kit": "^14.0.0-beta15", | ||||
|     "react-native-paper": "^5.12.1", | ||||
|     "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" | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| /* eslint-disable react/no-unstable-nested-components */ | ||||
| /* eslint-disable react-native/no-inline-styles */ | ||||
| import React, {useState} from 'react'; | ||||
| import React, {useRef, useState} from 'react'; | ||||
| import { | ||||
|   StyleSheet, | ||||
|   Platform, | ||||
| @@ -47,6 +47,7 @@ function App() { | ||||
|   const snackbarVisible = | ||||
|     !useDefaultAlert && showUpdateSnackbar && updateInfo?.update; | ||||
|   const [showCamera, setShowCamera] = useState(false); | ||||
|   const lastParsedCode = useRef(''); | ||||
|  | ||||
|   return ( | ||||
|     <View style={styles.container}> | ||||
| @@ -73,9 +74,16 @@ function App() { | ||||
|             style={{minHeight: 320}} | ||||
|             scanBarcode={true} | ||||
|             onReadCode={({nativeEvent: {codeStringValue}}) => { | ||||
|               console.log(codeStringValue); | ||||
|               parseTestQrCode(codeStringValue); | ||||
|               // 防止重复扫码 | ||||
|               if (lastParsedCode.current === codeStringValue) { | ||||
|                 return; | ||||
|               } | ||||
|               lastParsedCode.current = codeStringValue; | ||||
|               setTimeout(() => { | ||||
|                 lastParsedCode.current = ''; | ||||
|               }, 1000); | ||||
|               setShowCamera(false); | ||||
|               parseTestQrCode(codeStringValue); | ||||
|             }} // 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 | ||||
|             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" | ||||
|   integrity sha512-ffUOv8BJQ6RqO3nLml5gxJ6ab3EestPiyWekxdzO/1MQ7NF8fW1Mzh1C5QE9yq573Xefnc7FuzGXjtesZGv7cQ== | ||||
|  | ||||
| react-native-update@^10.11.2: | ||||
|   version "10.11.2" | ||||
|   resolved "https://registry.yarnpkg.com/react-native-update/-/react-native-update-10.11.2.tgz#d80f0c0f3705713d302b6c36d3fd8ff2f0fba340" | ||||
|   integrity sha512-5WlJ3TRodHSftqDxi3OCAnI/OIq70Kh8gr1xa9OqEG2+UwD1SA+gqHRHunKED4J7N7OUtmxIDX+hvdf8xJEgRA== | ||||
| react-native-update@^10.11.3: | ||||
|   version "10.11.3" | ||||
|   resolved "https://registry.yarnpkg.com/react-native-update/-/react-native-update-10.11.3.tgz#5fa44fdd12514eb5e7901a5d664f00fd082d6774" | ||||
|   integrity sha512-adI3sly0yFt1DfaPqICJ9VwzUoa/XAngv/N7SnICkLxO3jgccBgy0OrXDBxRn43Zeumdq40Z+ADTE5qrY4BWAw== | ||||
|   dependencies: | ||||
|     nanoid "^3.3.3" | ||||
|     react-native-url-polyfill "^2.0.0" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 sunnylqm
					sunnylqm