1
0
Code Issues Pull Requests Packages Projects Releases Wiki Activity GitHub Gitee

update example

This commit is contained in:
sunnylqm 2024-07-25 22:56:44 +08:00
parent 28b8e122af
commit af65b2660c
No known key found for this signature in database
7 changed files with 62 additions and 14 deletions

View File

@ -2,6 +2,8 @@
package="com.awesomeproject"> package="com.awesomeproject">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<application <application
android:name=".MainApplication" android:name=".MainApplication"

View File

@ -5,10 +5,11 @@ import org.apache.tools.ant.taskdefs.condition.Os
buildscript { buildscript {
ext { ext {
buildToolsVersion = "31.0.0" buildToolsVersion = "31.0.0"
minSdkVersion = 21 minSdkVersion = 23
compileSdkVersion = 31 compileSdkVersion = 31
targetSdkVersion = 31 targetSdkVersion = 31
kotlinVersion = '1.6.10' kotlinVersion = '1.7.20'
kotlin_version = '1.7.20'
if (System.properties['os.arch'] == "aarch64") { if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64 // For M1 Users we need to use the NDK 24 which added support for aarch64

View File

@ -53,5 +53,10 @@
</array> </array>
<key>UIViewControllerBasedStatusBarAppearance</key> <key>UIViewControllerBasedStatusBarAppearance</key>
<false/> <false/>
<key>NSCameraUsageDescription</key>
<string>For taking photos</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>For saving photos</string>
</dict> </dict>
</plist> </plist>

View File

@ -222,17 +222,17 @@ PODS:
- glog - glog
- react-native-safe-area-context (4.8.2): - react-native-safe-area-context (4.8.2):
- React-Core - React-Core
- react-native-update (10.7.1): - react-native-update (10.10.0):
- React - React
- React-Core - React-Core
- react-native-update/HDiffPatch (= 10.7.1) - react-native-update/HDiffPatch (= 10.10.0)
- react-native-update/RCTPushy (= 10.7.1) - react-native-update/RCTPushy (= 10.10.0)
- SSZipArchive - SSZipArchive
- react-native-update/HDiffPatch (10.7.1): - react-native-update/HDiffPatch (10.10.0):
- React - React
- React-Core - React-Core
- SSZipArchive - SSZipArchive
- react-native-update/RCTPushy (10.7.1): - react-native-update/RCTPushy (10.10.0):
- React - React
- React-Core - React-Core
- SSZipArchive - SSZipArchive
@ -302,6 +302,8 @@ PODS:
- React-jsi (= 0.69.8) - React-jsi (= 0.69.8)
- React-logger (= 0.69.8) - React-logger (= 0.69.8)
- React-perflogger (= 0.69.8) - React-perflogger (= 0.69.8)
- ReactNativeCameraKit (14.0.0-beta9):
- React-Core
- RNVectorIcons (10.0.3): - RNVectorIcons (10.0.3):
- React-Core - React-Core
- SSZipArchive (2.4.3) - SSZipArchive (2.4.3)
@ -342,6 +344,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`) - React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`) - React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`) - ReactCommon/turbomodule/core (from `../node_modules/react-native/ReactCommon`)
- ReactNativeCameraKit (from `../node_modules/react-native-camera-kit`)
- RNVectorIcons (from `../node_modules/react-native-vector-icons`) - RNVectorIcons (from `../node_modules/react-native-vector-icons`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`) - Yoga (from `../node_modules/react-native/ReactCommon/yoga`)
@ -417,6 +420,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor" :path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
ReactCommon: ReactCommon:
:path: "../node_modules/react-native/ReactCommon" :path: "../node_modules/react-native/ReactCommon"
ReactNativeCameraKit:
:path: "../node_modules/react-native-camera-kit"
RNVectorIcons: RNVectorIcons:
:path: "../node_modules/react-native-vector-icons" :path: "../node_modules/react-native-vector-icons"
Yoga: Yoga:
@ -444,7 +449,7 @@ SPEC CHECKSUMS:
React-jsinspector: 0eda09e9cf22bbb5dbb1d23143b03a31acf37d67 React-jsinspector: 0eda09e9cf22bbb5dbb1d23143b03a31acf37d67
React-logger: 5997ab008583826c10ffe4e1ff990363e975639d React-logger: 5997ab008583826c10ffe4e1ff990363e975639d
react-native-safe-area-context: 0ee144a6170530ccc37a0fd9388e28d06f516a89 react-native-safe-area-context: 0ee144a6170530ccc37a0fd9388e28d06f516a89
react-native-update: 04844fca9567508fa79649e23e7209904d9d7a5a react-native-update: a7f136a3c87183b13c7ff5c4f9d2b614930968ad
React-perflogger: ad1416a715d86b32f456e5d0aed99c3b52f1de37 React-perflogger: ad1416a715d86b32f456e5d0aed99c3b52f1de37
React-RCTActionSheet: cbf7c6a953982562418ee72a1084ff7b9447b558 React-RCTActionSheet: cbf7c6a953982562418ee72a1084ff7b9447b558
React-RCTAnimation: 33df3e25824dd7313edec28dded2745542f9352b React-RCTAnimation: 33df3e25824dd7313edec28dded2745542f9352b
@ -457,6 +462,7 @@ SPEC CHECKSUMS:
React-RCTVibration: 5462287ee85304ba1a00474665ab292e63a41663 React-RCTVibration: 5462287ee85304ba1a00474665ab292e63a41663
React-runtimeexecutor: 9df680f18497367bcf5c15b6b6406c0f2dfa2b6a React-runtimeexecutor: 9df680f18497367bcf5c15b6b6406c0f2dfa2b6a
ReactCommon: c10f046f3ef8561e7c8e7e9b9dae2ecc9ffc48ef ReactCommon: c10f046f3ef8561e7c8e7e9b9dae2ecc9ffc48ef
ReactNativeCameraKit: 4bec78d688adcd68772af2834d5c30a6a8e2a384
RNVectorIcons: bc7ee28cadf39c77a49232a14738dfce690f66cd RNVectorIcons: bc7ee28cadf39c77a49232a14738dfce690f66cd
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
Yoga: d3820731e0ca3a4933f061ad29defaf7726e3251 Yoga: d3820731e0ca3a4933f061ad29defaf7726e3251

View File

@ -16,9 +16,10 @@
"postinstall-postinstall": "^2.1.0", "postinstall-postinstall": "^2.1.0",
"react": "18.0.0", "react": "18.0.0",
"react-native": "0.69.8", "react-native": "0.69.8",
"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.7.1", "react-native-update": "^10.10.0",
"react-native-vector-icons": "^10.0.3" "react-native-vector-icons": "^10.0.3"
}, },
"devDependencies": { "devDependencies": {

View File

@ -10,7 +10,16 @@ import {
Image, Image,
Switch, Switch,
} from 'react-native'; } from 'react-native';
import {Icon, PaperProvider, Snackbar, Banner} from 'react-native-paper'; import {
Icon,
PaperProvider,
Snackbar,
Banner,
Button,
Modal,
Portal,
} from 'react-native-paper';
import {Camera} from 'react-native-camera-kit';
import TestConsole from './TestConsole'; import TestConsole from './TestConsole';
@ -28,6 +37,7 @@ function App() {
updateInfo, updateInfo,
packageVersion, packageVersion,
currentHash, currentHash,
parseTestPayload,
progress: {received, total} = {}, progress: {received, total} = {},
} = usePushy(); } = usePushy();
const [useDefaultAlert, setUseDefaultAlert] = useState(true); const [useDefaultAlert, setUseDefaultAlert] = useState(true);
@ -36,6 +46,7 @@ function App() {
const [showUpdateSnackbar, setShowUpdateSnackbar] = useState(false); const [showUpdateSnackbar, setShowUpdateSnackbar] = useState(false);
const snackbarVisible = const snackbarVisible =
!useDefaultAlert && showUpdateSnackbar && updateInfo?.update; !useDefaultAlert && showUpdateSnackbar && updateInfo?.update;
const [showCamera, setShowCamera] = useState(false);
return ( return (
<View style={styles.container}> <View style={styles.container}>
@ -55,6 +66,23 @@ function App() {
}} }}
/> />
</View> </View>
<Button onPress={() => setShowCamera(true)}></Button>
<Portal>
<Modal visible={showCamera} onDismiss={() => setShowCamera(false)}>
<Camera
style={{minHeight: 320}}
scanBarcode={true}
onReadCode={({nativeEvent: {codeStringValue}}) => {
console.log(codeStringValue);
parseTestPayload(codeStringValue);
setShowCamera(false);
}} // 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
frameColor="white" // (default white) optional, color of border of scanner frame
/>
</Modal>
</Portal>
<Image <Image
resizeMode={'contain'} resizeMode={'contain'}
source={require('./assets/shezhi.png')} source={require('./assets/shezhi.png')}

View File

@ -6202,6 +6202,11 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==
react-native-camera-kit@^14.0.0-beta15:
version "14.0.0-beta9"
resolved "https://registry.yarnpkg.com/react-native-camera-kit/-/react-native-camera-kit-14.0.0-beta9.tgz#fa00aceeedd4fbc7ab82d94cb7e64de471165554"
integrity sha512-OPRyJMmJibfVxrMvpbDgprhsrKlKWGvtLgkV+tY97HnEmTuW4in7qx/RC5wMKMZDwgBxgLtFhO7rYAMylIpH2A==
react-native-codegen@^0.69.2: react-native-codegen@^0.69.2:
version "0.69.2" version "0.69.2"
resolved "https://registry.yarnpkg.com/react-native-codegen/-/react-native-codegen-0.69.2.tgz#e33ac3b1486de59ddae687b731ddbfcef8af0e4e" resolved "https://registry.yarnpkg.com/react-native-codegen/-/react-native-codegen-0.69.2.tgz#e33ac3b1486de59ddae687b731ddbfcef8af0e4e"
@ -6231,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.7.1: react-native-update@^10.10.0:
version "10.7.1" version "10.10.0"
resolved "https://registry.yarnpkg.com/react-native-update/-/react-native-update-10.7.1.tgz#f89075b69b4a397ce6d3457837018fb6cfabe0ab" resolved "https://registry.yarnpkg.com/react-native-update/-/react-native-update-10.10.0.tgz#5861f0c217d1ed194e1a8aba81fed5430178795c"
integrity sha512-Lru/8qunNjggvjzfe6uzWi4HWsFmNjtwdLXC3lD+1hWQpJ8ln5bwQlYoXyz0n8GwNJiS8Z/w8oPXVxs323ls3g== integrity sha512-qZd5kJ9UlNh5Y0zU5vLdIviYwLvTPqdgIynmt4DQ1wEUu2/F6RrI17dICq54em5ValQWB6ua/tdj2lyTVPvADg==
dependencies: dependencies:
nanoid "^3.3.3" nanoid "^3.3.3"