// @ts-nocheck
import React, { Component } from 'react';
import { Animated, StyleSheet, Text, View } from 'react-native';
import { RectButton } from 'react-native-gesture-handler';
import Swipeable from 'react-native-gesture-handler/Swipeable';
export default class AppleStyleSwipeableRow extends Component {
_swipeableRow?: Swipeable;
renderLeftActions = (progress: Animated.Value, dragX: Animated.Value) => {
const trans = dragX.interpolate({
inputRange: [0, 50, 100, 101],
outputRange: [-20, 0, 0, 1],
});
return (
Archive
);
};
renderRightAction = (text: string, color: string, x: number, progress: Animated.Value) => {
const trans = progress.interpolate({
inputRange: [0, 1],
outputRange: [x, 0],
});
const pressHandler = () => {
this.close();
alert(text);
};
return (
{text}
);
};
renderRightActions = (progress: Animated.Value) => (
{this.renderRightAction('More', '#C8C7CD', 192, progress)}
{this.renderRightAction('Flag', '#ffab00', 128, progress)}
{this.renderRightAction('More', '#dd2c00', 64, progress)}
);
updateRef = (ref: Swipeable) => {
this._swipeableRow = ref;
};
close = () => {
this._swipeableRow!.close();
};
render() {
const { children } = this.props;
return (
{children}
);
}
}
const styles = StyleSheet.create({
leftAction: {
flex: 1,
backgroundColor: '#497AFC',
justifyContent: 'center',
},
actionText: {
color: 'white',
fontSize: 16,
backgroundColor: 'transparent',
padding: 10,
},
rightAction: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
},
});