import React, { useEffect, useState } from "react"; import { View, Text, TouchableOpacity, ScrollView, Animated, } from "react-native"; // const commonEmojis10 = [ // "😂", // "❤️", // "🤣", // "😍", // "🙏", // "🥰", // "😊", // "😭", // "👍", // "😅", // ]; const commonEmojis15 = [ "😂", "❤️", "🤣", "😍", "🙏", "🥰", "😊", "😭", "👍", "😅", "😢", "👏", "💕", "🥺", "😘", ]; // const commonEmojis20 = [ // "😂", // "❤️", // "🤣", // "😍", // "🙏", // "🥰", // "😊", // "😭", // "👍", // "😅", // "😢", // "👏", // "💕", // "🥺", // "😘", // "🤔", // "🤗", // "🙌", // "😎", // "✨", // ]; interface EmojiSuggestionsProps { onEmojiClick: (emoji: string) => void; } const EmojiSuggestions: React.FC = ({ onEmojiClick, }) => { const [clickedEmoji, setClickedEmoji] = useState(null); const [scaleAnim] = useState(new Animated.Value(1)); const [emojiSubset, setEmojiSubset] = useState([]); useEffect(() => { // Pick 8 random emojis from the array const shuffled = [...commonEmojis15].sort(() => 0.5 - Math.random()); setEmojiSubset(shuffled.slice(0, 8)); }, []); const handleEmojiClick = (emoji: string) => { setClickedEmoji(emoji); // Shrink animation Animated.sequence([ Animated.timing(scaleAnim, { toValue: 0.8, duration: 100, useNativeDriver: true, }), Animated.timing(scaleAnim, { toValue: 1, duration: 100, useNativeDriver: true, }), ]).start(() => { setClickedEmoji(null); }); onEmojiClick(emoji); }; return ( {emojiSubset.map((emoji) => ( handleEmojiClick(emoji)} activeOpacity={0.7} > {emoji} ))} ); }; export default EmojiSuggestions;