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: 가게 이름을 헤더에 표시 #66

Merged
merged 1 commit into from
Oct 29, 2024
Merged
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
8 changes: 7 additions & 1 deletion src/screens/MarketDetailScreen/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import MarketDetailPage from './MarketDetailPage';

type Props = StackScreenProps<DetailStackParamList, 'Market'>;

const MarketDetailScreen = ({route}: Props) => {
const MarketDetailScreen = ({navigation, route}: Props) => {
const [marketDetail, setMarketDetail] = useState<MarketType | null>(null);

useEffect(() => {
Expand All @@ -28,6 +28,12 @@ const MarketDetailScreen = ({route}: Props) => {
fetchMarketDetail();
}, [route.params.marketId]);

useEffect(() => {
navigation.setOptions({
title: marketDetail?.name ?? '가게 정보',
});
}, [marketDetail?.name, navigation]);

if (!marketDetail) {
return <Text>가게 상세정보를 불러오는데 실패했습니다.</Text>;
}
Expand Down
Loading