@tarojs/taro-rn 4.0.7 → 4.0.8-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/openUrl/index.js +1 -1
- package/dist/lib/openUrl/index.js.map +1 -1
- package/dist/lib/scanCode/index.js +5 -5
- package/dist/lib/scanCode/index.js.map +1 -1
- package/package.json +48 -48
- package/src/lib/openUrl/index.ts +14 -3
- package/src/lib/scanCode/index.tsx +8 -8
- package/types/index.d.ts +0 -1
- package/src/lib/openUrl/index.d.ts +0 -25
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/openUrl/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/openUrl/index.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAa1D,MAAM,UAAgB,OAAO,CAAI,IAAY;;QAC3C,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,IAAI,IAAI,EAAE,CAAA;QACnD,MAAM,GAAG,GAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,CAAA;QAEzC,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAA;QAC/C,IAAI,SAAS,EAAE,CAAC;YACd,MAAM,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;YAC1B,OAAO,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAA;QAC/C,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,MAAM,GAAG,8CAA8C,CAAA;YAC3D,OAAO,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAA;QAC1C,CAAC;IACH,CAAC;CAAA;AAED,eAAe;IACb,OAAO;CACR,CAAA"}
|
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { BarCodeScanner, requestPermissionsAsync } from 'expo-barcode-scanner';
|
|
11
|
-
import {
|
|
11
|
+
import { Camera } from 'expo-camera';
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import { BackHandler, Dimensions, Image, Platform, StatusBar, StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
14
14
|
import RootSiblings from 'react-native-root-siblings';
|
|
@@ -150,11 +150,11 @@ export function scanCode() {
|
|
|
150
150
|
complete === null || complete === void 0 ? void 0 : complete(res);
|
|
151
151
|
return Promise.reject(res);
|
|
152
152
|
}
|
|
153
|
-
const
|
|
153
|
+
const barCodeTypes = getBarCodeTypes(scanType);
|
|
154
154
|
return new Promise((resolve, reject) => {
|
|
155
155
|
scannerView = new RootSiblings((React.createElement(View, { style: [styles.container] },
|
|
156
156
|
React.createElement(StatusBar, { backgroundColor: "rgba(0, 0, 0, 0)", translucent: true, hidden: Platform.OS === 'ios' }),
|
|
157
|
-
React.createElement(
|
|
157
|
+
React.createElement(Camera, { onBarCodeScanned: ({ type, data }) => {
|
|
158
158
|
const res = {
|
|
159
159
|
charSet: 'UTF-8', // todo
|
|
160
160
|
path: '', // todo
|
|
@@ -167,8 +167,8 @@ export function scanCode() {
|
|
|
167
167
|
complete === null || complete === void 0 ? void 0 : complete(res);
|
|
168
168
|
hide(scannerView);
|
|
169
169
|
resolve(res);
|
|
170
|
-
},
|
|
171
|
-
|
|
170
|
+
}, barCodeScannerSettings: {
|
|
171
|
+
barCodeTypes,
|
|
172
172
|
}, style: { width, height } }),
|
|
173
173
|
React.createElement(TouchableOpacity, { accessibilityLabel: "Close", style: styles.closeIcon, onPress: () => hide(scannerView) }, safeViewWrapper(React.createElement(Image, { source: iconClose, style: styles.closeImg }))),
|
|
174
174
|
!onlyFromCamera && (React.createElement(TouchableOpacity, { style: styles.albumIcon, onPress: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/scanCode/index.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC9E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/scanCode/index.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAC9E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACtH,OAAO,YAAY,MAAM,4BAA4B,CAAA;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAA;AAErE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAClD,OAAO,SAAS,MAAM,kBAAkB,CAAA;AACxC,OAAO,OAAO,MAAM,gBAAgB,CAAA;AAEpC,MAAM,CAAC,IAAI,WAAW,CAAA;AAEtB,MAAM,OAAO,GAAG;IACd,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,SAAS;IACjB,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,UAAU;IACnB,WAAW,EAAE,SAAS,EAAE,QAAQ;IAChC,UAAU,EAAE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,GAAG,CAAC,CAAA;4BACd,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,GAAG,CAAC,CAAA;4BACf,IAAI,CAAC,WAAW,CAAC,CAAA;4BACjB,OAAO,CAAC,GAAG,CAAC,CAAA;wBACd,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE;4BACT,MAAM,GAAG,GAAG;gCACV,MAAM,EAAE,eAAe;gCACvB,GAAG;6BACJ,CAAA;4BACD,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAG,GAAG,CAAC,CAAA;4BACX,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,GAAG,CAAC,CAAA;4BACf,IAAI,CAAC,WAAW,CAAC,CAAA;4BACjB,MAAM,CAAC,GAAG,CAAC,CAAA;wBACb,CAAC,CAAC,CAAA;oBACJ,CAAC,IACE,eAAe,CAAC,oBAAC,KAAK,IAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,GAAG,CAAC,CAClD,CAAC,CACf,CAAC,CACT,CAAA;YACD,WAAW,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,UAAU,CAAC,CAAA;QAC/D,CAAC,CAAC,CAAA;IACJ,CAAC;CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro-rn",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8-alpha.1",
|
|
4
4
|
"description": "Taro RN framework",
|
|
5
5
|
"author": "O2Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,30 +24,11 @@
|
|
|
24
24
|
"node": ">= 18"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@bam.tech/react-native-image-resizer": "3.0.9",
|
|
28
|
-
"@react-native-async-storage/async-storage": "1.23.1",
|
|
29
|
-
"@react-native-camera-roll/camera-roll": "7.7.0",
|
|
30
|
-
"@react-native-clipboard/clipboard": "1.14.1",
|
|
31
|
-
"@react-native-community/geolocation": "3.2.1",
|
|
32
|
-
"@react-native-community/netinfo": "11.3.2",
|
|
33
27
|
"base64-js": "^1.5.1",
|
|
34
28
|
"deprecated-react-native-prop-types": "^5.0.0",
|
|
35
|
-
"expo-av": "~13.10.0",
|
|
36
|
-
"expo-barcode-scanner": "~13.0.1",
|
|
37
|
-
"expo-brightness": "~12.0.1",
|
|
38
|
-
"expo-camera": "~15.0.8",
|
|
39
|
-
"expo-file-system": "~17.0.1",
|
|
40
|
-
"expo-image-picker": "~15.0.4",
|
|
41
|
-
"expo-keep-awake": "~13.0.1",
|
|
42
|
-
"expo-location": "~17.0.1",
|
|
43
|
-
"expo-sensors": "~13.0.6",
|
|
44
29
|
"prop-types": "^15.8.1",
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"react-native-root-siblings": "5.0.1",
|
|
48
|
-
"react-native-safe-area-context": "4.10.1",
|
|
49
|
-
"@tarojs/runtime-rn": "4.0.7",
|
|
50
|
-
"@tarojs/taro": "4.0.7"
|
|
30
|
+
"@tarojs/runtime-rn": "4.0.8-alpha.1",
|
|
31
|
+
"@tarojs/taro": "4.0.8-alpha.1"
|
|
51
32
|
},
|
|
52
33
|
"devDependencies": {
|
|
53
34
|
"@babel/core": "^7.24.4",
|
|
@@ -57,43 +38,62 @@
|
|
|
57
38
|
"@react-native/babel-preset": "^0.73.18",
|
|
58
39
|
"@testing-library/jest-native": "^5.4.2",
|
|
59
40
|
"@testing-library/react-native": "^12.4.1",
|
|
41
|
+
"@bam.tech/react-native-image-resizer": "^3.0.10",
|
|
42
|
+
"@react-native-async-storage/async-storage": "1.21.0",
|
|
43
|
+
"@react-native-camera-roll/camera-roll": "^7.8.3",
|
|
44
|
+
"@react-native-clipboard/clipboard": "^1.14.3",
|
|
45
|
+
"@react-native-community/geolocation": "^3.4.0",
|
|
46
|
+
"@react-native-community/netinfo": "11.1.0",
|
|
60
47
|
"cpy-cli": "^5.0.0",
|
|
61
48
|
"dpdm": "^3.14.0",
|
|
62
|
-
"expo": "~
|
|
63
|
-
"
|
|
49
|
+
"expo": "~50.0.0",
|
|
50
|
+
"expo-av": "~13.10.6",
|
|
51
|
+
"expo-barcode-scanner": "~12.9.3",
|
|
52
|
+
"expo-brightness": "~11.8.0",
|
|
53
|
+
"expo-camera": "~14.1.3",
|
|
54
|
+
"expo-file-system": "~16.0.9",
|
|
55
|
+
"expo-image-picker": "~14.7.1",
|
|
56
|
+
"expo-keep-awake": "~12.8.2",
|
|
57
|
+
"expo-location": "~16.5.5",
|
|
58
|
+
"expo-sensors": "~12.9.1",
|
|
59
|
+
"jest-expo": "~50.0.3",
|
|
64
60
|
"mock-socket": "^7.1.0",
|
|
65
61
|
"react": "^18.2.0",
|
|
66
|
-
"react-native": "^0.
|
|
62
|
+
"react-native": "^0.73.1",
|
|
63
|
+
"react-native-device-info": "^14.0.0",
|
|
64
|
+
"react-native-image-zoom-viewer": "^3.0.1",
|
|
65
|
+
"react-native-root-siblings": "^5.0.1",
|
|
66
|
+
"react-native-safe-area-context": "4.8.2"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
|
-
"@bam.tech/react-native-image-resizer": "
|
|
70
|
-
"@react-native-async-storage/async-storage": "
|
|
71
|
-
"@react-native-camera-roll/camera-roll": "
|
|
72
|
-
"@react-native-clipboard/clipboard": "
|
|
73
|
-
"@react-native-community/geolocation": "
|
|
74
|
-
"@react-native-community/netinfo": "
|
|
75
|
-
"expo": "
|
|
76
|
-
"expo-av": "
|
|
77
|
-
"expo-barcode-scanner": "
|
|
78
|
-
"expo-brightness": "
|
|
79
|
-
"expo-camera": "
|
|
80
|
-
"expo-file-system": "
|
|
81
|
-
"expo-image-picker": "
|
|
82
|
-
"expo-keep-awake": "
|
|
83
|
-
"expo-location": "
|
|
84
|
-
"expo-sensors": "
|
|
85
|
-
"react": "
|
|
86
|
-
"react-native": "
|
|
87
|
-
"react-native-device-info": "
|
|
88
|
-
"react-native-image-zoom-viewer": "
|
|
89
|
-
"react-native-root-siblings": "
|
|
90
|
-
"react-native-safe-area-context": "
|
|
69
|
+
"@bam.tech/react-native-image-resizer": "^3.0.10",
|
|
70
|
+
"@react-native-async-storage/async-storage": "1.21.0",
|
|
71
|
+
"@react-native-camera-roll/camera-roll": "^7.8.3",
|
|
72
|
+
"@react-native-clipboard/clipboard": "^1.14.3",
|
|
73
|
+
"@react-native-community/geolocation": "^3.4.0",
|
|
74
|
+
"@react-native-community/netinfo": "11.1.0",
|
|
75
|
+
"expo": "~50.0.0",
|
|
76
|
+
"expo-av": "~13.10.6",
|
|
77
|
+
"expo-barcode-scanner": "~12.9.3",
|
|
78
|
+
"expo-brightness": "~11.8.0",
|
|
79
|
+
"expo-camera": "~14.1.3",
|
|
80
|
+
"expo-file-system": "~16.0.9",
|
|
81
|
+
"expo-image-picker": "~14.7.1",
|
|
82
|
+
"expo-keep-awake": "~12.8.2",
|
|
83
|
+
"expo-location": "~16.5.5",
|
|
84
|
+
"expo-sensors": "~12.9.1",
|
|
85
|
+
"react": "^18.2.0",
|
|
86
|
+
"react-native": "^0.73.1",
|
|
87
|
+
"react-native-device-info": "^14.0.0",
|
|
88
|
+
"react-native-image-zoom-viewer": "^3.0.1",
|
|
89
|
+
"react-native-root-siblings": "^5.0.1",
|
|
90
|
+
"react-native-safe-area-context": "4.8.2"
|
|
91
91
|
},
|
|
92
92
|
"scripts": {
|
|
93
93
|
"prod": "pnpm run build",
|
|
94
94
|
"assets": "cpy 'src/**/*.png' '!src/__tests__/*' dist",
|
|
95
95
|
"prebuild": "pnpm run clean",
|
|
96
|
-
"clean": "rimraf
|
|
96
|
+
"clean": "rimraf ./dist apiList.js libList.js",
|
|
97
97
|
"build": "tsc && pnpm run assets && pnpm run script",
|
|
98
98
|
"dev": "pnpm run assets && tsc --watch",
|
|
99
99
|
"lint": "eslint src script __tests__ --ext .js,.jsx.ts,.tsx",
|
package/src/lib/openUrl/index.ts
CHANGED
|
@@ -2,8 +2,19 @@ import { Linking } from 'react-native'
|
|
|
2
2
|
|
|
3
3
|
import { errorHandler, successHandler } from '../../utils'
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 跳转链接 */
|
|
7
|
+
url: string
|
|
8
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
9
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用失败的回调函数 */
|
|
11
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
+
/** 接口调用成功的回调函数 */
|
|
13
|
+
success?: (res: TaroGeneral.CallbackResult) => void
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export async function openUrl<T>(opts: Option): Promise<T> {
|
|
17
|
+
const { url, success, fail, complete } = opts || {}
|
|
7
18
|
const res: any = { errMsg: 'openUrl:ok' }
|
|
8
19
|
|
|
9
20
|
const isSupport = await Linking.canOpenURL(url)
|
|
@@ -17,5 +28,5 @@ export async function openUrl <T>(opts: Taro.OpenUrl.Option): Promise<T> {
|
|
|
17
28
|
}
|
|
18
29
|
|
|
19
30
|
export default {
|
|
20
|
-
openUrl
|
|
31
|
+
openUrl,
|
|
21
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BarCodeScanner, requestPermissionsAsync } from 'expo-barcode-scanner'
|
|
2
|
-
import {
|
|
2
|
+
import { Camera } from 'expo-camera'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { BackHandler, Dimensions, Image, Platform, StatusBar, StyleSheet, TouchableOpacity, View } from 'react-native'
|
|
5
5
|
import RootSiblings from 'react-native-root-siblings'
|
|
@@ -48,8 +48,8 @@ function findKey (value:string, data, compare = (a, b) => a === b):string {
|
|
|
48
48
|
|
|
49
49
|
const { width, height } = Dimensions.get('screen')
|
|
50
50
|
|
|
51
|
-
function getBarCodeTypes(types:string[]):
|
|
52
|
-
const result:
|
|
51
|
+
function getBarCodeTypes(types:string[]): string[] {
|
|
52
|
+
const result: string[] = []
|
|
53
53
|
|
|
54
54
|
for (const t of types) {
|
|
55
55
|
result.push(...typeMap[t].map(type => {
|
|
@@ -158,13 +158,13 @@ export async function scanCode(option: Taro.scanCode.Option = {}): Promise<Taro.
|
|
|
158
158
|
complete?.(res)
|
|
159
159
|
return Promise.reject(res)
|
|
160
160
|
}
|
|
161
|
-
const
|
|
161
|
+
const barCodeTypes = getBarCodeTypes(scanType)
|
|
162
162
|
return new Promise((resolve, reject) => {
|
|
163
163
|
scannerView = new RootSiblings(
|
|
164
164
|
(<View style={[styles.container]}>
|
|
165
165
|
<StatusBar backgroundColor="rgba(0, 0, 0, 0)" translucent hidden={Platform.OS === 'ios'} />
|
|
166
|
-
<
|
|
167
|
-
|
|
166
|
+
<Camera
|
|
167
|
+
onBarCodeScanned={({ type, data }: {type: string, data: string}) => {
|
|
168
168
|
const res = {
|
|
169
169
|
charSet: 'UTF-8', // todo
|
|
170
170
|
path: '', // todo
|
|
@@ -178,8 +178,8 @@ export async function scanCode(option: Taro.scanCode.Option = {}): Promise<Taro.
|
|
|
178
178
|
hide(scannerView)
|
|
179
179
|
resolve(res)
|
|
180
180
|
}}
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
barCodeScannerSettings={{
|
|
182
|
+
barCodeTypes,
|
|
183
183
|
}}
|
|
184
184
|
style={{ width, height }}
|
|
185
185
|
/>
|
package/types/index.d.ts
CHANGED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
declare namespace Taro {
|
|
2
|
-
namespace OpenUrl {
|
|
3
|
-
interface Option {
|
|
4
|
-
/** 跳转链接 */
|
|
5
|
-
url: string
|
|
6
|
-
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
-
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
-
/** 接口调用失败的回调函数 */
|
|
9
|
-
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
-
/** 接口调用成功的回调函数 */
|
|
11
|
-
success?: (res: TaroGeneral.CallbackResult) => void
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 由于 Expo 不支持原生的 SDK,所以无法通过集成原生的 SDK 的方式使用微信/支付宝支付。
|
|
17
|
-
* 所以 RN 端提供了 `Taro.openUrl({url:''})`的 API 打开手机浏览器,然后走 [手机网站支付](https://docs.open.alipay.com/203/105288/) 的流程。
|
|
18
|
-
* @param {Object} opts
|
|
19
|
-
* @param {string} [opts.url] 跳转链接
|
|
20
|
-
* @param {function} [opts.success] 接口调用成功的回调函数
|
|
21
|
-
* @param {function} [opts.fail] 接口调用失败的回调函数
|
|
22
|
-
* @param {function} [opts.complete] 接口调用结束的回调函数(调用成功、失败都会执行)
|
|
23
|
-
*/
|
|
24
|
-
function openUrl<T>(opts: Taro.OpenUrl.Option): Promise<T>
|
|
25
|
-
}
|