Skip to content

Commit

Permalink
合并
Browse files Browse the repository at this point in the history
  • Loading branch information
wangcuijuan committed Dec 24, 2024
2 parents e88babe + f2abc48 commit 284f5f1
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions packages/api-proxy/src/platform/api/action-sheet/rnActionSheet.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { View, TouchableHighlight, Text, StyleSheet, TouchableOpacity } from 'react-native'
import { View, Text, StyleSheet } from 'react-native'
import { successHandle, failHandle } from '../../../common/js'
import { Portal } from '@ant-design/react-native'
import { getWindowInfo } from '../system/rnSystem'
Expand Down Expand Up @@ -64,7 +64,8 @@ function showActionSheet (options = {}) {

offset.value = withTiming(0)

const selectAction = function (index) {
const selectAction = function (index, e) {
e.stopPropagation()
const result = {
errMsg: 'showActionSheet:ok',
tapIndex: index
Expand All @@ -83,26 +84,26 @@ function showActionSheet (options = {}) {
}
}

const cancelAction = function () {
const cancelAction = function (e) {
e.stopPropagation()
const result = {
errMsg: 'showActionSheet:fail cancel'
}
failHandle(result, fail, complete)
remove()
}
return (
<TouchableHighlight underlayColor="rgba(0,0,0,0.6)" activeOpacity={1} onPress={cancelAction} style={styles.actionActionMask}>
{/* pointerEvents="none" 解决安卓下选项需要点两次被触发的问题 */}
<Animated.View style={[styles.actionSheetContent, animatedStyles]} pointerEvents="none">
<View onTouchEnd={cancelAction} style={styles.actionActionMask}>
<Animated.View style={[styles.actionSheetContent, animatedStyles]}>
{ alertText ? <View style={ styles.itemStyle }><Text style={[styles.itemTextStyle, { color: '#666666' }]}>{alertText}</Text></View> : null }
{ itemList.map((item, index) => <TouchableHighlight key={index} underlayColor="#ececec" onPress={() => selectAction(index)} style={ [styles.itemStyle, itemList.length -1 === index ? {
{ itemList.map((item, index) => <View key={index} onTouchEnd={(e) => selectAction(index, e)} style={ [styles.itemStyle, itemList.length -1 === index ? {
borderBottomWidth: 6,
borderBottomStyle: 'solid',
borderBottomColor: '#f7f7f7'
} : {}] }><Text style={[styles.itemTextStyle, { color: itemColor }]}>{item}</Text></TouchableHighlight>) }
<View style={styles.buttonStyle}><TouchableOpacity onPress={cancelAction}><Text style={{ color: "#000000", width: "100%", textAlign: "center" }}>取消</Text></TouchableOpacity></View>
} : {}] }><Text style={[styles.itemTextStyle, { color: itemColor }]}>{item}</Text></View>) }
<View style={styles.buttonStyle} onTouchEnd={cancelAction}><Text style={{ color: "#000000", width: "100%", textAlign: "center" }}>取消</Text></View>
</Animated.View>
</TouchableHighlight>
</View>
)
}

Expand Down

0 comments on commit 284f5f1

Please sign in to comment.