Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] #312 문의내역 줄바꿈 확인 후 ... 표시 #313

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/components/setting/HelpHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,22 @@ const HelpHistory = () => {
return buttons;
};

// 문의 내용 텍스트 처리(줄바꿈 및 길이 확인)
const getContentText = (content: string) => {
if (!content) return '내용이 없습니다.';

const firstLine = content.split('\n')[0];
if (firstLine.length > 20) {
return `${firstLine.substring(0, 28)}...`;
} else if (content.includes('\n')) {
return `${firstLine}...`;
} else if (content.length > 20) {
return `${content.substring(0, 28)}...`;
}

return content;
};

return (
<View style={{flex: 1}}>
<ScrollView style={[commonStyle.CONTAINER, {paddingVertical: 0}]}>
Expand Down Expand Up @@ -150,9 +166,7 @@ const HelpHistory = () => {
</TouchableOpacity>
</View>
<Text style={commonStyle.REGULAR_33_14}>
{item.contents && item.contents.length > 20
? `${item.contents.substring(0, 28)}...`
: item.contents || '내용이 없습니다.'}
{getContentText(item.contents)}
</Text>
<View style={styles.itemAnswer}>
<Text style={commonStyle.REGULAR_77_14}>
Expand Down