【发布时间】:2021-12-26 13:37:30
【问题描述】:
我的反应本机手势不起作用我的代码 我已经用这个命令安装了库
$ expo install react-native-gesture-handler
请帮我解决这个问题: 我该如何解决这个问题
代码:
import React from 'react'
import { Image, StyleSheet, TouchableHighlight, View } from
'react-native'
import Colors from '../config/Colors.js'
import AppText from './AppText/AppText.js'
import Swipeable from 'react-native-gesture-handler/Swipeable';
const HorizontalListitem = ({ image, title, subtitle, onPress,
style, renderRightActions }) => {
return (
<Swipeable renderRightActions={() => (
<View style={{ width: 80, height: 100, backgroundColor: 'red'
}}></View>
)}>
<TouchableHighlight
underlayColor={Colors.lightgray}
onPress={onPress}
style={style}
>
<View style={styles.listContainer}>
<Image style={styles.image} source={{ uri: image }}>
</Image>
<View style={styles.title}>
<AppText style={{ fontWeight: 'bold' }}>{title}
</AppText>
<AppText style={styles.subtitle}>{subtitle}</AppText>
</View>
</View>
</TouchableHighlight>
</Swipeable >
)
}
【问题讨论】:
-
您需要在您的问题上付出更多努力。具体是什么问题?你期望发生什么与正在发生什么?你有什么试图解决你的问题。转储代码并说它不起作用不会在这个论坛中为您提供太多帮助。
标签: reactjs react-native