@tarojs/taro-rn 4.0.0-beta.7 → 4.0.0-beta.70

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 (38) hide show
  1. package/dist/lib/Popup.js +17 -10
  2. package/dist/lib/Popup.js.map +1 -1
  3. package/dist/lib/chooseImage/index.js +1 -39
  4. package/dist/lib/chooseImage/index.js.map +1 -1
  5. package/dist/lib/chooseMedia/index.js +19 -0
  6. package/dist/lib/chooseMedia/index.js.map +1 -0
  7. package/dist/lib/chooseVideo/index.js +1 -40
  8. package/dist/lib/chooseVideo/index.js.map +1 -1
  9. package/dist/lib/getLocation/index.js +6 -2
  10. package/dist/lib/getLocation/index.js.map +1 -1
  11. package/dist/lib/index.js +1 -0
  12. package/dist/lib/index.js.map +1 -1
  13. package/dist/lib/media.js +52 -20
  14. package/dist/lib/media.js.map +1 -1
  15. package/dist/lib/request/index.js +1 -1
  16. package/dist/lib/request/index.js.map +1 -1
  17. package/dist/lib/scanCode/index.js +1 -1
  18. package/dist/lib/showActionSheet/ActionSheet.js +8 -20
  19. package/dist/lib/showActionSheet/ActionSheet.js.map +1 -1
  20. package/dist/lib/showModal/Dialog.js +19 -33
  21. package/dist/lib/showModal/Dialog.js.map +1 -1
  22. package/dist/lib/showModal/toast.js +1 -1
  23. package/dist/lib/showModal/toast.js.map +1 -1
  24. package/libList.js +1 -0
  25. package/package.json +5 -4
  26. package/src/lib/Popup.tsx +21 -16
  27. package/src/lib/chooseImage/index.ts +1 -29
  28. package/src/lib/chooseMedia/index.ts +15 -0
  29. package/src/lib/chooseVideo/index.ts +1 -31
  30. package/src/lib/getLocation/index.ts +7 -3
  31. package/src/lib/index.ts +1 -0
  32. package/src/lib/media.ts +64 -19
  33. package/src/lib/request/index.ts +1 -1
  34. package/src/lib/scanCode/index.tsx +1 -1
  35. package/src/lib/showActionSheet/ActionSheet.tsx +27 -37
  36. package/src/lib/showModal/Dialog.tsx +27 -33
  37. package/src/lib/showModal/toast.tsx +3 -3
  38. package/types/runtime.d.ts +3 -0
@@ -13,7 +13,7 @@ import { Popup } from '../Popup'
13
13
  import V from '../variable'
14
14
 
15
15
  const styles = StyleSheet.create({
16
- iosActionsheet: {
16
+ actionsheet: {
17
17
  backgroundColor: V.weuiBgColorDefault
18
18
  },
19
19
  androidActionsheetWrapper: {
@@ -21,11 +21,6 @@ const styles = StyleSheet.create({
21
21
  alignItems: 'center',
22
22
  justifyContent: 'center'
23
23
  },
24
- androidActionsheet: {
25
- width: 274,
26
- backgroundColor: V.weuiBgColorDefault,
27
- borderRadius: V.weuiActionSheetAndroidBorderRadius
28
- },
29
24
  actionsheetMenu: {
30
25
  backgroundColor: '#fff'
31
26
  },
@@ -36,29 +31,23 @@ const styles = StyleSheet.create({
36
31
  actionsheetCell: {
37
32
  borderTopWidth: StyleSheet.hairlineWidth,
38
33
  borderColor: V.weuiCellBorderColor,
39
- borderStyle: 'solid'
40
- },
41
- iosActionsheetCell: {
34
+ borderStyle: 'solid',
42
35
  paddingTop: 10,
43
- paddingBottom: 10
44
- },
45
- androidActionsheetCell: {
46
- paddingTop: 13,
47
- paddingBottom: 13,
36
+ paddingBottom: 10,
48
37
  paddingLeft: 24,
49
38
  paddingRight: 24
50
39
  },
40
+
51
41
  firstActionsheetCell: {
52
42
  borderTopWidth: 0
53
43
  },
54
- iosActionsheetCellText: {
44
+ actionSheetCellText: {
55
45
  textAlign: 'center',
56
46
  fontSize: 18,
57
47
  marginTop: ((18 * V.baseLineHeight) - 18) / 2,
58
48
  marginBottom: ((18 * V.baseLineHeight) - 18) / 2
59
49
  },
60
50
  androidActionsheetCellText: {
61
- textAlign: 'center',
62
51
  fontSize: 16,
63
52
  marginTop: ((16 * 1.4) - 16) / 2,
64
53
  marginBottom: ((16 * 1.4) - 16) / 2
@@ -105,7 +94,6 @@ const Index: React.FC<any> = ({
105
94
  underlayColor={underlayColor}
106
95
  style={[
107
96
  styles.actionsheetCell,
108
- styles[`${_type}ActionsheetCell`],
109
97
  idx === 0 ? styles.firstActionsheetCell : {},
110
98
  btnStyle
111
99
  ]}
@@ -113,6 +101,8 @@ const Index: React.FC<any> = ({
113
101
  >
114
102
  <Text
115
103
  style={[
104
+
105
+ styles.actionSheetCellText,
116
106
  styles[`${_type}ActionsheetCellText`],
117
107
  styles[`${btnType}ActionsheetCellText`],
118
108
  textStyle
@@ -128,7 +118,6 @@ const Index: React.FC<any> = ({
128
118
  underlayColor={underlayColor}
129
119
  style={[
130
120
  styles.actionsheetCell,
131
- styles[`${_type}ActionsheetCell`],
132
121
  idx === 0 ? styles.firstActionsheetCell : {},
133
122
  btnStyle
134
123
  ]}
@@ -136,6 +125,7 @@ const Index: React.FC<any> = ({
136
125
  >
137
126
  <Text
138
127
  style={[
128
+ styles.actionSheetCellText,
139
129
  styles[`${_type}ActionsheetCellText`],
140
130
  styles[`${btnType}ActionsheetCellText`],
141
131
  textStyle
@@ -145,29 +135,29 @@ const Index: React.FC<any> = ({
145
135
  )
146
136
 
147
137
  return <Popup
148
- visible={visible}
149
- style={[styles.iosActionsheet, style]}
150
- maskStyle={maskStyle}
151
- onShow={onShow}
152
- onClose={onClose}
153
- >
154
- {menus.length
155
- ? <View style={[styles.actionsheetMenu]}>
156
- {_renderMenuItems()}
157
- </View>
158
- : false}
159
- {actions.length
160
- ? <View style={[styles.actionsheetAction]}>
161
- {_renderActions()}
162
- </View>
163
- : false}
164
- <View style={{paddingBottom: Math.max(initialWindowMetrics?.insets.bottom || 0, 16), backgroundColor: '#fff'}}></View>
165
- </Popup>
138
+ visible={visible}
139
+ style={[styles.actionsheet, style]}
140
+ maskStyle={maskStyle}
141
+ onShow={onShow}
142
+ onClose={onClose}
143
+ >
144
+ {menus.length
145
+ ? <View style={[styles.actionsheetMenu]}>
146
+ {_renderMenuItems()}
147
+ </View>
148
+ : false}
149
+ {actions.length
150
+ ? <View style={[styles.actionsheetAction]}>
151
+ {_renderActions()}
152
+ </View>
153
+ : false}
154
+ <View style={{ paddingBottom: Math.max(initialWindowMetrics?.insets.bottom || 0, 16), backgroundColor: '#fff' }}></View>
155
+ </Popup>
166
156
  }
167
157
 
168
158
  Index.propTypes = {
169
159
  autoDectect: PropTypes.bool,
170
- type: PropTypes.oneOf(['ios', 'android']),
160
+ type: PropTypes.oneOf(['ios', 'android', 'harmony']),
171
161
  menus: PropTypes.any,
172
162
  actions: PropTypes.any,
173
163
  visible: PropTypes.bool,
@@ -33,49 +33,42 @@ const styles = create({
33
33
  paddingRight: V.weuiDialogGapWidth
34
34
  },
35
35
  dialogTitle: {
36
- fontWeight: '400'
37
- },
38
- iosDialogTitle: {
39
- fontSize: 18,
36
+ fontWeight: '700',
37
+ fontSize: 17,
40
38
  textAlign: 'center'
41
39
  },
40
+
42
41
  androidDialogTitle: {
43
42
  fontSize: 21,
44
43
  textAlign: 'left'
45
44
  },
45
+
46
46
  dialogBody: {
47
47
  paddingLeft: V.weuiDialogGapWidth,
48
- paddingRight: V.weuiDialogGapWidth
49
- },
50
- iosDialogBody: {
51
- paddingBottom: (0.8 * 15) + 20
52
- },
53
- androidDialogBody: {
54
- paddingTop: 0.25 * 17,
55
- paddingBottom: (17 * 2) + 20
48
+ paddingRight: V.weuiDialogGapWidth,
49
+ marginBottom: 32
56
50
  },
51
+
57
52
  dialogBodyText: {
58
53
  color: V.weuiTextColorGray,
59
- lineHeight: 15 * 1.3,
54
+ fontSize: 17,
55
+ textAlign: 'center',
56
+ lineHeight: 17 * 1.4,
60
57
  android: {
61
- lineHeight: Math.round(15 * 1.3)
58
+ lineHeight: Math.round(17 * 1.4)
62
59
  }
63
60
  },
64
- iosDialogBodyText: {
65
- fontSize: 15,
66
- textAlign: 'center'
67
- },
61
+
68
62
  androidDialogBodyText: {
69
- fontSize: 17,
70
63
  textAlign: 'left'
71
64
  },
72
65
  dialogFooter: {
73
- flexDirection: 'row'
74
- },
75
- iosDialogFooter: {
66
+ flexDirection: 'row',
76
67
  height: 48,
77
68
  alignItems: 'center',
78
69
  justifyContent: 'center',
70
+ },
71
+ dialogFooterBorder: {
79
72
  borderTopWidth: StyleSheet.hairlineWidth,
80
73
  borderColor: V.weuiDialogLineColor,
81
74
  borderStyle: 'solid'
@@ -90,17 +83,16 @@ const styles = create({
90
83
  },
91
84
  dialogFooterOpr: {
92
85
  alignItems: 'center',
93
- justifyContent: 'center'
94
- },
95
- iosDialogFooterOpr: {
86
+ justifyContent: 'center',
96
87
  height: 48,
97
- flex: 1
88
+ flex: 1,
98
89
  },
99
90
  androidDialogFooterOpr: {
100
91
  height: 42,
101
92
  paddingLeft: 16 * 0.8,
102
93
  paddingRight: 16 * 0.8
103
94
  },
95
+
104
96
  dialogFooterOprWithNegativeMarginRight: {
105
97
  marginRight: 0 - (16 * 0.8)
106
98
  },
@@ -109,12 +101,13 @@ const styles = create({
109
101
  borderColor: V.weuiDialogLineColor,
110
102
  borderStyle: 'solid'
111
103
  },
112
- iosDialogFooterOprText: {
104
+ dialogFooterOprText: {
113
105
  fontSize: 18
114
106
  },
115
107
  androidDialogFooterOprText: {
116
108
  fontSize: 16
117
109
  },
110
+
118
111
  defaultDialogFooterOprText: {
119
112
  color: '#353535'
120
113
  },
@@ -170,14 +163,15 @@ const Index: React.FC<any> = (
170
163
  style={[
171
164
  styles.dialogFooterOpr,
172
165
  styles[`${_type}DialogFooterOpr`],
173
- _type === 'ios' && idx > 0 ? styles.dialogFooterOprWithBorder : {},
174
- _type === 'android' && idx === buttons.length - 1 ? styles.dialogFooterOprWithNegativeMarginRight : {}
166
+ _type === 'android' && idx === buttons.length - 1 ? styles.dialogFooterOprWithNegativeMarginRight : (
167
+ idx > 0 ? styles.dialogFooterOprWithBorder : {}
168
+ ),
175
169
  ]}
176
170
  underlayColor={underlayColor}
177
171
  {...others}
178
172
  >
179
173
  <Text
180
- style={[styles[`${_type}DialogFooterOprText`], { color: btnType }]}
174
+ style={[styles.dialogFooterOprText, styles[`${_type}DialogFooterOprText`], { color: btnType }]}
181
175
  >{label}</Text>
182
176
  </TouchableHighlight>
183
177
  )
@@ -200,10 +194,10 @@ const Index: React.FC<any> = (
200
194
  <View style={[styles.dialogHeader, headerStyle]}>
201
195
  <Text style={[styles.dialogTitle, styles[`${_type}DialogTitle`], titleStyle]}>{title}</Text>
202
196
  </View>
203
- <View style={[styles.dialogBody, styles[`${_type}DialogBody`], bodyStyle]}>
197
+ <View style={[styles.dialogBody, bodyStyle]}>
204
198
  {childrenWithProps}
205
199
  </View>
206
- <View style={[styles.dialogFooter, styles[`${_type}DialogFooter`], footerStyle]}>
200
+ <View style={[styles.dialogFooter, styles[`${_type}DialogFooter`], _type !== 'android' ? styles.dialogFooterBorder : {}, footerStyle]}>
207
201
  {_renderButtons()}
208
202
  </View>
209
203
  </View>
@@ -214,7 +208,7 @@ const Index: React.FC<any> = (
214
208
 
215
209
  Index.propTypes = {
216
210
  autoDectect: PropTypes.bool,
217
- type: PropTypes.oneOf(['ios', 'android']),
211
+ type: PropTypes.oneOf(['ios', 'android', 'harmony']),
218
212
  title: PropTypes.string,
219
213
  buttons: PropTypes.arrayOf(PropTypes.object),
220
214
  visible: PropTypes.bool,
@@ -118,7 +118,7 @@ function showToast (options: Taro.showToast.Option): Promise<TaroGeneral.Callbac
118
118
  return Promise.reject(res)
119
119
  }
120
120
 
121
- let {title = '', icon = 'success', image, duration = 1500, mask = false, success, fail, complete} = options || {} // eslint-disable-line
121
+ let { title = '', icon = 'success', image, duration = 1500, mask = false, success, fail, complete } = options || {} // eslint-disable-line
122
122
 
123
123
  const isLoading = (icon === 'loading')
124
124
 
@@ -138,7 +138,7 @@ function showToast (options: Taro.showToast.Option): Promise<TaroGeneral.Callbac
138
138
  </View>
139
139
  </View>
140
140
  } else if (isLoading) {
141
- ToastView = <WXLoading title={title} mask={mask}/>
141
+ ToastView = <WXLoading title={title} mask={mask} />
142
142
  } else if (icon === 'none') {
143
143
  ToastView = <View style={maskStyle}>
144
144
  <View style={styles.textGrayBlock}>
@@ -177,7 +177,7 @@ function showToast (options: Taro.showToast.Option): Promise<TaroGeneral.Callbac
177
177
  }
178
178
  }
179
179
 
180
- function showLoading (options: Taro.showLoading.Option): Promise<TaroGeneral.CallbackResult> {
180
+ function showLoading (options: Taro.showLoading.Option = { title: "加载中" }): Promise<TaroGeneral.CallbackResult> {
181
181
  const isObject = shouldBeObject(options)
182
182
  if (!isObject.res) {
183
183
  const res = { errMsg: `showLoading${isObject.msg}` }
@@ -0,0 +1,3 @@
1
+ declare module '@tarojs/runtime' {
2
+ export * from '@tarojs/runtime-rn'
3
+ }