인프런 커뮤니티 질문&답변
ActionSheet
작성
·
12
0
ellipsis-vertical 클릭시
강의와 같이 실제 아이폰 actionsheet 처럼 보이지 않고 다른 style이 입혀진듯하게 보이고있습니다.
에러코드는 없습니다.
노드 : 20.19.6
시뮬레이터 : iOS 26.2
ReactNative : 0.81.5

작업중인 시뮬레이터 화면

강의 시뮬레이터 화면
import { colors } from "@/constants";
import useAuth from "@/hooks/queries/useAuth";
import type { Post } from "@/types";
import { useActionSheet } from "@expo/react-native-action-sheet";
import { Ionicons, MaterialCommunityIcons, Octicons } from "@expo/vector-icons";
import React from "react";
import { Pressable, StyleSheet, Text, View } from "react-native";
import Profile from "./Profile";
interface FeedItemProps {
post: Post;
}
function FeedItem({ post }: FeedItemProps) {
const { auth } = useAuth();
const likeUsers = post.likes?.map((like) => Number(like.userId));
const isLiked = likeUsers?.includes(Number(auth.id));
const { showActionSheetWithOptions } = useActionSheet();
const handlePressOption = () => {
const options = ["삭제", "수정", "취소"];
showActionSheetWithOptions({ options }, (selectedIndex?: number) => {
console.log("selectedIndex", selectedIndex);
switch (selectedIndex) {
case 0: //삭제
break;
case 1: //수정
break;
case 2:
break;
default:
break;
}
});
};
return (
<View style={styles.container}>
<View style={styles.contentContainer}>
<Profile
imageUri={post.author.imageUri}
nickname={post.author.nickname}
createdAt={post.createdAt}
onPress={() => {}}
option={
auth.id === post.author.id && (
<Ionicons
name="ellipsis-vertical"
size={24}
color={colors.BLACK}
onPress={handlePressOption}
/>
)
}
/>
<Text style={styles.title}>{post.title}</Text>
{/* numberOfLines 게시글 내용 3줄까지만 보이게 */}
<Text numberOfLines={3} style={styles.description}>
{post.description}
</Text>
</View>
<View style={styles.menuContainer}>
<Pressable style={styles.menu}>
<Octicons
name={isLiked ? "heart-fill" : "heart"}
size={16}
color={isLiked ? colors.ORANGE_600 : colors.BLACK}
/>
<Text style={isLiked ? styles.activeMenuText : styles.menuText}>
{post.likes.length || "좋아요"}
</Text>
</Pressable>
<Pressable style={styles.menu}>
<MaterialCommunityIcons
name="comment-processing-outline"
size={16}
color={colors.BLACK}
/>
<Text style={styles.menuText}>{post.commentCount || "댓글"}</Text>
</Pressable>
<Pressable style={styles.menu}>
<Ionicons name="eye-outline" size={16} color={colors.BLACK} />
<Text style={styles.menuText}>{post.viewCount}</Text>
</Pressable>
</View>
</View>
);
}
const styles = StyleSheet.create({
container: {
backgroundColor: colors.WHITE,
},
contentContainer: {
padding: 16,
},
menuContainer: {
flexDirection: "row",
alignItems: "center",
justifyContent: "space-around",
borderTopColor: colors.GRAY_300,
borderTopWidth: StyleSheet.hairlineWidth,
},
title: {
fontSize: 18,
color: colors.BLACK,
fontWeight: "600",
marginVertical: 8,
},
description: {
fontSize: 16,
color: colors.BLACK,
marginBottom: 14,
},
menu: {
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
paddingVertical: 16,
width: "33%",
gap: 4,
},
menuText: {
fontSize: 14,
color: colors.GRAY_700,
},
activeMenuText: {
fontWeight: "500",
color: colors.ORANGE_600,
},
});
export default FeedItem;
import queryClient from "@/api/queryClient";
import useAuth from "@/hooks/queries/useAuth";
import { ActionSheetProvider } from "@expo/react-native-action-sheet";
import { QueryClientProvider } from "@tanstack/react-query";
import { Stack } from "expo-router";
import { useEffect } from "react";
import "react-native-reanimated";
import Toast from "react-native-toast-message";
export const unstable_settings = {
anchor: "(tabs)",
};
export default function RootLayout() {
return (
<ActionSheetProvider>
<QueryClientProvider client={queryClient}>
<RootNavigator />
<Toast />
</QueryClientProvider>
</ActionSheetProvider>
);
}
function RootNavigator() {
const { auth } = useAuth();
useEffect(() => {
auth.id &&
Toast.show({
type: "success",
text1: `${auth.nickname ?? "회원"}님 환영합니다!`,
});
}, [auth.id]);
return (
<Stack>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
<Stack.Screen name="auth" options={{ headerShown: false }} />
<Stack.Screen name="post" options={{ headerShown: false }} />
<Stack.Screen
name="modal"
options={{ presentation: "modal", title: "Modal" }}
/>
</Stack>
);
}






답변 감사합니다!