Skip to content

Commit

Permalink
update example
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnylqm committed Jul 25, 2024
1 parent 28b8e12 commit af65b26
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
package="com.awesomeproject">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
android:name=".MainApplication"
Expand Down
5 changes: 3 additions & 2 deletions Example/testHotUpdate/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
ext {
buildToolsVersion = "31.0.0"
minSdkVersion = 21
minSdkVersion = 23
compileSdkVersion = 31
targetSdkVersion = 31
kotlinVersion = '1.6.10'
kotlinVersion = '1.7.20'
kotlin_version = '1.7.20'

if (System.properties['os.arch'] == "aarch64") {
// For M1 Users we need to use the NDK 24 which added support for aarch64
Expand Down
5 changes: 5 additions & 0 deletions Example/testHotUpdate/ios/AwesomeProject/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,10 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>NSCameraUsageDescription</key>
<string>For taking photos</string>

<key>NSPhotoLibraryUsageDescription</key>
<string>For saving photos</string>
</dict>
</plist>
18 changes: 12 additions & 6 deletions Example/testHotUpdate/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -222,17 +222,17 @@ PODS:
- glog
- react-native-safe-area-context (4.8.2):
- React-Core
- react-native-update (10.7.1):
- react-native-update (10.10.0):
- React
- React-Core
- react-native-update/HDiffPatch (= 10.7.1)
- react-native-update/RCTPushy (= 10.7.1)
- react-native-update/HDiffPatch (= 10.10.0)
- react-native-update/RCTPushy (= 10.10.0)
- SSZipArchive
- react-native-update/HDiffPatch (10.7.1):
- react-native-update/HDiffPatch (10.10.0):
- React
- React-Core
- SSZipArchive
- react-native-update/RCTPushy (10.7.1):
- react-native-update/RCTPushy (10.10.0):
- React
- React-Core
- SSZipArchive
Expand Down Expand Up @@ -302,6 +302,8 @@ PODS:
- React-jsi (= 0.69.8)
- React-logger (= 0.69.8)
- React-perflogger (= 0.69.8)
- ReactNativeCameraKit (14.0.0-beta9):
- React-Core
- RNVectorIcons (10.0.3):
- React-Core
- SSZipArchive (2.4.3)
Expand Down Expand Up @@ -342,6 +344,7 @@ DEPENDENCIES:
- React-RCTVibration (from `../node_modules/react-native/Libraries/Vibration`)
- React-runtimeexecutor (from `../node_modules/react-native/ReactCommon/runtimeexecutor`)
- 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`)
- Yoga (from `../node_modules/react-native/ReactCommon/yoga`)

Expand Down Expand Up @@ -417,6 +420,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/runtimeexecutor"
ReactCommon:
:path: "../node_modules/react-native/ReactCommon"
ReactNativeCameraKit:
:path: "../node_modules/react-native-camera-kit"
RNVectorIcons:
:path: "../node_modules/react-native-vector-icons"
Yoga:
Expand Down Expand Up @@ -444,7 +449,7 @@ SPEC CHECKSUMS:
React-jsinspector: 0eda09e9cf22bbb5dbb1d23143b03a31acf37d67
React-logger: 5997ab008583826c10ffe4e1ff990363e975639d
react-native-safe-area-context: 0ee144a6170530ccc37a0fd9388e28d06f516a89
react-native-update: 04844fca9567508fa79649e23e7209904d9d7a5a
react-native-update: a7f136a3c87183b13c7ff5c4f9d2b614930968ad
React-perflogger: ad1416a715d86b32f456e5d0aed99c3b52f1de37
React-RCTActionSheet: cbf7c6a953982562418ee72a1084ff7b9447b558
React-RCTAnimation: 33df3e25824dd7313edec28dded2745542f9352b
Expand All @@ -457,6 +462,7 @@ SPEC CHECKSUMS:
React-RCTVibration: 5462287ee85304ba1a00474665ab292e63a41663
React-runtimeexecutor: 9df680f18497367bcf5c15b6b6406c0f2dfa2b6a
ReactCommon: c10f046f3ef8561e7c8e7e9b9dae2ecc9ffc48ef
ReactNativeCameraKit: 4bec78d688adcd68772af2834d5c30a6a8e2a384
RNVectorIcons: bc7ee28cadf39c77a49232a14738dfce690f66cd
SSZipArchive: fe6a26b2a54d5a0890f2567b5cc6de5caa600aef
Yoga: d3820731e0ca3a4933f061ad29defaf7726e3251
Expand Down
3 changes: 2 additions & 1 deletion Example/testHotUpdate/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@
"postinstall-postinstall": "^2.1.0",
"react": "18.0.0",
"react-native": "0.69.8",
"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.7.1",
"react-native-update": "^10.10.0",
"react-native-vector-icons": "^10.0.3"
},
"devDependencies": {
Expand Down
30 changes: 29 additions & 1 deletion Example/testHotUpdate/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,16 @@ import {
Image,
Switch,
} 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';

Expand All @@ -28,6 +37,7 @@ function App() {
updateInfo,
packageVersion,
currentHash,
parseTestPayload,
progress: {received, total} = {},
} = usePushy();
const [useDefaultAlert, setUseDefaultAlert] = useState(true);
Expand All @@ -36,6 +46,7 @@ function App() {
const [showUpdateSnackbar, setShowUpdateSnackbar] = useState(false);
const snackbarVisible =
!useDefaultAlert && showUpdateSnackbar && updateInfo?.update;
const [showCamera, setShowCamera] = useState(false);

return (
<View style={styles.container}>
Expand All @@ -55,6 +66,23 @@ function App() {
}}
/>
</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
resizeMode={'contain'}
source={require('./assets/shezhi.png')}
Expand Down
13 changes: 9 additions & 4 deletions Example/testHotUpdate/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6202,6 +6202,11 @@ react-is@^17.0.1:
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
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:
version "0.69.2"
resolved "https://registry.yarnpkg.com/react-native-codegen/-/react-native-codegen-0.69.2.tgz#e33ac3b1486de59ddae687b731ddbfcef8af0e4e"
Expand Down Expand Up @@ -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"
integrity sha512-ffUOv8BJQ6RqO3nLml5gxJ6ab3EestPiyWekxdzO/1MQ7NF8fW1Mzh1C5QE9yq573Xefnc7FuzGXjtesZGv7cQ==

react-native-update@^10.7.1:
version "10.7.1"
resolved "https://registry.yarnpkg.com/react-native-update/-/react-native-update-10.7.1.tgz#f89075b69b4a397ce6d3457837018fb6cfabe0ab"
integrity sha512-Lru/8qunNjggvjzfe6uzWi4HWsFmNjtwdLXC3lD+1hWQpJ8ln5bwQlYoXyz0n8GwNJiS8Z/w8oPXVxs323ls3g==
react-native-update@^10.10.0:
version "10.10.0"
resolved "https://registry.yarnpkg.com/react-native-update/-/react-native-update-10.10.0.tgz#5861f0c217d1ed194e1a8aba81fed5430178795c"
integrity sha512-qZd5kJ9UlNh5Y0zU5vLdIviYwLvTPqdgIynmt4DQ1wEUu2/F6RrI17dICq54em5ValQWB6ua/tdj2lyTVPvADg==
dependencies:
nanoid "^3.3.3"

Expand Down

0 comments on commit af65b26

Please sign in to comment.