@mpxjs/api-proxy 2.9.52 → 2.9.58

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.
Files changed (64) hide show
  1. package/@types/index.d.ts +7 -7
  2. package/package.json +21 -5
  3. package/src/common/js/promisify.js +6 -6
  4. package/src/common/js/utils.js +16 -52
  5. package/src/common/js/web.js +0 -12
  6. package/src/install.js +2 -3
  7. package/src/platform/api/action-sheet/ActionSheet.js +3 -7
  8. package/src/platform/api/action-sheet/index.ali.js +2 -1
  9. package/src/platform/api/action-sheet/index.android.js +1 -0
  10. package/src/platform/api/action-sheet/index.ios.js +1 -0
  11. package/src/platform/api/action-sheet/rnActionSheet.jsx +127 -0
  12. package/src/platform/api/app/index.ios.js +1 -0
  13. package/src/platform/api/app/index.web.js +5 -4
  14. package/src/platform/api/clipboard-data/rnClipboard.js +5 -5
  15. package/src/platform/api/create-selector-query/index.ali.js +2 -1
  16. package/src/platform/api/create-selector-query/index.android.js +1 -0
  17. package/src/platform/api/create-selector-query/index.ios.js +9 -0
  18. package/src/platform/api/create-selector-query/rnNodesRef.js +262 -0
  19. package/src/platform/api/create-selector-query/rnSelectQuery.js +43 -0
  20. package/src/platform/api/device/network/getNetworkType.js +4 -4
  21. package/src/platform/api/device/network/rnNetwork.js +3 -3
  22. package/src/platform/api/image/Preview.js +3 -3
  23. package/src/platform/api/location/index.ali.js +31 -0
  24. package/src/platform/api/location/index.android.js +1 -0
  25. package/src/platform/api/location/index.ios.js +31 -0
  26. package/src/platform/api/location/index.js +13 -0
  27. package/src/platform/api/location/index.web.js +36 -0
  28. package/src/platform/api/make-phone-call/rnMakePhone.js +3 -3
  29. package/src/platform/api/modal/Modal.js +12 -15
  30. package/src/platform/api/modal/index.android.js +1 -0
  31. package/src/platform/api/modal/index.ios.js +1 -0
  32. package/src/platform/api/modal/rnModal.jsx +149 -0
  33. package/src/platform/api/next-tick/index.android.js +1 -0
  34. package/src/platform/api/next-tick/index.ios.js +1 -0
  35. package/src/platform/api/page-scroll-to/index.web.js +3 -3
  36. package/src/platform/api/pull-down/index.web.js +5 -5
  37. package/src/platform/api/request/index.web.js +3 -6
  38. package/src/platform/api/request-payment/index.ali.js +2 -1
  39. package/src/platform/api/route/index.ios.js +9 -9
  40. package/src/platform/api/route/index.web.js +15 -18
  41. package/src/platform/api/screen-brightness/index.android.js +1 -0
  42. package/src/platform/api/screen-brightness/index.ios.js +1 -0
  43. package/src/platform/api/screen-brightness/rnScreenBrightness.js +53 -0
  44. package/src/platform/api/set-navigation-bar/index.android.js +1 -0
  45. package/src/platform/api/set-navigation-bar/index.ios.js +41 -0
  46. package/src/platform/api/set-navigation-bar/index.web.js +3 -3
  47. package/src/platform/api/socket/SocketTask.js +8 -17
  48. package/src/platform/api/socket/index.android.js +1 -0
  49. package/src/platform/api/socket/index.web.js +3 -3
  50. package/src/platform/api/storage/index.web.js +12 -11
  51. package/src/platform/api/storage/rnStorage.js +13 -12
  52. package/src/platform/api/system/index.ali.js +6 -2
  53. package/src/platform/api/system/index.web.js +2 -2
  54. package/src/platform/api/system/rnSystem.js +3 -3
  55. package/src/platform/api/tab-bar/index.web.js +10 -9
  56. package/src/platform/api/toast/Toast.js +3 -4
  57. package/src/platform/api/toast/error.png +0 -0
  58. package/src/platform/api/toast/index.android.js +1 -0
  59. package/src/platform/api/toast/index.ios.js +1 -0
  60. package/src/platform/api/toast/rnToast.jsx +189 -0
  61. package/src/platform/api/toast/success.png +0 -0
  62. package/src/platform/index.js +3 -0
  63. /package/src/platform/api/{socket/index.andriod.js → app/index.android.js} +0 -0
  64. /package/src/platform/api/make-phone-call/{index.andriod.js → index.android.js} +0 -0
@@ -0,0 +1,262 @@
1
+ import {
2
+ noop,
3
+ isBoolean,
4
+ dash2hump,
5
+ collectDataset,
6
+ hump2dash,
7
+ isArray
8
+ } from '@mpxjs/utils'
9
+ import { StyleSheet } from 'react-native'
10
+
11
+ const flushRefFns = (nodeInstances, fns, single) => {
12
+ // wx的数据格式:对于具体方法接受到的回调传参,如果获取的 nodeRef 只有一个,那么只需要返回一条数据而不是数组,但是 exec 里面统一都是数组
13
+ const mountedNodeInstance = nodeInstances
14
+ .map((instance) => instance.getNodeInstance())
15
+ .filter(({ nodeRef }) => nodeRef.current) // 如果有 nodeRef,表明目前组件处于挂载中
16
+ if (mountedNodeInstance.length) {
17
+ return Promise.all(
18
+ mountedNodeInstance.map((instance) => flushFns(instance, fns))
19
+ ).then((result = []) => (single ? result[0] : result))
20
+ } else {
21
+ return Promise.resolve(single ? null : [])
22
+ }
23
+ }
24
+
25
+ const flushFns = (nodeInstance, fns) => {
26
+ return Promise.all(fns.map((fn) => fn(nodeInstance))).then((res) => {
27
+ return res.reduce((preVal, curVal) => {
28
+ return Object.assign(preVal, curVal)
29
+ }, {})
30
+ })
31
+ }
32
+
33
+ const wrapFn = (fn) => {
34
+ return (nodeRef) => {
35
+ return new Promise((resolve) => {
36
+ fn(nodeRef, resolve)
37
+ })
38
+ }
39
+ }
40
+
41
+ const getMeasureProps = (measureProps = []) => {
42
+ return wrapFn((nodeInstance, resolve) => {
43
+ const nodeRef = nodeInstance.nodeRef.current
44
+ setTimeout(() => {
45
+ nodeRef.measure(function (x, y, width, height, pageX, pageY) {
46
+ const rectAndSize = {
47
+ width,
48
+ height,
49
+ left: pageX,
50
+ top: pageY,
51
+ right: pageX + width,
52
+ bottom: pageY + height
53
+ }
54
+ const result = measureProps.reduce((preVal, key) => {
55
+ return Object.assign(preVal, { [key]: rectAndSize[key] || 0 })
56
+ }, {})
57
+ resolve(result)
58
+ })
59
+ }, 30) // 延迟,等待组件在rn视图上真正渲染出来
60
+ })
61
+ }
62
+
63
+ const getDataset = (props) => {
64
+ return wrapFn((nodeRef, resolve) => {
65
+ props = nodeRef.props.current
66
+ resolve({
67
+ dataset: collectDataset(props)
68
+ })
69
+ })
70
+ }
71
+
72
+ const getPlainProps = (config) => {
73
+ return wrapFn((nodeRef, resolve) => {
74
+ const res = {}
75
+ const props = nodeRef.props.current
76
+ config.forEach((key) => {
77
+ // props 属性默认不转驼峰,用户写什么格式不会变化,取值做兼容
78
+ res[key] = props[key] || props[hump2dash(key)] || ''
79
+ })
80
+ resolve(res)
81
+ })
82
+ }
83
+
84
+ const getComputedStyle = (config = []) => {
85
+ return wrapFn((nodeRef, resolve) => {
86
+ config = new Set(config)
87
+ const res = {}
88
+ const styles = nodeRef.props.current.style || []
89
+ const defaultStyle = nodeRef.instance.defaultStyle || {}
90
+ const computedStyle = StyleSheet.flatten([defaultStyle, ...styles])
91
+ config.forEach((key) => {
92
+ const humpKey = dash2hump(key)
93
+ // 取 style 的 key 是根据传入的 key 来设置,传什么设置什么 key,只不过取值需要做兼容
94
+ res[key] = computedStyle[key] || computedStyle[humpKey] || ''
95
+ })
96
+
97
+ resolve(res)
98
+ })
99
+ }
100
+
101
+ const getInstanceConfig = (config) => {
102
+ return wrapFn((nodeRef, resolve) => {
103
+ const instance = nodeRef.instance
104
+ resolve({ [config]: instance[config] || {} })
105
+ })
106
+ }
107
+
108
+ const defaultScrollOffset = {
109
+ scrollLeft: 0,
110
+ scrollTop: 0,
111
+ scrollHeight: 0,
112
+ scrollWidth: 0
113
+ }
114
+
115
+ const getScrollOffset = () => {
116
+ return wrapFn((nodeRef, resolve) => {
117
+ const instance = nodeRef.instance
118
+ resolve(
119
+ (instance.scrollOffset && instance.scrollOffset.current) ||
120
+ defaultScrollOffset
121
+ )
122
+ })
123
+ }
124
+
125
+ const RECT = ['left', 'top', 'right', 'bottom']
126
+ const SIZE = ['width', 'height']
127
+
128
+ class NodeRef {
129
+ constructor (nodeRefs = [], selectorQuery, single) {
130
+ if (!isArray(nodeRefs)) {
131
+ nodeRefs = [nodeRefs]
132
+ }
133
+ this.nodeRefs = nodeRefs
134
+ this.selectorQuery = selectorQuery
135
+ this.single = single
136
+ }
137
+
138
+ fields (config, cb = noop) {
139
+ const plainProps = []
140
+ const measureProps = []
141
+ const computedStyle = []
142
+ const fns = []
143
+
144
+ for (const key in config) {
145
+ const value = config[key]
146
+ if (Array.isArray(value) && value.length) {
147
+ if (key === 'properties') {
148
+ // wx 最终输出的 properties 字段都会转化为驼峰,所以在这里提前处理为最终的字段格式
149
+ plainProps.push(...value.map((v) => dash2hump(v)))
150
+ } else if (key === 'computedStyle') {
151
+ const _computedStyle = config.computedStyle
152
+ for (let i = _computedStyle.length - 1; i >= 0; i--) {
153
+ const style = _computedStyle[i]
154
+ if (RECT.includes(style) || SIZE.includes(style)) {
155
+ measureProps.push(style)
156
+ _computedStyle.splice(i, 1)
157
+ }
158
+ }
159
+ if (_computedStyle.length) {
160
+ computedStyle.push(..._computedStyle)
161
+ }
162
+ }
163
+ } else if (isBoolean(value) && value) {
164
+ switch (key) {
165
+ case 'rect':
166
+ measureProps.push(...RECT)
167
+ break
168
+ case 'size':
169
+ measureProps.push(...SIZE)
170
+ break
171
+ case 'scrollOffset':
172
+ fns.push(getScrollOffset())
173
+ break
174
+ case 'dataset':
175
+ fns.push(getDataset())
176
+ break
177
+ case 'node':
178
+ case 'context':
179
+ case 'ref':
180
+ fns.push(getInstanceConfig(key))
181
+ break
182
+ default:
183
+ plainProps.push(key)
184
+ break
185
+ }
186
+ }
187
+ }
188
+
189
+ if (plainProps.length) {
190
+ fns.push(getPlainProps(plainProps))
191
+ }
192
+ if (measureProps.length) {
193
+ const nodeInstance =
194
+ this.nodeRefs[0] && this.nodeRefs[0].getNodeInstance()
195
+ const hasMeasureFn =
196
+ nodeInstance &&
197
+ nodeInstance.nodeRef.current &&
198
+ nodeInstance.nodeRef.current.measure
199
+ if (hasMeasureFn) {
200
+ fns.push(getMeasureProps(measureProps))
201
+ } else {
202
+ computedStyle.push(...measureProps)
203
+ }
204
+ }
205
+ if (computedStyle.length) {
206
+ fns.push(getComputedStyle(computedStyle))
207
+ }
208
+
209
+ const runCb = () => {
210
+ return flushRefFns(this.nodeRefs, fns, this.single).then((result) => {
211
+ cb(result)
212
+ return result
213
+ })
214
+ }
215
+
216
+ this.selectorQuery._queueCb.push(runCb)
217
+
218
+ return this.selectorQuery
219
+ }
220
+
221
+ boundingClientRect (cb = noop) {
222
+ const config = {
223
+ id: true,
224
+ dataset: true,
225
+ rect: true,
226
+ size: true
227
+ }
228
+ return this.fields(config, cb)
229
+ }
230
+
231
+ context (cb = noop) {
232
+ const config = {
233
+ context: true
234
+ }
235
+ return this.fields(config, cb)
236
+ }
237
+
238
+ node (cb = noop) {
239
+ const config = {
240
+ node: true
241
+ }
242
+ return this.fields(config, cb)
243
+ }
244
+
245
+ ref (cb = noop) {
246
+ const config = {
247
+ ref: true
248
+ }
249
+ return this.fields(config, cb)
250
+ }
251
+
252
+ scrollOffset (cb = noop) {
253
+ const config = {
254
+ id: true,
255
+ dataset: true,
256
+ scrollOffset: true
257
+ }
258
+ return this.fields(config, cb)
259
+ }
260
+ }
261
+
262
+ export default NodeRef
@@ -0,0 +1,43 @@
1
+ import NodeRef from './rnNodesRef'
2
+ import { warn, noop } from '@mpxjs/utils'
3
+
4
+ export default class SelectorQuery {
5
+ constructor () {
6
+ this._component = null
7
+ this._queue = []
8
+ this._queueCb = []
9
+ }
10
+
11
+ // wx 目前 exec 方法返回 undefined,文档上标注的是 NodeRef 类型,按实际的返回值来实现
12
+ exec (cb = noop) {
13
+ Promise.all(this._queueCb.map((cb) => cb())).then((res) => cb(res))
14
+ }
15
+
16
+ in (component) {
17
+ this._component = component
18
+ return this
19
+ }
20
+
21
+ /**
22
+ * 目前支持的 selector
23
+ *
24
+ * 1. id 选择器:#the-id
25
+ * 2. class 选择器(可以连续指定多个):.a-class.another-class
26
+ */
27
+ select (selector = '', all) {
28
+ if (!this._component) {
29
+ warn('Please use SelectorQuery.in method to set context')
30
+ }
31
+ const refs = this._component && this._component.__selectRef(selector, 'node', all)
32
+ return new NodeRef(refs, this, !all)
33
+ }
34
+
35
+ selectAll (selector) {
36
+ return this.select(selector, true)
37
+ }
38
+
39
+ selectViewport () {
40
+ // todo rn 这块实现不了
41
+ return this.select('')
42
+ }
43
+ }
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail, isBrowser, throwSSRWarning } from '../../../../common/js'
1
+ import { successHandle, failHandle, isBrowser, throwSSRWarning } from '../../../../common/js'
2
2
 
3
3
  export function getNetworkType ({ success, fail = () => {}, complete = () => {} } = {}) {
4
4
  if (!isBrowser) {
@@ -7,11 +7,11 @@ export function getNetworkType ({ success, fail = () => {}, complete = () => {}
7
7
  }
8
8
  try {
9
9
  if (navigator.connection) {
10
- webHandleSuccess({ networkType: navigator.connection.effectiveType }, success, complete)
10
+ successHandle({ networkType: navigator.connection.effectiveType }, success, complete)
11
11
  } else {
12
- webHandleSuccess({ networkType: 'unknown' }, success, complete)
12
+ successHandle({ networkType: 'unknown' }, success, complete)
13
13
  }
14
14
  } catch (err) {
15
- webHandleFail(err, fail, complete)
15
+ failHandle(err, fail, complete)
16
16
  }
17
17
  }
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail, defineUnsupportedProps } from '../../../../common/js'
1
+ import { successHandle, failHandle, defineUnsupportedProps } from '../../../../common/js'
2
2
  import NetInfo, { NetInfoStateType } from '@react-native-community/netinfo'
3
3
 
4
4
  let _unsubscribe = null
@@ -21,12 +21,12 @@ const getNetworkType = function (options) {
21
21
  errMsg: 'getNetworkType:ok'
22
22
  }
23
23
  defineUnsupportedProps(result, ['signalStrength', 'hasSystemProxy'])
24
- webHandleSuccess(result, success, complete)
24
+ successHandle(result, success, complete)
25
25
  }).catch((err) => {
26
26
  const result = {
27
27
  errMsg: err.message
28
28
  }
29
- webHandleFail(result, fail, complete)
29
+ failHandle(result, fail, complete)
30
30
  })
31
31
  }
32
32
 
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail, createDom, warn, bindTap, getRootElement } from '../../../common/js'
1
+ import { successHandle, failHandle, createDom, warn, bindTap, getRootElement } from '../../../common/js'
2
2
  import '../../../common/stylus/Preview.styl'
3
3
  /**
4
4
  * Preview class for displaying images in a slideshow format.
@@ -67,9 +67,9 @@ export default class Preview {
67
67
  }))))
68
68
  this.maxIndex = urls.length
69
69
  this.updateTextTip()
70
- webHandleSuccess({ errMsg: 'previewImage:ok' }, success, complete)
70
+ successHandle({ errMsg: 'previewImage:ok' }, success, complete)
71
71
  } catch (e) {
72
- webHandleFail({ errMsg: 'previewImage:fail', err: e }, fail, complete)
72
+ failHandle({ errMsg: 'previewImage:fail', err: e }, fail, complete)
73
73
  }
74
74
  }
75
75
 
@@ -0,0 +1,31 @@
1
+ import { ENV_OBJ, changeOpts, handleSuccess, defineUnsupportedProps } from '../../../common/js'
2
+
3
+ function getLocation (options = {}) {
4
+ const opts = Object.assign(options, {
5
+ type: 0 // 只获取经纬与微信拉齐
6
+ })
7
+ handleSuccess(opts, res => {
8
+ const result = changeOpts(
9
+ res,
10
+ { errMsg: 'getLocation:ok' }
11
+ )
12
+ defineUnsupportedProps(result, ['speed'])
13
+ return result
14
+ })
15
+ return ENV_OBJ.getLocation(opts)
16
+ }
17
+
18
+ function openLocation (options = {}) {
19
+ const opts = Object.assign({
20
+ scale: 15 // 地图缩放比例兜底值
21
+ }, options)
22
+ return ENV_OBJ.openLocation(opts)
23
+ }
24
+
25
+ const chooseLocation = ENV_OBJ.chooseLocation
26
+
27
+ export {
28
+ getLocation,
29
+ openLocation,
30
+ chooseLocation
31
+ }
@@ -0,0 +1 @@
1
+ export * from './index.ios'
@@ -0,0 +1,31 @@
1
+ import GetLocation from 'react-native-get-location'
2
+ import { envError, successHandle, failHandle, defineUnsupportedProps } from '../../../common/js'
3
+
4
+ const getLocation = function (options) {
5
+ const { isHighAccuracy = false, success, fail, complete } = options
6
+ GetLocation.getCurrentPosition({
7
+ enableHighAccuracy: isHighAccuracy
8
+ }).then(location => {
9
+ Object.assign(location, {
10
+ errMsg: 'getLocation:ok'
11
+ })
12
+ defineUnsupportedProps(location, ['horizontalAccuracy'])
13
+ successHandle(location, success, complete)
14
+ })
15
+ .catch(error => {
16
+ const result = {
17
+ errMsg: `getLocation:fail ${error}`
18
+ }
19
+ failHandle(result, fail, complete)
20
+ })
21
+ }
22
+
23
+ const openLocation = envError('openLocation')
24
+
25
+ const chooseLocation = envError('chooseLocation')
26
+
27
+ export {
28
+ getLocation,
29
+ openLocation,
30
+ chooseLocation
31
+ }
@@ -0,0 +1,13 @@
1
+ import { ENV_OBJ, envError } from '../../../common/js'
2
+
3
+ const getLocation = ENV_OBJ.getLocation || envError('getLocation')
4
+
5
+ const openLocation = ENV_OBJ.openLocation || envError('openLocation')
6
+
7
+ const chooseLocation = ENV_OBJ.chooseLocation || envError('chooseLocation')
8
+
9
+ export {
10
+ getLocation,
11
+ openLocation,
12
+ chooseLocation
13
+ }
@@ -0,0 +1,36 @@
1
+ import { envError, successHandle, failHandle, defineUnsupportedProps } from '../../../common/js'
2
+
3
+ const getLocation = function (options) {
4
+ const { isHighAccuracy = false, success, fail, complete } = options
5
+ if (navigator.geolocation.getCurrentPosition) {
6
+ navigator.geolocation.getCurrentPosition((res = {}) => {
7
+ const coords = res.coords || {}
8
+ const result = {
9
+ accuracy: coords.accuracy,
10
+ errMsg: 'getLocation:ok',
11
+ latitude: coords.latitude,
12
+ longitude: coords.longitude,
13
+ speed: coords.accuracy
14
+ }
15
+ defineUnsupportedProps(result, ['horizontalAccuracy', 'verticalAccuracy'])
16
+ successHandle(result, success, complete)
17
+ }, (err) => {
18
+ const result = {
19
+ errMsg: `getLocation:fail ${err}`
20
+ }
21
+ failHandle(result, fail, complete)
22
+ }, {
23
+ enableHighAccuracy: isHighAccuracy
24
+ })
25
+ }
26
+ }
27
+
28
+ const openLocation = envError('openLocation')
29
+
30
+ const chooseLocation = envError('chooseLocation')
31
+
32
+ export {
33
+ getLocation,
34
+ openLocation,
35
+ chooseLocation
36
+ }
@@ -1,4 +1,4 @@
1
- import { webHandleSuccess, webHandleFail } from '../../../common/js'
1
+ import { successHandle, failHandle } from '../../../common/js'
2
2
  import { Linking } from 'react-native'
3
3
 
4
4
  const makePhoneCall = function (options) {
@@ -13,12 +13,12 @@ const makePhoneCall = function (options) {
13
13
  const result = {
14
14
  errMsg: 'makePhoneCall:ok'
15
15
  }
16
- webHandleSuccess(result, success, complete)
16
+ successHandle(result, success, complete)
17
17
  }).catch(() => {
18
18
  const result = {
19
19
  errMsg: 'makePhoneCall:fail cancel'
20
20
  }
21
- webHandleFail(result, fail, complete)
21
+ failHandle(result, fail, complete)
22
22
  })
23
23
  }
24
24
 
@@ -1,4 +1,4 @@
1
- import { createDom, getRootElement, webHandleSuccess } from '../../../common/js'
1
+ import { createDom, getRootElement, successHandle, failHandle } from '../../../common/js'
2
2
  import '../../../common/stylus/Modal.styl'
3
3
  // import { forEach } from '@didi/mpx-fetch/src/util'
4
4
  // 汉字为两个字符,字母/数字为一个字符
@@ -23,9 +23,9 @@ export default class Modal {
23
23
  cancelColor: '#000000',
24
24
  confirmText: '确定',
25
25
  confirmColor: '#576B95',
26
- success: (...args) => {},
27
- fail: (...args) => {},
28
- complete: (...args) => {}
26
+ success: (...args) => { },
27
+ fail: (...args) => { },
28
+ complete: (...args) => { }
29
29
  }
30
30
 
31
31
  this.hideTimer = null
@@ -44,21 +44,18 @@ export default class Modal {
44
44
  }
45
45
 
46
46
  show (options = {}) {
47
- getRootElement().appendChild(this.modal)
48
- if (options.confirmText && _getLength(options.confirmText) > 8) {
49
- // eslint-disable-next-line
50
- return Promise.reject({errMsg: 'showModal:fail confirmText length should not larger than 4 Chinese characters'})
47
+ const opts = Object.assign({}, this.defaultOpts, options)
48
+ if (opts.confirmText && _getLength(opts.confirmText) > 8) {
49
+ return failHandle({ errMsg: 'showModal:fail confirmText length should not larger than 4 Chinese characters' }, opts.fail, opts.complete)
51
50
  }
52
- if (options.cancelText && _getLength(options.cancelText) > 8) {
53
- // eslint-disable-next-line
54
- return Promise.reject({errMsg: 'showModal:fail cancelText length should not larger than 4 Chinese characters'})
51
+ if (opts.cancelText && _getLength(opts.cancelText) > 8) {
52
+ return failHandle({ errMsg: 'showModal:fail cancelText length should not larger than 4 Chinese characters' }, opts.fail, opts.complete)
55
53
  }
54
+ getRootElement().appendChild(this.modal)
56
55
  if (this.hideTimer) {
57
56
  clearTimeout(this.hideTimer)
58
57
  this.hideTimer = null
59
58
  }
60
- const opts = Object.assign({}, this.defaultOpts, options)
61
-
62
59
  this.title.textContent = opts.title
63
60
  this.content.textContent = opts.content
64
61
 
@@ -80,7 +77,7 @@ export default class Modal {
80
77
  cancel: true,
81
78
  confirm: false
82
79
  }
83
- webHandleSuccess(result, opts.success, opts.complete)
80
+ successHandle(result, opts.success, opts.complete)
84
81
  }
85
82
  this.confirmBtn.onclick = () => {
86
83
  this.hide()
@@ -89,7 +86,7 @@ export default class Modal {
89
86
  cancel: false,
90
87
  confirm: true
91
88
  }
92
- webHandleSuccess(result, opts.success, opts.complete)
89
+ successHandle(result, opts.success, opts.complete)
93
90
  }
94
91
 
95
92
  this.modal.classList.add('show')
@@ -0,0 +1 @@
1
+ export * from './rnModal'
@@ -0,0 +1 @@
1
+ export * from './rnModal'