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: 하단 바에 햅틱 피드백을 적용한다 #334

Merged
merged 2 commits into from
Dec 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions src/components/BottomNav/BottomNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import RankingIcon from '@assets/icon/ranking.svg?react';
import RouterLink from '@components/RouterLink/RouterLink';

import PATH from '@constants/path.constant';
import { HapticFeedback } from '@pages/games/SnackGame/game/util/hapticFeedback';

export const BottomNav = () => {
const location = useLocation().pathname;

0chil marked this conversation as resolved.
Show resolved Hide resolved

return (
<div className="fixed bottom-0 z-bottomNav flex w-full justify-center">
Expand All @@ -17,6 +19,7 @@ export const BottomNav = () => {
to={PATH.SNACK_GAME}
className={'flex-col items-center justify-between'}
isActivated={location == PATH.SNACK_GAME}
onClick={HapticFeedback.invokeImpactLight}
>
<GameIcon className={'h-6 w-6'} />
<span>게임</span>
Expand All @@ -25,6 +28,7 @@ export const BottomNav = () => {
to={PATH.SNACK_GAME_RANKING}
className={'flex-col items-center justify-between'}
isActivated={location == PATH.SNACK_GAME_RANKING}
onClick={HapticFeedback.invokeImpactLight}
>
<RankingIcon className={'h-6 w-6'} />
<span>랭킹</span>
Expand All @@ -33,6 +37,7 @@ export const BottomNav = () => {
to={PATH.USER}
className={'flex-col items-center justify-between'}
isActivated={location == PATH.USER}
onClick={HapticFeedback.invokeImpactLight}
>
<ProfileIcon className={'h-6 w-6'} />
<span>프로필</span>
Expand Down
8 changes: 8 additions & 0 deletions src/pages/games/SnackGame/game/util/hapticFeedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ export const HapticFeedback = {
}
));
},
async invokeImpactLight() {
window.ReactNativeWebView?.postMessage(JSON.stringify(
{
"type": "snackgame-haptic-feedback",
"method": "impactLight"
}
));
},
async invokeImpactMedium() {
window.ReactNativeWebView?.postMessage(JSON.stringify(
{
Expand Down
Loading