feat: 앱 위치로 지역 찾기(expo-location), 게시물·주말 일정 이미지 공유(view-shot·expo-sharing)

This commit is contained in:
minaChoi committed 2026-10-14 14:49:37 +09:00
1 parent f71dd2cebb
commit 26bb6a00d2
10 files changed
+231 -31

No files matched your search

+18 -3
View File
@@ -1,7 +1,7 @@
import { listRegionsOptions } from '@nalssigak/shared/api/client/@tanstack/react-query.gen';
import { loadOf } from '@nalssigak/shared/lib';
import { useQuery } from '@tanstack/react-query';
import { useDeferredValue, useState } from 'react';
import { useDeferredValue, useEffect, useRef, useState } from 'react';
import { Pressable, Text, View } from 'react-native';
import { Skel, StateBox } from '@/components/ui';
@@ -11,6 +11,8 @@ import { useSheet } from '@/lib/sheet';
import { Body, Field } from './parts';
const LOCATE_TEXT = { idle: '', locating: '위치를 찾는 중이에요…', denied: '위치 권한이 꺼져 있어요. 아래 목록에서 골라 주세요.', error: '위치를 찾지 못했어요. 아래 목록에서 골라 주세요.' } as const;
const N14 = Array.from({ length: 14 }, (_, i) => i);
function RegionsSkel() {
@@ -25,9 +27,16 @@ function RegionsSkel() {
);
}
/** 지역 바꾸기: 구 이름으로 찾기 + 목록 */
/** 지역 바꾸기: 지금 위치로 찾기 + 구 이름으로 찾기 + 목록 */
export function RegionSheet({ onDone }: { onDone: () => void }) {
const { region, setRegion } = useRegion();
const { region, setRegion, locate, locateStatus } = useRegion();
const alive = useRef(true);
useEffect(() => {
alive.current = true;
return () => {
alive.current = false;
};
}, []);
const { me, logout } = useAuth();
const { open } = useSheet();
const [q, setQ] = useState('');
@@ -38,6 +47,12 @@ export function RegionSheet({ onDone }: { onDone: () => void }) {
return (
<Body>
<Pressable onPress={() => locate(() => alive.current && onDone())} disabled={locateStatus === 'locating'} className="items-center rounded-full border-b-[5px] border-orange-deep bg-orange p-3 disabled:opacity-60">
<Text className="font-jua text-[17px] text-white">지금 위치로 찾기</Text>
</Pressable>
<Text className="mt-2 min-h-5 text-center text-[13px] font-bold text-ink2" accessibilityLiveRegion="polite">
{LOCATE_TEXT[locateStatus]}
</Text>
<Field round value={q} onChangeText={setQ} placeholder="구 이름으로 찾기 (예: 마포)" accessibilityLabel="구 이름으로 찾기" />
{listLoad === 'loading' && <RegionsSkel />}
{listLoad !== 'loading' && !regions.length && <StateBox load={listLoad} onRetry={() => list.refetch()} empty="찾는 구가 없어요." />}