import React from "react"; import { useState } from "react"; import { Alert, ImageBackground, Text, TouchableOpacity, View, StyleSheet, } from "react-native"; import { heightPercentageToDP, widthPercentageToDP, } from "react-native-responsive-screen"; import colors from "res/colors"; import images from "res/images"; import { fetchExtraDataforNestedItemsViaFolderId } from "../apis"; import { isLandscapeMode, isTablet } from "../utils/DimensionUtils"; import { StringShortener } from "../utils/textOrImageUtils"; interface Props { data: {}; onClickSucess: () => void; } const PracticeSetItem: React.FC = (props) => { const { data, onClickSucess } = props; //const [nestData, setnestData] = React.useState([]); const abbreviateName = (name: string) => { const words = name.split(" "); let abbreviation = ""; if (words.length === 1) { const word = words[0]; if (word.length > 1) { abbreviation = words[0].substring(0, 2); } else { abbreviation = word; } } else { abbreviation = words[0].charAt(0) + words[1].charAt(0); } return abbreviation; }; const StringShortener1 = (str: string) => { if (isTablet() ? str.length > 15 : str.length > 8) { return isTablet() ? str.substring(0, 15) + "..." : str.substring(0, 8) + "..."; } else return str; }; return ( {/* change */} {abbreviateName(data.name)} {/* style={[styles.slideImageContainer, { marginLeft: 22 }]} */} {StringShortener1(data.name)} ); }; export default PracticeSetItem; const styles = StyleSheet.create({ practiceSetButton: { fontFamily: "Montserrat-Medium", fontWeight: "500", alignItems: "center", textAlign: "center", backgroundColor: "#C00ADC", overflow: "hidden", color: colors.home.textDark, fontSize: isLandscapeMode() ? heightPercentageToDP(5.5) : widthPercentageToDP(5.5), width: isLandscapeMode() ? heightPercentageToDP(13) : widthPercentageToDP(13), height: isLandscapeMode() ? heightPercentageToDP(10.5) : widthPercentageToDP(10.5), // borderRadius: 5.5, paddingTop: isLandscapeMode() ? heightPercentageToDP(13 / 4) : widthPercentageToDP(13 / 4), textTransform: "uppercase", }, PracticeBtnSubContainer: {}, CircleShape: { width: isTablet() ? 12 : 6, height: isTablet() ? 12 : 6, borderRadius: isTablet() ? 6 : 3, // backgroundColor: "#FF9800", }, });