UNPKG

@oxyhq/services

Version:

OxyHQ Expo/React Native SDK — UI components, screens, and native features

50 lines (49 loc) 1.47 kB
"use strict"; import React, { useEffect, useRef } from 'react'; import { TouchableOpacity, Animated, Easing } from 'react-native'; // @ts-ignore - MaterialCommunityIcons is available at runtime import { MaterialCommunityIcons } from '@expo/vector-icons'; import { jsx as _jsx } from "react/jsx-runtime"; /** * Animated button component for smooth selection transitions * Used in file management views for view mode toggles */ export const AnimatedButton = ({ isSelected, onPress, icon, primaryColor, textColor, style }) => { const animatedValue = useRef(new Animated.Value(isSelected ? 1 : 0)).current; useEffect(() => { Animated.timing(animatedValue, { toValue: isSelected ? 1 : 0, duration: 200, easing: Easing.out(Easing.ease), useNativeDriver: false }).start(); }, [isSelected, animatedValue]); const backgroundColor = animatedValue.interpolate({ inputRange: [0, 1], outputRange: ['transparent', primaryColor] }); return /*#__PURE__*/_jsx(TouchableOpacity, { onPress: onPress, activeOpacity: 0.7, children: /*#__PURE__*/_jsx(Animated.View, { style: [style, { backgroundColor }], children: /*#__PURE__*/_jsx(Animated.View, { children: /*#__PURE__*/_jsx(MaterialCommunityIcons, { name: icon, size: 16, color: isSelected ? '#FFFFFF' : textColor }) }) }) }); }; //# sourceMappingURL=AnimatedButton.js.map