@mpxjs/api-proxy 2.10.1 → 2.10.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/api-proxy",
3
- "version": "2.10.1",
3
+ "version": "2.10.3",
4
4
  "description": "convert miniprogram API at each end",
5
5
  "module": "src/index.js",
6
6
  "types": "@types/index.d.ts",
@@ -37,7 +37,7 @@
37
37
  },
38
38
  "homepage": "https://github.com/didi/mpx#readme",
39
39
  "dependencies": {
40
- "@mpxjs/utils": "^2.10.0",
40
+ "@mpxjs/utils": "^2.10.2",
41
41
  "axios": "^1.7.3"
42
42
  },
43
43
  "peerDependencies": {
@@ -68,5 +68,5 @@
68
68
  "optional": true
69
69
  }
70
70
  },
71
- "gitHead": "7e4f9ab5528f1ab0ae08fdfad1bfbbb445088848"
71
+ "gitHead": "043c9bc770ce9cc11f865bab67f46849ff573728"
72
72
  }
@@ -1,4 +1,4 @@
1
- import { useEffect } from 'react'
1
+ import { useEffect, useState } from 'react'
2
2
  import { View, Text, StyleSheet } from 'react-native'
3
3
  import { successHandle, failHandle, getCurrentPageId } from '../../../common/js'
4
4
  import Portal from '@mpxjs/webpack-plugin/lib/runtime/components/react/dist/mpx-portal/index'
@@ -7,8 +7,7 @@ import Animated, {
7
7
  useSharedValue,
8
8
  useAnimatedStyle,
9
9
  withTiming,
10
- Easing,
11
- runOnJS
10
+ Easing
12
11
  } from 'react-native-reanimated'
13
12
  const actionSheetMap = new Map()
14
13
 
@@ -53,8 +52,7 @@ const styles = StyleSheet.create({
53
52
  position: 'absolute',
54
53
  bottom: 0,
55
54
  left: 0,
56
- right: 0,
57
- paddingBottom: bottom
55
+ right: 0
58
56
  },
59
57
  itemStyle: {
60
58
  paddingTop: 15,
@@ -72,15 +70,16 @@ const styles = StyleSheet.create({
72
70
  },
73
71
  buttonStyle: {
74
72
  paddingTop: 10,
75
- paddingBottom: 10,
76
73
  justifyContent: 'center',
77
- alignItems: 'center'
74
+ alignItems: 'center',
75
+ paddingBottom: bottom + 10
78
76
  }
79
77
  })
80
78
 
81
79
  function ActionSheet ({itemColor, height, success, fail, complete, alertText, itemList}) {
82
80
  const slide = useSharedValue(height)
83
81
  const fade = useSharedValue(0)
82
+ const [selectedIndex, setSelectedIndex] = useState(null)
84
83
 
85
84
  const actionAnimatedStyles = useAnimatedStyle(() => {
86
85
  return {
@@ -116,6 +115,7 @@ function ActionSheet ({itemColor, height, success, fail, complete, alertText, it
116
115
  tapIndex: index
117
116
  }
118
117
  successHandle(result, success, complete)
118
+ setSelectedIndex(null)
119
119
  }
120
120
  const cancelAction = function () {
121
121
  removeActionSheet()
@@ -123,6 +123,10 @@ function ActionSheet ({itemColor, height, success, fail, complete, alertText, it
123
123
  errMsg: 'showActionSheet:fail cancel'
124
124
  }
125
125
  failHandle(result, fail, complete)
126
+ setSelectedIndex(null)
127
+ }
128
+ const startHandle = function (index) {
129
+ setSelectedIndex(index)
126
130
  }
127
131
  return (
128
132
  <View style={styles.actionAction}>
@@ -131,12 +135,16 @@ function ActionSheet ({itemColor, height, success, fail, complete, alertText, it
131
135
  </Animated.View>
132
136
  <Animated.View style={[styles.actionSheetContent, actionAnimatedStyles]}>
133
137
  { alertText ? <View style={ styles.itemStyle }><Text style={[styles.itemTextStyle, { color: '#666666' }]}>{alertText}</Text></View> : null }
134
- { itemList.map((item, index) => <View onTouchEnd={() => selectAction(index)} key={index} style={ [styles.itemStyle, itemList.length -1 === index ? {
138
+ { itemList.map((item, index) => <View onTouchStart={() => startHandle(index)} onTouchEnd={() => selectAction(index)} key={index} style={ [styles.itemStyle, itemList.length -1 === index ? {
135
139
  borderBottomWidth: 6,
136
140
  borderBottomStyle: 'solid',
137
141
  borderBottomColor: '#f7f7f7'
142
+ } : {}, selectedIndex === index ? {
143
+ backgroundColor: '#ececec'
138
144
  } : {}] }><Text style={[styles.itemTextStyle, { color: itemColor }]}>{item}</Text></View>) }
139
- <View style={styles.buttonStyle} onTouchEnd={cancelAction}><Text style={{ color: "#000000", fontSize: 18, lineHeight: 22, height: 22, width: "100%", textAlign: "center" }}>取消</Text></View>
145
+ <View style={[styles.buttonStyle, selectedIndex === -1 ? {
146
+ backgroundColor: '#ececec'
147
+ } : {}]} onTouchStart={() => startHandle(-1)} onTouchEnd={cancelAction}><Text style={{ color: "#000000", fontSize: 18, lineHeight: 22, height: 22, width: "100%", textAlign: "center" }}>取消</Text></View>
140
148
  </Animated.View>
141
149
  </View>
142
150
  )
@@ -68,20 +68,17 @@ class Animation {
68
68
  }
69
69
 
70
70
  rotate (angle) { // 旋转变换
71
- this.transform.set('rotate', `${angle}deg`)
71
+ this.rotateZ(angle)
72
72
  return this
73
73
  }
74
74
 
75
- rotate3d (x, y, z, angle) {
76
- if (typeof y !== 'number') {
77
- this.transform.set('rotate3d', x)
78
- } else {
79
- // this.transform.set('rotate3d', [x, y, z, angle])
80
- this.rotateX(x)
81
- this.rotateY(y)
82
- this.rotateZ(z)
83
- this.rotate(angle)
84
- }
75
+ rotate3d (...args) {
76
+ // this.transform.set('rotate3d', [x, y, z, angle])
77
+ // this.rotateX(x)
78
+ // this.rotateY(y)
79
+ // this.rotateZ(z)
80
+ // this.rotate(angle)
81
+ console.error('React Native 不支持 transform rotate3d')
85
82
  return this
86
83
  }
87
84
 
@@ -7,7 +7,7 @@ function setNavigationBarTitle (options = {}) {
7
7
  failHandle({ errMsg: 'setNavigationBarTitle:fail' }, fail, complete)
8
8
  } else {
9
9
  nextTick(() => {
10
- navigation.setOptions({ title })
10
+ navigation.setOptions({ title: title.trim() })
11
11
  successHandle({ errMsg: 'setNavigationBarTitle:ok' }, success, complete)
12
12
  })
13
13
  }