@mpxjs/api-proxy 2.9.67 → 2.9.69-beta.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/@types/index.d.ts +13 -0
- package/package.json +3 -4
- package/src/common/js/promisify.js +11 -3
- package/src/platform/api/action-sheet/rnActionSheet.jsx +69 -81
- package/src/platform/api/app/index.web.js +26 -11
- package/src/platform/api/create-intersection-observer/rnIntersectionObserver.js +14 -10
- package/src/platform/api/create-selector-query/rnNodesRef.js +1 -6
- package/src/platform/api/image/index.ali.js +4 -1
- package/src/platform/api/image/index.ios.js +45 -0
- package/src/platform/api/image/index.js +4 -1
- package/src/platform/api/image/index.web.js +46 -2
- package/src/platform/api/modal/rnModal.jsx +7 -8
- package/src/platform/api/next-tick/index.ios.js +7 -1
- package/src/platform/api/request/index.web.js +2 -3
- package/src/platform/api/route/index.ios.js +18 -8
- package/src/platform/api/set-navigation-bar/index.ali.js +6 -1
- package/src/platform/api/set-navigation-bar/index.ios.js +6 -3
- package/src/platform/api/set-navigation-bar/index.js +4 -1
- package/src/platform/api/set-navigation-bar/index.web.js +5 -2
- package/src/platform/api/setting/index.js +19 -0
- package/src/platform/api/storage/index.web.js +1 -1
- package/src/platform/api/storage/rnStorage.js +1 -1
- package/src/platform/api/system/index.ali.js +7 -1
- package/src/platform/api/system/index.ios.js +84 -1
- package/src/platform/api/system/index.js +7 -1
- package/src/platform/api/system/index.web.js +77 -16
- package/src/platform/api/system/rnSystem.js +48 -69
- package/src/platform/api/toast/rnToast.jsx +23 -16
- package/src/platform/index.js +4 -4
- package/LICENSE +0 -433
- package/src/platform/api/lifecycle/index.ali.js +0 -9
- package/src/platform/api/lifecycle/index.js +0 -7
- package/src/platform/api/lifecycle/index.web.js +0 -12
- package/src/platform/api/system/rnWindowInfo.js +0 -42
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { successHandle, failHandle, getFocusedNavigation } from '../../../common/js'
|
|
1
|
+
import { successHandle, failHandle, getFocusedNavigation, envError } from '../../../common/js'
|
|
2
2
|
import { nextTick } from '../next-tick'
|
|
3
3
|
function setNavigationBarTitle (options = {}) {
|
|
4
4
|
const { title = '', success, fail, complete } = options
|
|
@@ -7,7 +7,7 @@ function setNavigationBarTitle (options = {}) {
|
|
|
7
7
|
failHandle({ errMsg: 'setNavigationBarTitle:fail' }, fail, complete)
|
|
8
8
|
} else {
|
|
9
9
|
nextTick(() => {
|
|
10
|
-
navigation.setOptions({
|
|
10
|
+
navigation.setOptions({ title })
|
|
11
11
|
successHandle({ errMsg: 'setNavigationBarTitle:ok' }, success, complete)
|
|
12
12
|
})
|
|
13
13
|
}
|
|
@@ -31,7 +31,10 @@ function setNavigationBarColor (options = {}) {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
const hideHomeButton = envError('hideHomeButton')
|
|
35
|
+
|
|
34
36
|
export {
|
|
35
37
|
setNavigationBarTitle,
|
|
36
|
-
setNavigationBarColor
|
|
38
|
+
setNavigationBarColor,
|
|
39
|
+
hideHomeButton
|
|
37
40
|
}
|
|
@@ -4,7 +4,10 @@ const setNavigationBarTitle = ENV_OBJ.setNavigationBarTitle || envError('setNavi
|
|
|
4
4
|
|
|
5
5
|
const setNavigationBarColor = ENV_OBJ.setNavigationBarColor || envError('setNavigationBarColor')
|
|
6
6
|
|
|
7
|
+
const hideHomeButton = ENV_OBJ.hideHomeButton || envError('hideHomeButton')
|
|
8
|
+
|
|
7
9
|
export {
|
|
8
10
|
setNavigationBarTitle,
|
|
9
|
-
setNavigationBarColor
|
|
11
|
+
setNavigationBarColor,
|
|
12
|
+
hideHomeButton
|
|
10
13
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isBrowser, throwSSRWarning, successHandle } from '../../../common/js'
|
|
1
|
+
import { isBrowser, envError, throwSSRWarning, successHandle } from '../../../common/js'
|
|
2
2
|
|
|
3
3
|
function setNavigationBarTitle (options = {}) {
|
|
4
4
|
if (!isBrowser) {
|
|
@@ -26,7 +26,10 @@ function setNavigationBarColor (options = {}) {
|
|
|
26
26
|
successHandle({ errMsg: 'setNavigationBarColor:ok' }, success, complete)
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
const hideHomeButton = envError('hideHomeButton')
|
|
30
|
+
|
|
29
31
|
export {
|
|
30
32
|
setNavigationBarTitle,
|
|
31
|
-
setNavigationBarColor
|
|
33
|
+
setNavigationBarColor,
|
|
34
|
+
hideHomeButton
|
|
32
35
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ENV_OBJ, envError } from '../../../common/js'
|
|
2
|
+
|
|
3
|
+
const getSetting = ENV_OBJ.getSetting || envError('getSetting')
|
|
4
|
+
|
|
5
|
+
const openSetting = ENV_OBJ.openSetting || envError('openSetting')
|
|
6
|
+
|
|
7
|
+
const enableAlertBeforeUnload = ENV_OBJ.enableAlertBeforeUnload || envError('enableAlertBeforeUnload')
|
|
8
|
+
|
|
9
|
+
const disableAlertBeforeUnload = ENV_OBJ.disableAlertBeforeUnload || envError('disableAlertBeforeUnload')
|
|
10
|
+
|
|
11
|
+
const getMenuButtonBoundingClientRect = ENV_OBJ.getMenuButtonBoundingClientRect || envError('getMenuButtonBoundingClientRect')
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
getSetting,
|
|
15
|
+
openSetting,
|
|
16
|
+
enableAlertBeforeUnload,
|
|
17
|
+
disableAlertBeforeUnload,
|
|
18
|
+
getMenuButtonBoundingClientRect
|
|
19
|
+
}
|
|
@@ -40,9 +40,15 @@ const getDeviceInfo = function () {
|
|
|
40
40
|
|
|
41
41
|
const getWindowInfo = ENV_OBJ.getWindowInfo || envError('getWindowInfo')
|
|
42
42
|
|
|
43
|
+
const getLaunchOptionsSync = ENV_OBJ.getLaunchOptionsSync || envError('getLaunchOptionsSync')
|
|
44
|
+
|
|
45
|
+
const getEnterOptionsSync = ENV_OBJ.getEnterOptionsSync || envError('getEnterOptionsSync')
|
|
46
|
+
|
|
43
47
|
export {
|
|
44
48
|
getSystemInfo,
|
|
45
49
|
getSystemInfoSync,
|
|
46
50
|
getDeviceInfo,
|
|
47
|
-
getWindowInfo
|
|
51
|
+
getWindowInfo,
|
|
52
|
+
getLaunchOptionsSync,
|
|
53
|
+
getEnterOptionsSync
|
|
48
54
|
}
|
|
@@ -1 +1,84 @@
|
|
|
1
|
-
|
|
1
|
+
import DeviceInfo from 'react-native-device-info'
|
|
2
|
+
import { PixelRatio } from 'react-native'
|
|
3
|
+
import { successHandle, failHandle, defineUnsupportedProps } from '../../../common/js'
|
|
4
|
+
import { getWindowInfo, getLaunchOptionsSync, getEnterOptionsSync } from './rnSystem'
|
|
5
|
+
|
|
6
|
+
const getSystemInfoSync = function () {
|
|
7
|
+
const windowInfo = getWindowInfo()
|
|
8
|
+
const { screenWidth, screenHeight } = windowInfo
|
|
9
|
+
|
|
10
|
+
const result = {
|
|
11
|
+
brand: DeviceInfo.getBrand(),
|
|
12
|
+
model: DeviceInfo.getModel(),
|
|
13
|
+
system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`,
|
|
14
|
+
platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(),
|
|
15
|
+
deviceOrientation: screenWidth > screenHeight ? 'portrait' : 'landscape',
|
|
16
|
+
fontSizeSetting: PixelRatio.getFontScale()
|
|
17
|
+
}
|
|
18
|
+
Object.assign(result, windowInfo)
|
|
19
|
+
defineUnsupportedProps(result, [
|
|
20
|
+
'language',
|
|
21
|
+
'version',
|
|
22
|
+
'SDKVersion',
|
|
23
|
+
'benchmarkLevel',
|
|
24
|
+
'albumAuthorized',
|
|
25
|
+
'cameraAuthorized',
|
|
26
|
+
'locationAuthorized',
|
|
27
|
+
'microphoneAuthorized',
|
|
28
|
+
'notificationAuthorized',
|
|
29
|
+
'phoneCalendarAuthorized',
|
|
30
|
+
'host',
|
|
31
|
+
'enableDebug',
|
|
32
|
+
'notificationAlertAuthorized',
|
|
33
|
+
'notificationBadgeAuthorized',
|
|
34
|
+
'notificationSoundAuthorized',
|
|
35
|
+
'bluetoothEnabled',
|
|
36
|
+
'locationEnabled',
|
|
37
|
+
'wifiEnabled',
|
|
38
|
+
'locationReducedAccuracy',
|
|
39
|
+
'theme'
|
|
40
|
+
])
|
|
41
|
+
return result
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const getSystemInfo = function (options = {}) {
|
|
45
|
+
const { success, fail, complete } = options
|
|
46
|
+
try {
|
|
47
|
+
const systemInfo = getSystemInfoSync()
|
|
48
|
+
Object.assign(systemInfo, {
|
|
49
|
+
errMsg: 'setStorage:ok'
|
|
50
|
+
})
|
|
51
|
+
successHandle(systemInfo, success, complete)
|
|
52
|
+
} catch (err) {
|
|
53
|
+
const result = {
|
|
54
|
+
errMsg: `getSystemInfo:fail ${err}`
|
|
55
|
+
}
|
|
56
|
+
failHandle(result, fail, complete)
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const getDeviceInfo = function () {
|
|
61
|
+
const deviceInfo = {}
|
|
62
|
+
if (__mpx_mode__ === 'android') {
|
|
63
|
+
const deviceAbi = DeviceInfo.supported64BitAbisSync() || []
|
|
64
|
+
deviceInfo.deviceAbi = deviceAbi[0] || null
|
|
65
|
+
}
|
|
66
|
+
defineUnsupportedProps(deviceInfo, ['benchmarkLevel', 'abi', 'cpuType'])
|
|
67
|
+
Object.assign(deviceInfo, {
|
|
68
|
+
brand: DeviceInfo.getBrand(),
|
|
69
|
+
model: DeviceInfo.getModel(),
|
|
70
|
+
system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`,
|
|
71
|
+
platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(),
|
|
72
|
+
memorySize: DeviceInfo.getTotalMemorySync() / (1024 * 1024)
|
|
73
|
+
})
|
|
74
|
+
return deviceInfo
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
getSystemInfo,
|
|
79
|
+
getSystemInfoSync,
|
|
80
|
+
getDeviceInfo,
|
|
81
|
+
getWindowInfo,
|
|
82
|
+
getLaunchOptionsSync,
|
|
83
|
+
getEnterOptionsSync
|
|
84
|
+
}
|
|
@@ -8,9 +8,15 @@ const getDeviceInfo = ENV_OBJ.getDeviceInfo || envError('getDeviceInfo')
|
|
|
8
8
|
|
|
9
9
|
const getWindowInfo = ENV_OBJ.getWindowInfo || envError('getWindowInfo')
|
|
10
10
|
|
|
11
|
+
const getLaunchOptionsSync = ENV_OBJ.getLaunchOptionsSync || envError('getLaunchOptionsSync')
|
|
12
|
+
|
|
13
|
+
const getEnterOptionsSync = ENV_OBJ.getEnterOptionsSync || envError('getEnterOptionsSync')
|
|
14
|
+
|
|
11
15
|
export {
|
|
12
16
|
getSystemInfo,
|
|
13
17
|
getSystemInfoSync,
|
|
14
18
|
getDeviceInfo,
|
|
15
|
-
getWindowInfo
|
|
19
|
+
getWindowInfo,
|
|
20
|
+
getLaunchOptionsSync,
|
|
21
|
+
getEnterOptionsSync
|
|
16
22
|
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isBrowser, throwSSRWarning, successHandle } from '../../../common/js'
|
|
2
2
|
|
|
3
|
-
function
|
|
4
|
-
if (!isBrowser) {
|
|
5
|
-
throwSSRWarning('getSystemInfoSync API is running in non browser environments')
|
|
6
|
-
return
|
|
7
|
-
}
|
|
3
|
+
const getDeviceInfo = function () {
|
|
8
4
|
const ua = navigator.userAgent.split('(')[1]?.split(')')[0] || ''
|
|
9
5
|
const phones = new Map([
|
|
10
6
|
['iPhone', /iPhone|iPad|iPod|iOS/i],
|
|
@@ -37,20 +33,57 @@ function getSystemInfoSync () {
|
|
|
37
33
|
} else {
|
|
38
34
|
system = `Android ${ua.replace(/^.*Android ([\d.]+);.*$/, '$1')}`
|
|
39
35
|
}
|
|
40
|
-
|
|
41
36
|
return {
|
|
42
|
-
|
|
37
|
+
abi: null,
|
|
38
|
+
deviceAbi: null,
|
|
39
|
+
benchmarkLevel: null,
|
|
40
|
+
brand,
|
|
43
41
|
model: brand,
|
|
42
|
+
system,
|
|
43
|
+
platform: navigator.platform,
|
|
44
|
+
cpuType: null,
|
|
45
|
+
memorySize: null
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const getWindowInfo = function () {
|
|
50
|
+
return {
|
|
44
51
|
pixelRatio: window.devicePixelRatio,
|
|
45
52
|
screenWidth: window.screen.width,
|
|
46
53
|
screenHeight: window.screen.height,
|
|
47
54
|
windowWidth: document.documentElement.clientWidth,
|
|
48
55
|
windowHeight: document.documentElement.clientHeight,
|
|
49
56
|
statusBarHeight: null,
|
|
57
|
+
safeArea: null,
|
|
58
|
+
screenTop: null
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function getSystemInfoSync () {
|
|
63
|
+
if (!isBrowser) {
|
|
64
|
+
throwSSRWarning('getSystemInfoSync API is running in non browser environments')
|
|
65
|
+
return
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const {
|
|
69
|
+
pixelRatio,
|
|
70
|
+
screenWidth,
|
|
71
|
+
screenHeight,
|
|
72
|
+
windowWidth,
|
|
73
|
+
windowHeight,
|
|
74
|
+
statusBarHeight,
|
|
75
|
+
safeArea
|
|
76
|
+
} = getWindowInfo()
|
|
77
|
+
const {
|
|
78
|
+
benchmarkLevel,
|
|
79
|
+
brand,
|
|
80
|
+
model,
|
|
81
|
+
system,
|
|
82
|
+
platform
|
|
83
|
+
} = getDeviceInfo()
|
|
84
|
+
const result = Object.assign({
|
|
50
85
|
language: navigator.language,
|
|
51
86
|
version: null,
|
|
52
|
-
system,
|
|
53
|
-
platform: navigator.platform,
|
|
54
87
|
fontSizeSetting: null,
|
|
55
88
|
SDKVersion: null,
|
|
56
89
|
benchmarkLevel: null,
|
|
@@ -64,9 +97,23 @@ function getSystemInfoSync () {
|
|
|
64
97
|
notificationSoundAuthorized: null,
|
|
65
98
|
bluetoothEnabled: null,
|
|
66
99
|
locationEnabled: null,
|
|
67
|
-
wifiEnabled: null
|
|
68
|
-
|
|
69
|
-
|
|
100
|
+
wifiEnabled: null
|
|
101
|
+
}, {
|
|
102
|
+
pixelRatio,
|
|
103
|
+
screenWidth,
|
|
104
|
+
screenHeight,
|
|
105
|
+
windowWidth,
|
|
106
|
+
windowHeight,
|
|
107
|
+
statusBarHeight,
|
|
108
|
+
safeArea
|
|
109
|
+
}, {
|
|
110
|
+
benchmarkLevel,
|
|
111
|
+
brand,
|
|
112
|
+
model,
|
|
113
|
+
system,
|
|
114
|
+
platform
|
|
115
|
+
})
|
|
116
|
+
return result
|
|
70
117
|
}
|
|
71
118
|
|
|
72
119
|
function getSystemInfo (options = {}) {
|
|
@@ -79,13 +126,27 @@ function getSystemInfo (options = {}) {
|
|
|
79
126
|
successHandle(res, options.success, options.complete)
|
|
80
127
|
}
|
|
81
128
|
|
|
82
|
-
const
|
|
129
|
+
const getEnterOptionsSync = function () {
|
|
130
|
+
if (!isBrowser) {
|
|
131
|
+
throwSSRWarning('getEnterOptionsSync API is running in non browser environments')
|
|
132
|
+
return
|
|
133
|
+
}
|
|
134
|
+
return global.__mpxEnterOptions || {}
|
|
135
|
+
}
|
|
83
136
|
|
|
84
|
-
const
|
|
137
|
+
const getLaunchOptionsSync = function () {
|
|
138
|
+
if (!isBrowser) {
|
|
139
|
+
throwSSRWarning('getLaunchOptionsSync API is running in non browser environments')
|
|
140
|
+
return
|
|
141
|
+
}
|
|
142
|
+
return global.__mpxEnterOptions || {}
|
|
143
|
+
}
|
|
85
144
|
|
|
86
145
|
export {
|
|
87
146
|
getSystemInfo,
|
|
88
147
|
getSystemInfoSync,
|
|
89
148
|
getDeviceInfo,
|
|
90
|
-
getWindowInfo
|
|
149
|
+
getWindowInfo,
|
|
150
|
+
getLaunchOptionsSync,
|
|
151
|
+
getEnterOptionsSync
|
|
91
152
|
}
|
|
@@ -1,83 +1,62 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { getWindowInfo } from './rnWindowInfo'
|
|
5
|
-
|
|
6
|
-
const getSystemInfoSync = function () {
|
|
7
|
-
const windowInfo = getWindowInfo()
|
|
8
|
-
const { screenWidth, screenHeight, safeArea } = windowInfo
|
|
1
|
+
import { PixelRatio, Dimensions } from 'react-native'
|
|
2
|
+
import { initialWindowMetrics } from 'react-native-safe-area-context'
|
|
3
|
+
import { getFocusedNavigation } from '../../../common/js'
|
|
9
4
|
|
|
5
|
+
const getWindowInfo = function () {
|
|
6
|
+
const dimensionsScreen = Dimensions.get('screen')
|
|
7
|
+
const navigation = getFocusedNavigation() || {}
|
|
8
|
+
const initialWindowMetricsInset = initialWindowMetrics?.insets || {}
|
|
9
|
+
const navigationInsets = navigation.insets || {}
|
|
10
|
+
const insets = Object.assign(initialWindowMetricsInset, navigationInsets)
|
|
11
|
+
let safeArea = {}
|
|
12
|
+
const { top = 0, bottom = 0, left = 0, right = 0 } = insets
|
|
13
|
+
const screenHeight = __mpx_mode__ === 'ios' ? dimensionsScreen.height : dimensionsScreen.height - bottom // 解决安卓开启屏幕内三建导航安卓把安全区计算进去后产生的影响
|
|
14
|
+
const screenWidth = __mpx_mode__ === 'ios' ? dimensionsScreen.width : dimensionsScreen.width - right
|
|
15
|
+
const layout = navigation.layout || {}
|
|
16
|
+
const layoutHeight = layout.height || 0
|
|
17
|
+
const layoutWidth = layout.width || 0
|
|
18
|
+
const windowHeight = layoutHeight || screenHeight
|
|
19
|
+
try {
|
|
20
|
+
safeArea = {
|
|
21
|
+
left,
|
|
22
|
+
right: screenWidth - right,
|
|
23
|
+
top,
|
|
24
|
+
bottom: screenHeight - bottom,
|
|
25
|
+
height: screenHeight - top - bottom,
|
|
26
|
+
width: screenWidth - left - right
|
|
27
|
+
}
|
|
28
|
+
} catch (error) {
|
|
29
|
+
}
|
|
10
30
|
const result = {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
31
|
+
pixelRatio: PixelRatio.get(),
|
|
32
|
+
windowWidth: layoutWidth || screenWidth,
|
|
33
|
+
windowHeight, // 取不到layout的时候有个兜底
|
|
34
|
+
screenWidth: screenWidth,
|
|
35
|
+
screenHeight: screenHeight,
|
|
36
|
+
screenTop: screenHeight - windowHeight,
|
|
16
37
|
statusBarHeight: safeArea.top,
|
|
17
|
-
|
|
18
|
-
...windowInfo
|
|
38
|
+
safeArea
|
|
19
39
|
}
|
|
20
|
-
defineUnsupportedProps(result, [
|
|
21
|
-
'language',
|
|
22
|
-
'version',
|
|
23
|
-
'SDKVersion',
|
|
24
|
-
'benchmarkLevel',
|
|
25
|
-
'albumAuthorized',
|
|
26
|
-
'cameraAuthorized',
|
|
27
|
-
'locationAuthorized',
|
|
28
|
-
'microphoneAuthorized',
|
|
29
|
-
'notificationAuthorized',
|
|
30
|
-
'phoneCalendarAuthorized',
|
|
31
|
-
'host',
|
|
32
|
-
'enableDebug',
|
|
33
|
-
'notificationAlertAuthorized',
|
|
34
|
-
'notificationBadgeAuthorized',
|
|
35
|
-
'notificationSoundAuthorized',
|
|
36
|
-
'bluetoothEnabled',
|
|
37
|
-
'locationEnabled',
|
|
38
|
-
'wifiEnabled',
|
|
39
|
-
'locationReducedAccuracy',
|
|
40
|
-
'theme'
|
|
41
|
-
])
|
|
42
40
|
return result
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
successHandle(systemInfo, success, complete)
|
|
53
|
-
} catch (err) {
|
|
54
|
-
const result = {
|
|
55
|
-
errMsg: `getSystemInfo:fail ${err}`
|
|
56
|
-
}
|
|
57
|
-
failHandle(result, fail, complete)
|
|
43
|
+
const getLaunchOptionsSync = function () {
|
|
44
|
+
const options = global.__mpxEnterOptions || {}
|
|
45
|
+
const { path, scene, query } = options
|
|
46
|
+
return {
|
|
47
|
+
path,
|
|
48
|
+
scene,
|
|
49
|
+
query
|
|
58
50
|
}
|
|
59
51
|
}
|
|
60
52
|
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
const deviceAbi = DeviceInfo.supported64BitAbisSync() || []
|
|
65
|
-
deviceInfo.deviceAbi = deviceAbi[0] || null
|
|
66
|
-
}
|
|
67
|
-
defineUnsupportedProps(deviceInfo, ['benchmarkLevel', 'abi', 'cpuType'])
|
|
68
|
-
Object.assign(deviceInfo, {
|
|
69
|
-
brand: DeviceInfo.getBrand(),
|
|
70
|
-
model: DeviceInfo.getModel(),
|
|
71
|
-
system: `${DeviceInfo.getSystemName()} ${DeviceInfo.getSystemVersion()}`,
|
|
72
|
-
platform: DeviceInfo.isEmulatorSync() ? 'emulator' : DeviceInfo.getSystemName(),
|
|
73
|
-
memorySize: DeviceInfo.getTotalMemorySync() / (1024 * 1024)
|
|
74
|
-
})
|
|
75
|
-
return deviceInfo
|
|
53
|
+
const getEnterOptionsSync = function () {
|
|
54
|
+
const result = getLaunchOptionsSync()
|
|
55
|
+
return result
|
|
76
56
|
}
|
|
77
57
|
|
|
78
58
|
export {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
getWindowInfo
|
|
59
|
+
getWindowInfo,
|
|
60
|
+
getLaunchOptionsSync,
|
|
61
|
+
getEnterOptionsSync
|
|
83
62
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { View, Text, Image, StyleSheet, ActivityIndicator } from 'react-native'
|
|
1
|
+
import { View, Text, Image, StyleSheet, ActivityIndicator, Dimensions } from 'react-native'
|
|
2
2
|
import { successHandle, failHandle } from '../../../common/js'
|
|
3
3
|
import { Portal } from '@ant-design/react-native'
|
|
4
4
|
|
|
5
5
|
let toastKey
|
|
6
6
|
let isLoadingShow
|
|
7
|
+
const dimensionsScreen = Dimensions.get('screen')
|
|
8
|
+
const screenHeight = dimensionsScreen.height
|
|
9
|
+
const contentTop = parseInt(screenHeight * 0.35)
|
|
7
10
|
let tId // show duration 计时id
|
|
8
11
|
const styles = StyleSheet.create({
|
|
9
12
|
toastContent: {
|
|
10
|
-
minWdth: 150,
|
|
11
13
|
maxWidth: '60%',
|
|
12
14
|
backgroundColor: 'rgba(20, 20, 20, 0.7)',
|
|
13
15
|
paddingTop: 15,
|
|
@@ -18,7 +20,8 @@ const styles = StyleSheet.create({
|
|
|
18
20
|
display: 'flex',
|
|
19
21
|
flexDirection: 'column',
|
|
20
22
|
justifyContent: 'center',
|
|
21
|
-
alignItems: 'center'
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
marginTop: contentTop // 小程序里面展示偏上一点
|
|
22
25
|
},
|
|
23
26
|
toastWrap: {
|
|
24
27
|
left: 0,
|
|
@@ -28,25 +31,29 @@ const styles = StyleSheet.create({
|
|
|
28
31
|
zIndex: 10000,
|
|
29
32
|
position: "absolute",
|
|
30
33
|
display: 'flex',
|
|
31
|
-
justifyContent: 'center',
|
|
32
34
|
alignItems: 'center'
|
|
33
35
|
},
|
|
36
|
+
toastHasIcon: {
|
|
37
|
+
height: 110,
|
|
38
|
+
width: 120
|
|
39
|
+
},
|
|
34
40
|
toastImg: {
|
|
35
41
|
width: 40,
|
|
36
42
|
height: 40,
|
|
37
43
|
marginLeft: 'auto',
|
|
38
|
-
marginRight: 'auto'
|
|
39
|
-
marginBottom: 10
|
|
44
|
+
marginRight: 'auto'
|
|
40
45
|
},
|
|
41
46
|
toastText: {
|
|
42
47
|
textAlign: 'center',
|
|
43
48
|
color: '#ffffff',
|
|
44
|
-
fontSize:
|
|
49
|
+
fontSize: 12,
|
|
45
50
|
lineHeight: 18,
|
|
46
51
|
height: 18,
|
|
47
|
-
overflow: 'hidden'
|
|
52
|
+
overflow: 'hidden',
|
|
53
|
+
marginTop: 10
|
|
48
54
|
}
|
|
49
55
|
})
|
|
56
|
+
|
|
50
57
|
function showToast (options = {}) {
|
|
51
58
|
const { title, icon = 'success', image, duration = 1500, mask = false, success, fail, complete, isLoading } = options
|
|
52
59
|
let ToastView
|
|
@@ -64,29 +71,29 @@ function showToast (options = {}) {
|
|
|
64
71
|
tId = null
|
|
65
72
|
if (image || icon === 'success' || icon === 'error') {
|
|
66
73
|
ToastView = <View style={styles.toastWrap} pointerEvents={pointerEvents}>
|
|
67
|
-
<View style={styles.toastContent}>
|
|
74
|
+
<View style={[styles.toastContent, styles.toastHasIcon]}>
|
|
68
75
|
<Image style={ styles.toastImg } source={{uri: image || iconImg[icon]}}></Image>
|
|
69
|
-
<Text style={styles.toastText}>{title}</Text>
|
|
76
|
+
{ title ? <Text style={styles.toastText}>{title}</Text> : null }
|
|
70
77
|
</View>
|
|
71
78
|
</View>
|
|
72
79
|
} else if (icon === 'loading') {
|
|
73
80
|
ToastView = <View style={styles.toastWrap} pointerEvents={pointerEvents}>
|
|
74
|
-
<View style={styles.toastContent}>
|
|
81
|
+
<View style={[styles.toastContent, styles.toastHasIcon]}>
|
|
75
82
|
<ActivityIndicator
|
|
76
83
|
animating
|
|
77
|
-
style={{ marginBottom: 10 }}
|
|
78
84
|
size='small'
|
|
79
85
|
color='#eee'
|
|
80
86
|
/>
|
|
81
|
-
<Text style={styles.toastText}>{title}</Text>
|
|
87
|
+
{ title ? <Text style={styles.toastText}>{title}</Text> : null }
|
|
82
88
|
</View>
|
|
83
89
|
</View>
|
|
84
90
|
} else {
|
|
85
91
|
ToastView = <View style={styles.toastWrap} pointerEvents={pointerEvents}>
|
|
86
92
|
<View style={styles.toastContent}>
|
|
87
|
-
<Text numberOfLines={2} style={{ ...styles.toastText, ...(icon === 'none' ? {
|
|
88
|
-
height:
|
|
89
|
-
|
|
93
|
+
{ title ? <Text numberOfLines={2} style={{ ...styles.toastText, ...(icon === 'none' ? {
|
|
94
|
+
height: 'auto',
|
|
95
|
+
marginTop: 0
|
|
96
|
+
} : {}) }}>{title}</Text> : null }
|
|
90
97
|
</View>
|
|
91
98
|
</View>
|
|
92
99
|
}
|
package/src/platform/index.js
CHANGED
|
@@ -43,7 +43,7 @@ export * from './api/file'
|
|
|
43
43
|
// getUserInfo
|
|
44
44
|
export * from './api/get-user-info'
|
|
45
45
|
|
|
46
|
-
// previewImage, compressImage
|
|
46
|
+
// previewImage, compressImage, getImageInfo
|
|
47
47
|
export * from './api/image'
|
|
48
48
|
|
|
49
49
|
// login
|
|
@@ -105,9 +105,6 @@ export * from './api/video'
|
|
|
105
105
|
// onWindowResize, offWindowResize
|
|
106
106
|
export * from './api/window'
|
|
107
107
|
|
|
108
|
-
// getEnterOptionsSync
|
|
109
|
-
export * from './api/lifecycle'
|
|
110
|
-
|
|
111
108
|
// getLocation, openLocation, chooseLocation
|
|
112
109
|
export * from './api/location'
|
|
113
110
|
|
|
@@ -119,3 +116,6 @@ export * from './api/vibrate'
|
|
|
119
116
|
|
|
120
117
|
// onKeyboardHeightChange, offKeyboardHeightChange, hideKeyboard
|
|
121
118
|
export * from './api/keyboard'
|
|
119
|
+
|
|
120
|
+
// getSetting, openSetting, enableAlertBeforeUnload, disableAlertBeforeUnload, getMenuButtonBoundingClientRect
|
|
121
|
+
export * from './api/setting'
|