@tarojs/taro-rn 4.0.0-beta.78 → 4.0.0-beta.79
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/LICENSE +8 -1
- package/apiList.js +31 -31
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/lib/Mask.js +2 -2
- package/dist/lib/Mask.js.map +1 -1
- package/dist/lib/Popup.js +3 -3
- package/dist/lib/Popup.js.map +1 -1
- package/dist/lib/StyleSheet.js +1 -1
- package/dist/lib/StyleSheet.js.map +1 -1
- package/dist/lib/accelerometer.js +1 -1
- package/dist/lib/accelerometer.js.map +1 -1
- package/dist/lib/chooseMedia/index.js.map +1 -1
- package/dist/lib/clearStorage/index.js +2 -2
- package/dist/lib/clearStorage/index.js.map +1 -1
- package/dist/lib/compressImage/index.js +1 -1
- package/dist/lib/compressImage/index.js.map +1 -1
- package/dist/lib/connectSocket/index.js.map +1 -1
- package/dist/lib/connectSocket/socketTask.js +1 -1
- package/dist/lib/connectSocket/socketTask.js.map +1 -1
- package/dist/lib/createCameraContext/index.js +3 -3
- package/dist/lib/createCameraContext/index.js.map +1 -1
- package/dist/lib/createInnerAudioContext/index.js +2 -2
- package/dist/lib/createInnerAudioContext/index.js.map +1 -1
- package/dist/lib/createVideoContext/index.js +7 -7
- package/dist/lib/createVideoContext/index.js.map +1 -1
- package/dist/lib/deviceMotion.js +2 -2
- package/dist/lib/deviceMotion.js.map +1 -1
- package/dist/lib/file.js +4 -4
- package/dist/lib/file.js.map +1 -1
- package/dist/lib/getAppBaseInfo/index.js +2 -2
- package/dist/lib/getAppBaseInfo/index.js.map +1 -1
- package/dist/lib/getClipboardData/index.js.map +1 -1
- package/dist/lib/getImageInfo/index.js +2 -2
- package/dist/lib/getImageInfo/index.js.map +1 -1
- package/dist/lib/getLocation/index.js +2 -2
- package/dist/lib/getLocation/index.js.map +1 -1
- package/dist/lib/getRecorderManager/index.js +5 -5
- package/dist/lib/getRecorderManager/index.js.map +1 -1
- package/dist/lib/getStorage/index.js.map +1 -1
- package/dist/lib/getStorageInfo/index.js +2 -2
- package/dist/lib/getStorageInfo/index.js.map +1 -1
- package/dist/lib/getSystemInfo/index.js +1 -1
- package/dist/lib/getSystemInfo/index.js.map +1 -1
- package/dist/lib/getSystemInfoSync/index.js +2 -2
- package/dist/lib/getSystemInfoSync/index.js.map +1 -1
- package/dist/lib/gyroscope.js +1 -1
- package/dist/lib/gyroscope.js.map +1 -1
- package/dist/lib/keyboard.js +3 -3
- package/dist/lib/keyboard.js.map +1 -1
- package/dist/lib/location.js.map +1 -1
- package/dist/lib/makePhoneCall/index.js +1 -1
- package/dist/lib/makePhoneCall/index.js.map +1 -1
- package/dist/lib/media.js +13 -15
- package/dist/lib/media.js.map +1 -1
- package/dist/lib/network.js +1 -1
- package/dist/lib/network.js.map +1 -1
- package/dist/lib/offWindowResize/index.js.map +1 -1
- package/dist/lib/onWindowResize/index.js +1 -1
- package/dist/lib/onWindowResize/index.js.map +1 -1
- package/dist/lib/openUrl/index.js +1 -1
- package/dist/lib/openUrl/index.js.map +1 -1
- package/dist/lib/permission.js +5 -6
- package/dist/lib/permission.js.map +1 -1
- package/dist/lib/previewImage/index.js +3 -3
- package/dist/lib/previewImage/index.js.map +1 -1
- package/dist/lib/request/index.js +1 -1
- package/dist/lib/request/index.js.map +1 -1
- package/dist/lib/scanCode/index.js +22 -22
- package/dist/lib/scanCode/index.js.map +1 -1
- package/dist/lib/screen.js +2 -2
- package/dist/lib/screen.js.map +1 -1
- package/dist/lib/setClipboardData/index.js +2 -2
- package/dist/lib/setClipboardData/index.js.map +1 -1
- package/dist/lib/setKeepScreenOn/index.js +1 -1
- package/dist/lib/setKeepScreenOn/index.js.map +1 -1
- package/dist/lib/setStorage/index.js.map +1 -1
- package/dist/lib/showActionSheet/ActionSheet.js +3 -3
- package/dist/lib/showActionSheet/ActionSheet.js.map +1 -1
- package/dist/lib/showActionSheet/index.js.map +1 -1
- package/dist/lib/showModal/Dialog.js +3 -3
- package/dist/lib/showModal/Dialog.js.map +1 -1
- package/dist/lib/showModal/index.js.map +1 -1
- package/dist/lib/showModal/toast.js +6 -6
- package/dist/lib/showModal/toast.js.map +1 -1
- package/dist/lib/unsupportedApi.js +4 -2
- package/dist/lib/unsupportedApi.js.map +1 -1
- package/dist/lib/variable.js +1 -1
- package/dist/lib/variable.js.map +1 -1
- package/dist/lib/vibrate.js +1 -1
- package/dist/lib/vibrate.js.map +1 -1
- package/dist/lib/window.js.map +1 -1
- package/dist/setup.js +58 -0
- package/dist/setup.js.map +1 -0
- package/dist/utils/callbackManager.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +60 -65
- package/src/__tests__/__mock__/mockRNCCameraRoll.js +7 -0
- package/src/__tests__/__mock__/mockRNCGeolocation.js +13 -0
- package/src/__tests__/__snapshots__/scanCode.test.tsx.snap +154 -0
- package/src/__tests__/clipboard.test.ts +88 -0
- package/src/__tests__/deviceMotion.test.ts +37 -0
- package/src/__tests__/geolocation.test.ts +60 -0
- package/src/__tests__/interactive.test.tsx +101 -0
- package/src/__tests__/keyboard.test.ts +46 -0
- package/src/__tests__/media.test.ts +104 -0
- package/src/__tests__/network.test.ts +57 -0
- package/src/__tests__/others.test.ts +25 -0
- package/src/__tests__/phone.test.ts +31 -0
- package/src/__tests__/request.test.ts +146 -0
- package/src/__tests__/scanCode.test.tsx +14 -0
- package/src/__tests__/storage.test.ts +202 -0
- package/src/__tests__/system.test.ts +69 -0
- package/src/__tests__/vibrate.test.ts +27 -0
- package/src/__tests__/websocket.test.ts +170 -0
- package/src/api/index.ts +31 -31
- package/src/lib/ENV_TYPE/index.ts +1 -1
- package/src/lib/Mask.tsx +2 -2
- package/src/lib/Popup.tsx +6 -8
- package/src/lib/StyleSheet.ts +1 -1
- package/src/lib/accelerometer.ts +1 -2
- package/src/lib/arrayBufferToBase64/index.ts +1 -1
- package/src/lib/base64ToArrayBuffer/index.ts +1 -1
- package/src/lib/chooseMedia/index.ts +1 -1
- package/src/lib/clearStorage/index.ts +0 -1
- package/src/lib/clearStorageSync/index.ts +1 -1
- package/src/lib/compressImage/index.ts +0 -1
- package/src/lib/connectSocket/socketTask.ts +9 -7
- package/src/lib/createCameraContext/index.ts +4 -6
- package/src/lib/createInnerAudioContext/index.ts +0 -1
- package/src/lib/createSelectorQuery/index.ts +1 -1
- package/src/lib/deviceMotion.ts +3 -4
- package/src/lib/file.ts +8 -9
- package/src/lib/getClipboardData/index.ts +0 -1
- package/src/lib/getEnv/index.ts +1 -1
- package/src/lib/getFileSystemManager/index.ts +1 -1
- package/src/lib/getLocation/index.ts +3 -4
- package/src/lib/getRecorderManager/index.ts +1 -1
- package/src/lib/getStorage/index.ts +0 -1
- package/src/lib/getStorageInfo/index.ts +0 -1
- package/src/lib/getStorageInfoSync/index.ts +1 -1
- package/src/lib/getStorageSync/index.ts +1 -1
- package/src/lib/getSystemInfo/index.ts +2 -2
- package/src/lib/getSystemInfoSync/index.ts +3 -3
- package/src/lib/gyroscope.ts +46 -47
- package/src/lib/keyboard.ts +4 -5
- package/src/lib/location.ts +5 -6
- package/src/lib/makePhoneCall/index.ts +1 -2
- package/src/lib/media.ts +18 -21
- package/src/lib/network.ts +5 -5
- package/src/lib/offLocationChange/index.ts +1 -1
- package/src/lib/offUserCaptureScreen/index.ts +1 -1
- package/src/lib/onLocationChange/index.ts +1 -1
- package/src/lib/onUserCaptureScreen/index.ts +1 -1
- package/src/lib/onWindowResize/index.ts +2 -2
- package/src/lib/openUrl/index.d.ts +22 -23
- package/src/lib/openUrl/index.ts +1 -2
- package/src/lib/permission.ts +25 -33
- package/src/lib/previewImage/index.tsx +3 -4
- package/src/lib/removeStorageSync/index.ts +1 -1
- package/src/lib/request/index.ts +2 -2
- package/src/lib/scanCode/index.tsx +15 -17
- package/src/lib/screen.ts +0 -1
- package/src/lib/setClipboardData/index.ts +2 -3
- package/src/lib/setKeepScreenOn/index.ts +1 -2
- package/src/lib/setStorage/index.ts +0 -1
- package/src/lib/setStorageSync/index.ts +1 -1
- package/src/lib/showActionSheet/ActionSheet.tsx +6 -7
- package/src/lib/showActionSheet/index.tsx +0 -1
- package/src/lib/showModal/Dialog.tsx +6 -7
- package/src/lib/showModal/index.tsx +0 -1
- package/src/lib/showModal/toast.tsx +11 -12
- package/src/lib/startGyroscope/index.ts +1 -1
- package/src/lib/startLocationUpdate/index.ts +1 -1
- package/src/lib/unsupportedApi.ts +5 -3
- package/src/lib/vibrate.ts +10 -11
- package/src/lib/window.ts +2 -3
- package/src/setup.ts +64 -0
- package/{types → src/types}/vue/index.d.ts +3 -2
- package/src/utils/callbackManager.ts +5 -5
- package/src/utils/index.ts +4 -4
- /package/{types → src/types}/definition.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
export { setStorageSync } from '../unsupportedApi'
|
|
1
|
+
export { setStorageSync } from '../unsupportedApi'
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { ViewPropTypes } from 'deprecated-react-native-prop-types'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
1
|
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
4
3
|
import {
|
|
5
|
-
|
|
6
|
-
StyleSheet,
|
|
4
|
+
View,
|
|
7
5
|
Text,
|
|
8
6
|
TouchableHighlight,
|
|
9
|
-
|
|
7
|
+
StyleSheet,
|
|
8
|
+
Platform
|
|
10
9
|
} from 'react-native'
|
|
11
|
-
import {
|
|
12
|
-
|
|
10
|
+
import { ViewPropTypes } from 'deprecated-react-native-prop-types'
|
|
11
|
+
import { initialWindowMetrics } from 'react-native-safe-area-context';
|
|
13
12
|
import { Popup } from '../Popup'
|
|
14
13
|
import V from '../variable'
|
|
15
14
|
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import { TextPropTypes, ViewPropTypes } from 'deprecated-react-native-prop-types'
|
|
2
|
-
import PropTypes from 'prop-types'
|
|
3
1
|
import React from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
4
3
|
import {
|
|
5
|
-
|
|
6
|
-
Platform,
|
|
7
|
-
StyleSheet,
|
|
4
|
+
View,
|
|
8
5
|
Text,
|
|
9
6
|
TouchableHighlight,
|
|
10
|
-
|
|
7
|
+
Dimensions,
|
|
8
|
+
StyleSheet,
|
|
9
|
+
Platform
|
|
11
10
|
} from 'react-native'
|
|
12
|
-
|
|
11
|
+
import { ViewPropTypes, TextPropTypes } from 'deprecated-react-native-prop-types'
|
|
13
12
|
import { Mask } from '../Mask'
|
|
14
13
|
import { create } from '../StyleSheet'
|
|
15
14
|
import V from '../variable'
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import PropTypes from 'prop-types'
|
|
2
1
|
import React from 'react'
|
|
3
|
-
import
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
import { View, Text, Image, StyleSheet, ActivityIndicator } from 'react-native'
|
|
4
4
|
import RootSiblings from 'react-native-root-siblings'
|
|
5
|
-
|
|
6
|
-
import { errorHandler, shouldBeObject, successHandler } from '../../utils'
|
|
7
|
-
import errorPng from './error.png'
|
|
8
5
|
import successPng from './success.png'
|
|
6
|
+
import errorPng from './error.png'
|
|
7
|
+
import { errorHandler, shouldBeObject, successHandler } from '../../utils'
|
|
9
8
|
|
|
10
9
|
const globalAny: any = global
|
|
11
10
|
|
|
@@ -160,7 +159,7 @@ function showToast (options: Taro.showToast.Option): Promise<TaroGeneral.Callbac
|
|
|
160
159
|
try {
|
|
161
160
|
// setTimeout fires incorrectly when using chrome debug #4470
|
|
162
161
|
// https://github.com/facebook/react-native/issues/4470
|
|
163
|
-
globalAny.wxToastRootSiblings && globalAny.wxToastRootSiblings.destroy()
|
|
162
|
+
globalAny.wxToastRootSiblings && globalAny.wxToastRootSiblings.destroy();
|
|
164
163
|
|
|
165
164
|
globalAny.wxToastRootSiblings = new RootSiblings(ToastView)
|
|
166
165
|
setTimeout(() => {
|
|
@@ -178,7 +177,7 @@ function showToast (options: Taro.showToast.Option): Promise<TaroGeneral.Callbac
|
|
|
178
177
|
}
|
|
179
178
|
}
|
|
180
179
|
|
|
181
|
-
function showLoading (options: Taro.showLoading.Option = { title:
|
|
180
|
+
function showLoading (options: Taro.showLoading.Option = { title: "加载中" }): Promise<TaroGeneral.CallbackResult> {
|
|
182
181
|
const isObject = shouldBeObject(options)
|
|
183
182
|
if (!isObject.res) {
|
|
184
183
|
const res = { errMsg: `showLoading${isObject.msg}` }
|
|
@@ -203,7 +202,7 @@ function hideToast (opts: Taro.hideToast.Option = {}): void {
|
|
|
203
202
|
const { success, fail, complete } = opts
|
|
204
203
|
|
|
205
204
|
try {
|
|
206
|
-
globalAny.wxToastRootSiblings && globalAny.wxToastRootSiblings.destroy()
|
|
205
|
+
globalAny.wxToastRootSiblings && globalAny.wxToastRootSiblings.destroy();
|
|
207
206
|
globalAny.wxToastRootSiblings = undefined
|
|
208
207
|
const res = { errMsg: 'showToast:ok' }
|
|
209
208
|
success?.(res)
|
|
@@ -219,7 +218,7 @@ function hideLoading (opts: Taro.hideLoading.Option = {}): void {
|
|
|
219
218
|
const { success, fail, complete } = opts
|
|
220
219
|
|
|
221
220
|
try {
|
|
222
|
-
globalAny.wxToastRootSiblings && globalAny.wxToastRootSiblings.destroy()
|
|
221
|
+
globalAny.wxToastRootSiblings && globalAny.wxToastRootSiblings.destroy();
|
|
223
222
|
globalAny.wxToastRootSiblings = undefined
|
|
224
223
|
const res = { errMsg: 'showLoading:ok' }
|
|
225
224
|
success?.(res)
|
|
@@ -232,8 +231,8 @@ function hideLoading (opts: Taro.hideLoading.Option = {}): void {
|
|
|
232
231
|
}
|
|
233
232
|
|
|
234
233
|
export {
|
|
235
|
-
|
|
236
|
-
hideToast,
|
|
234
|
+
showToast,
|
|
237
235
|
showLoading,
|
|
238
|
-
|
|
236
|
+
hideToast,
|
|
237
|
+
hideLoading
|
|
239
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { startGyroscope } from '../gyroscope'
|
|
1
|
+
export { startGyroscope } from '../gyroscope'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { startLocationUpdate } from '../location'
|
|
1
|
+
export { startLocationUpdate } from '../location'
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
function temporarilyNotSupport(apiName:
|
|
1
|
+
function temporarilyNotSupport(apiName: String, recommended?: String, isSync = true) {
|
|
2
2
|
return () => {
|
|
3
3
|
let errMsg = `RN 端暂不支持 API ${apiName}`
|
|
4
|
-
if (recommended) {
|
|
4
|
+
if (!!recommended) {
|
|
5
5
|
errMsg += `, 请使用 ${recommended}`
|
|
6
6
|
}
|
|
7
7
|
console.error(errMsg)
|
|
8
8
|
if (!isSync) {
|
|
9
|
-
return Promise.reject(
|
|
9
|
+
return Promise.reject({
|
|
10
|
+
errMsg
|
|
11
|
+
})
|
|
10
12
|
} else {
|
|
11
13
|
return new Error(errMsg)
|
|
12
14
|
}
|
package/src/lib/vibrate.ts
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import { Vibration } from 'react-native'
|
|
2
|
-
|
|
3
2
|
import { errorHandler, successHandler } from '../utils'
|
|
4
3
|
|
|
5
4
|
function vibrate (DURATION, API, OPTS): Promise<TaroGeneral.CallbackResult> {
|
|
6
5
|
const res = { errMsg: `${API}:ok` }
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
const { success, fail, complete } = OPTS
|
|
7
|
+
try {
|
|
8
|
+
Vibration.vibrate(DURATION)
|
|
9
|
+
return successHandler(success, complete)(res)
|
|
10
|
+
} catch (err) {
|
|
11
|
+
res.errMsg = err.message
|
|
12
|
+
return errorHandler(fail, complete)(res)
|
|
13
|
+
}
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
function vibrateShort (opts: Taro.vibrateShort.Option = {}): Promise<TaroGeneral.CallbackResult> {
|
|
@@ -23,6 +22,6 @@ function vibrateLong (opts: Taro.vibrateLong.Option = {}): Promise<TaroGeneral.C
|
|
|
23
22
|
}
|
|
24
23
|
|
|
25
24
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
vibrateShort,
|
|
26
|
+
vibrateLong
|
|
28
27
|
}
|
package/src/lib/window.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Dimensions, EmitterSubscription
|
|
2
|
-
|
|
1
|
+
import { ScaledSize, Dimensions, EmitterSubscription } from 'react-native'
|
|
3
2
|
import { createCallbackManager } from '../utils'
|
|
4
3
|
|
|
5
4
|
let listener: EmitterSubscription
|
|
@@ -19,4 +18,4 @@ export const addListener = () => {
|
|
|
19
18
|
|
|
20
19
|
export const removeListener = () => {
|
|
21
20
|
listener?.remove()
|
|
22
|
-
}
|
|
21
|
+
}
|
package/src/setup.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import '@testing-library/jest-native/extend-expect'
|
|
2
|
+
import { NetInfoStateType } from '@react-native-community/netinfo'
|
|
3
|
+
import mockRNCNetInfo from '@react-native-community/netinfo/jest/netinfo-mock'
|
|
4
|
+
import mockRNCAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock'
|
|
5
|
+
import mockRNCDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock'
|
|
6
|
+
import mockRNCClipboard from '@react-native-clipboard/clipboard/jest/clipboard-mock'
|
|
7
|
+
import mockRNCGeolocation from './__tests__/__mock__/mockRNCGeolocation'
|
|
8
|
+
import mockRNCameraRoll from './__tests__/__mock__/mockRNCCameraRoll'
|
|
9
|
+
jest.mock('react-native/Libraries/EventEmitter/NativeEventEmitter')
|
|
10
|
+
jest.doMock('@react-native-community/netinfo', () => ({ ...mockRNCNetInfo, NetInfoStateType }))
|
|
11
|
+
jest.doMock('@react-native-async-storage/async-storage', () => mockRNCAsyncStorage)
|
|
12
|
+
jest.doMock('@react-native-community/geolocation', () => mockRNCGeolocation)
|
|
13
|
+
jest.doMock('@react-native-clipboard/clipboard', () => mockRNCClipboard)
|
|
14
|
+
jest.doMock('react-native-device-info', () => mockRNCDeviceInfo)
|
|
15
|
+
jest.mock('@react-native-camera-roll/camera-roll', () => mockRNCameraRoll)
|
|
16
|
+
|
|
17
|
+
jest.mock('react-native', () => {
|
|
18
|
+
const ReactNative = jest.requireActual('react-native') as any
|
|
19
|
+
ReactNative.Image.getSize = jest.fn((_uri, success: any) => {
|
|
20
|
+
setTimeout(() => success && success(320, 240))
|
|
21
|
+
return Promise.resolve([320, 240])
|
|
22
|
+
})
|
|
23
|
+
return ReactNative
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
jest.doMock('expo-modules-core', () => {
|
|
27
|
+
const unimodules = jest.requireActual('expo-modules-core') as any
|
|
28
|
+
const { NativeModulesProxy } = unimodules
|
|
29
|
+
|
|
30
|
+
NativeModulesProxy.ExpoLocation = {
|
|
31
|
+
getCurrentPositionAsync: jest.fn(() => Promise.resolve({
|
|
32
|
+
coords: {
|
|
33
|
+
latitude: 0,
|
|
34
|
+
longitude: 0,
|
|
35
|
+
speed: 0,
|
|
36
|
+
accuracy: 0,
|
|
37
|
+
altitude: 0
|
|
38
|
+
}
|
|
39
|
+
}))
|
|
40
|
+
}
|
|
41
|
+
return unimodules
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
const grantedPromise = jest.fn(() => Promise.resolve({
|
|
45
|
+
granted: true
|
|
46
|
+
}))
|
|
47
|
+
|
|
48
|
+
jest.doMock('expo-image-picker', () => {
|
|
49
|
+
const expoImagePicker = jest.requireActual('expo-image-picker') as any
|
|
50
|
+
expoImagePicker.requestMediaLibraryPermissionsAsync = grantedPromise
|
|
51
|
+
return expoImagePicker
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
jest.doMock('expo-location', () => {
|
|
55
|
+
const expoLocation = jest.requireActual('expo-location') as any
|
|
56
|
+
expoLocation.requestForegroundPermissionsAsync = grantedPromise
|
|
57
|
+
return expoLocation
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
jest.doMock('expo-barcode-scanner', () => {
|
|
61
|
+
const expoBarcodeSacnner = jest.requireActual('expo-barcode-scanner') as any
|
|
62
|
+
expoBarcodeSacnner.requestPermissionsAsync = grantedPromise
|
|
63
|
+
return expoBarcodeSacnner
|
|
64
|
+
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
interface CallbackManager {
|
|
2
|
-
add: (opt: any) => void
|
|
3
|
-
remove: (opt: any) => void
|
|
4
|
-
clear: () => void
|
|
5
|
-
count: () => number
|
|
6
|
-
trigger: (...args: any[]) => void
|
|
2
|
+
add: (opt: any) => void;
|
|
3
|
+
remove: (opt: any) => void;
|
|
4
|
+
clear: () => void;
|
|
5
|
+
count: () => number;
|
|
6
|
+
trigger: (...args: any[]) => void;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function createCallbackManager(): CallbackManager {
|
package/src/utils/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
interface ShouldBeObjectResult {
|
|
2
|
-
res: boolean
|
|
3
|
-
msg?: string
|
|
2
|
+
res: boolean;
|
|
3
|
+
msg?: string;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
6
|
interface GetParameterErrorOption {
|
|
7
|
-
correct: string
|
|
8
|
-
wrong: any
|
|
7
|
+
correct: string;
|
|
8
|
+
wrong: any;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function upperCaseFirstLetter (string: string): string {
|
|
File without changes
|