import {
FocusAwareStatusBar,
SafeAreaView,
ScrollView,
View,
} from '@/components/ui';
import * as React from 'react';
import {
Keyboard,
Text as RNText,
TextInput,
TouchableWithoutFeedback,
} from 'react-native';
import Button from '@/library/button';
import Label from '@/library/label';
import SocialButton from '@/library/social-button';
import TextField, { StatusConfig } from '@/library/textfield';
import TopNavigation from '@/library/top-navigation';
import Switch from '@/library/switch';
import { useSharedValue } from 'react-native-reanimated';
import CheckBox from '@/library/check-box';
import MainPageHeader from '@/library/main-page-header';
import SubPageHeader from '@/library/sub-page-header';
import Text from '@/library/text';
import IconButton from '@/library/icon-button';
import TestCircle from '@/library/icons/test-circle';
import { FullCircleIcon } from '@/library/icons/full-circle';
import { EmptyCircleIcon } from '@/library/icons/empty-circle';
import MenuItem from '@/library/menu-item';
import SearchBar from '@/library/search-bar';
import { LocationBlackShapeIcon } from '@/library/icons/location-black-shape';
import CommonModal from '@/library/popup-modal';
import showSnackBar, {
dismissLoadingSnackBar,
updateSnackBar,
} from '@/library/snack-bar';
import Check from '@/library/check';
import { ChevronDownIcon } from '@/library/icons/chevron-down';
const IconDummyComponent = () => {
return ;
};
const IconDummyComponent2 = () => {
return ;
};
export default function Paper() {
const [text, setText] = React.useState('');
const [passwordText, setPasswordText] = React.useState('');
const [passwordVisible, setPasswordVisible] = React.useState(true);
const [countText, setCountText] = React.useState('');
const [testToggle, setTestToggle] = React.useState(false);
const searchBarRef = React.useRef(null);
const [passwordStatusConfig, setPasswordStatusConfig] =
React.useState({
status: 'none',
message: '',
});
const [statusConfig, setStatusConfig] = React.useState({
status: 'none',
message: '',
});
interface IdState {
first: string;
second: string;
}
const [idValue, setIdValue] = React.useState({ first: '', second: '' });
const [idStatusConfig, setIdStatusConfig] = React.useState({
status: 'none',
message: '',
});
function handlePasswordChange(inputText: string) {
setPasswordText(inputText);
if (inputText.length >= 8) {
setPasswordStatusConfig({
status: 'success',
message: '유효한 비밀번호입니다.',
});
} else {
setPasswordStatusConfig({
status: 'error',
message: '비밀번호는 최소 8자 이상이어야 합니다.',
});
}
}
function handlePasswordClear() {
setPasswordText('');
setPasswordStatusConfig({
status: 'none',
message: '',
});
}
const handleIdChange = {
onFirstChange: (text: string) => {
setIdValue((prev) => ({
...prev,
first: text,
}));
validateId(text, idValue.second);
},
onSecondChange: (text: string) => {
setIdValue((prev) => ({
...prev,
second: text,
}));
validateId(idValue.first, text);
},
};
function validateId(first: string, second: string) {
// ID 유효성 검사: 앞 6자리, 뒤 1자리
if (first.length === 6 && second.length === 1) {
setIdStatusConfig({
status: 'success',
message: '유효한 주민등록번호입니다.',
});
} else {
setIdStatusConfig({
status: 'error',
message: '앞 6자리와 뒤 1자리를 입력해야 합니다.',
});
}
}
function handleClear() {
setIdValue({ first: '', second: '' });
setIdStatusConfig({
status: 'none',
message: '',
});
}
const handleCustomValidation = (text: string) => {
if (text.length <= 10 && /^[a-zA-Z]*$/.test(text)) {
// 예: 10자 이하, 알파벳만 허용
setCountText(text);
}
};
// Top Navigation
const TestComponent = () => {
return ;
};
const [activeTab, setActiveTab] = React.useState('테스트');
// Switch
const isOn = useSharedValue(true);
const handlePress = () => {
isOn.value = !isOn.value;
setTestToggle((prev) => !prev);
console.log(isOn.value);
};
// checkbox
const [checked, setChecked] = React.useState(true);
const handleTextChange = (inputText: string) => {
setText(inputText);
if (inputText.length < 3) {
setStatusConfig({
status: 'error',
message: '에러 메시지 표기',
});
} else {
// 상황에 따라 성공 표기를 하고싶지 않다면, status는 'none'으로 설정, message는 ''로 설정
setStatusConfig({
status: 'success',
message: '성공 메시지 표기',
});
}
};
const [searchText, setSearchText] = React.useState('');
const handleSearch = () => {
console.log(searchText, 'submit');
};
const [isVisible, setIsVisible] = React.useState(false);
const [loading, setLoading] = React.useState(false);
const [isChecked, setIsChecked] = React.useState(false);
return (
}
onPress={() => {
console.log('CLICK');
searchBarRef.current?.blur();
}}
/>,
]}
/>
{/* console.log('exit')}
exitIcon={}
funcComponent={[
}
onPress={() => console.log('CLICK1')}
/>,
}
onPress={() => console.log('CLICK2')}
/>,
}
onPress={() => console.log('CLICK3')}
/>,
]}
/> */}
{activeTab === '테스트' && (
{'텍스트'}
{/* 정적 라벨 */}
}
idleIcon={}
menuTitle={'타이틀'}
selected={testToggle}
badge={{ variant: 'dot' }}
/>
Display small
Display medium
Display large
Display xlarge
{/* 카운팅 라벨 */}
{
console.log(!checked ? 'checked' : 'unchecked');
setChecked(!checked);
}}
/>
paragraph 2xlarge
??????
{/* text-Prime Text 10
text-Prime Text 12
text-Prime Text 14
text-Prime Text 16
text-Prime Text 20
text-Prime Text 24
text-Prime Text 32
text-prime-paragraph-13
text-prime-paragraph-14
text-prime-paragraph-15
text-prime-paragraph-16
text-prime-paragraph-18
*/}
)}
{activeTab === '테스트2' && (
<>
setSearchText('')}
onSubmit={handleSearch}
placeholder={'검색어를 입력해주세요.'}
onFocus={() => console.log('focus')}
onBlur={() => console.log('blur')}
blurIcon={false ? : null}
/>
{
setText('');
setStatusConfig({
status: 'none',
message: '',
});
}}
onChangeText={handleTextChange}
/>
setIsVisible(false)}
onConfirm={() => console.log('confirm')}
cancelButton={{
text: '취소',
variant: 'danger',
shape: 'pill',
className: 'flex-1',
}}
confirmButton={{
text: '확인',
variant: 'dangerLow',
shape: 'pill',
className: 'flex-1',
}}
/>
{/* setIsVisible(false)}
/> */}
,
gap: 4,
}}
// backgroundColor={'brand-primary-default'}
// textColor={'blue'}
// onPress={() => setIsVisible(true)}
onPress={() => {
setLoading(false);
}}
/>
);
}