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

+14 -11
View File
@@ -3,7 +3,7 @@ import { PostType, type PostData, type ResFeed } from '@nalssigak/shared/api/cli
import { useMutation, useQueryClient, type QueryClient } from '@tanstack/react-query';
import { LinearGradient } from 'expo-linear-gradient';
import { useEffect, useRef, useState } from 'react';
import { Animated, Pressable, Share, Text, View } from 'react-native';
import { Animated, Pressable, Text, View } from 'react-native';
import Svg, { Path } from 'react-native-svg';
import { useCSSVariable } from 'uniwind';
@@ -13,6 +13,7 @@ import { slideBg, SlideView } from '@/components/post/slides';
import { Ic, Skel } from '@/components/ui';
import { useAuth } from '@/lib/auth';
import { useSheet } from '@/lib/sheet';
import { shareView } from '@/lib/share-image';
import { SITE_URL } from '@/lib/site';
const ACCOUNTS: Record<PostType, readonly [string, string]> = {
@@ -125,9 +126,9 @@ function FullCard({ post }: PostProps) {
const n = post.slides.length;
const patch = (values: Partial<PostData>) => patchFeed(queryClient, post.post_id, values);
const comments = () => open({ type: 'comments', postId: post.post_id });
const share = () => {
Share.share({ message: `${post.title} · 날씨각 ${SITE_URL}` }).catch((e: unknown) => console.warn('공유 실패', e));
};
const shot = useRef<View>(null);
// 지금 보고 있는 슬라이드를 이미지로
const share = () => void shareView(shot, { title: post.title, message: `${post.title} · 날씨각 ${SITE_URL}` });
useEffect(() => {
if (!likeFailed) return;
@@ -179,13 +180,15 @@ function FullCard({ post }: PostProps) {
</View>
</View>
<Pressable onPress={onTap} onLayout={(e) => setWidth(e.nativeEvent.layout.width)} className="aspect-[4/5] overflow-hidden" accessibilityLabel={n > 1 ? `슬라이드 ${n}장, 옆으로 넘겨 보세요` : undefined}>
{width > 0 && (
<Pager width={width} height={(width * 5) / 4} onIndex={setIndex}>
{post.slides.map((s, i) => (
<SlideView key={i} slide={s} bg={slideBg(post, s)} />
))}
</Pager>
)}
<View ref={shot} collapsable={false}>
{width > 0 && (
<Pager width={width} height={(width * 5) / 4} onIndex={setIndex}>
{post.slides.map((s, i) => (
<SlideView key={i} slide={s} bg={slideBg(post, s)} />
))}
</Pager>
)}
</View>
{n > 1 && (
<View pointerEvents="none" className="absolute top-3 right-3 z-[2] rounded-full bg-[rgb(30_36_56/0.55)] px-[9px] py-[3px]">
<Text className="text-xs font-extrabold text-white">