Skip to content

Commit

Permalink
fix: 웹뷰 snap 뒤로가기 이벤트에 대해 title, url 초기화 되지 않던 오류 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ww8007 committed Jul 24, 2023
1 parent 7381a59 commit 687f602
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/RNListener.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import useAuthStore from '@/store/auth';
import useBridgeCallback from './common/service/hooks/useBridgeCallback';
import { useGETUserProfile } from './auth/api/profile';
import { useEffect } from 'react';
import useBookmarkStore from './store/bookmark';

declare global {
interface Window {
Expand All @@ -14,6 +15,7 @@ declare global {

const RNListener = () => {
const { memberId, login } = useAuthStore();
const { setUrl, setTitle } = useBookmarkStore();

useEffect(() => {
if (window.ReactNativeWebView) {
Expand All @@ -27,6 +29,10 @@ const RNListener = () => {
login({ token: params.token, memberId: params.memberId });
}
}
if (message === 'initialize') {
setUrl('');
setTitle('');
}
});

useGETUserProfile({ loginId: memberId });
Expand Down
2 changes: 2 additions & 0 deletions src/common/service/hooks/useBridgeCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ interface BridgeParams {
token: string;
memberId: number;
};
/** snap 초기화 */
initialize: null;
}

function useBridgeCallback<T extends keyof BridgeParams>(
Expand Down

1 comment on commit 687f602

@vercel
Copy link

@vercel vercel bot commented on 687f602 Jul 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.