// @ts-nocheck
import MaterialIcons from '@expo/vector-icons/build/MaterialIcons';
import React, { Component } from 'react';
import { Animated, StyleSheet } from 'react-native';
import { RectButton } from 'react-native-gesture-handler';
import Swipeable from 'react-native-gesture-handler/Swipeable';
const AnimatedIcon = Animated.createAnimatedComponent(MaterialIcons);
export default class AppleStyleSwipeableRow extends Component {
_swipeableRow?: Swipeable;
renderLeftActions = (progress: Animated.Value, dragX: Animated.Value) => {
const scale = dragX.interpolate({
inputRange: [0, 80],
outputRange: [0, 1],
extrapolate: 'clamp',
});
return (
);
};
renderRightActions = (progress: Animated.Value, dragX: Animated.Value) => {
const scale = dragX.interpolate({
inputRange: [-80, 0],
outputRange: [1, 0],
extrapolate: 'clamp',
});
return (
);
};
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: '#388e3c',
justifyContent: 'center',
},
actionIcon: {
width: 30,
marginHorizontal: 10,
},
rightAction: {
alignItems: 'flex-end',
backgroundColor: '#dd2c00',
flex: 1,
justifyContent: 'center',
},
});