Я хотел добавить к своему приложению эффект Swipe-to-Delete , и я вручную установил response-native-жест-обработчик .С тех пор я получаю сообщение об ошибке ... Я уже пытался удалить установленный вручную обработчик жестов, но безуспешно.Любой совет?
Это код моего компонента, в котором я пытался протестировать обработчик жестов.С тех пор я получаю только красный экран с вышеупомянутым предупреждением и больше ничего не могу сделать.Извините, я новичок.
import React, { Component } from "react";
import {Image, StyleSheet, TouchableHighlight, View, Text} from "react-native";
import Swipeable from "react-native-gesture-handler/Swipeable";
renderLeftActions = (progress, dragX) => {
const trans = dragX.interpolate({
inputRange: [0, 50, 100, 101],
outputRange: [-20, 0, 0, 1]
});
return (
<RectButton style={styles.leftAction} onPress={this.close}>
<Animated.Text
style={[
styles.actionText,
{
transform: [{ translateX: trans }]
}
]}
/>
</RectButton>
);
};
getAllToppings = toppings => {
return toppings.map(topping => (
<Swipeable renderLeftActions={this.renderLeftActions}>
<Text style={styles.toppings}>{topping}</Text>
</Swipeable>
));
};
render() {
const menuDish = this.props.navigation.getParam('menuDish');
let toppings = [];
for (let key in menuDish.toppings) {
toppings.push(menuDish.toppings[key])
}
return(
<View style={{alignItems: 'center'}}>
<Image
source={{url: menuDish.image}}
style={styles.image}
/>
<Text style={styles.dishName}>{menuDish.name}</Text>
{this.getAllToppings(toppings)}
</View>
)
}