import React from 'react'; import { Animated, View, Text } from 'react-native'; import { RectButton } from 'react-native-gesture-handler'; import PropTypes from 'prop-types'; import I18n from '../../i18n'; import styles, { ACTION_WIDTH, LONG_SWIPE } from './styles'; import { CustomIcon } from '../../lib/Icons'; import { themes } from '../../constants/colors'; const reverse = new Animated.Value(I18n.isRTL ? -1 : 1); export const LeftActions = React.memo(({ theme, transX, isRead, width, onToggleReadPress }) => { const translateX = Animated.multiply( transX.interpolate({ inputRange: [0, ACTION_WIDTH], outputRange: [-ACTION_WIDTH, 0] }), reverse ); return ( <> {I18n.t(isRead ? 'Unread' : 'Read')} ); }); export const RightActions = React.memo(({ transX, favorite, width, toggleFav, onHidePress, theme }) => { const translateXFav = Animated.multiply( transX.interpolate({ inputRange: [-width / 2, -ACTION_WIDTH * 2, 0], outputRange: [width / 2, width - ACTION_WIDTH * 2, width] }), reverse ); const translateXHide = Animated.multiply( transX.interpolate({ inputRange: [-width, -LONG_SWIPE, -ACTION_WIDTH * 2, 0], outputRange: [0, width - LONG_SWIPE, width - ACTION_WIDTH, width] }), reverse ); return ( <> {I18n.t(favorite ? 'Unfavorite' : 'Favorite')} <> {I18n.t('Hide')} ); }); LeftActions.propTypes = { theme: PropTypes.string, transX: PropTypes.object, isRead: PropTypes.bool, width: PropTypes.number, onToggleReadPress: PropTypes.func }; RightActions.propTypes = { theme: PropTypes.string, transX: PropTypes.object, favorite: PropTypes.bool, width: PropTypes.number, toggleFav: PropTypes.func, onHidePress: PropTypes.func };