Skip to content

Commit 26f5b7a

Browse files
committed
2 parents 4671369 + ac9151b commit 26f5b7a

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

src/components/Wrapper.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,21 @@ interface Props {
77
children: React.ReactNode;
88
}
99

10-
export const Wrapper: React.FC<Props> = (props) => (
11-
<>
12-
<Header />
10+
export const Wrapper: React.FC<Props> = (props) => {
11+
const isWebView = typeof (window as any).ReactNativeWebView !== "undefined";
12+
const showHeader = !(isWebView && window.location.pathname === "/profile");
1313

14-
<Box sx={{ width: "100%" }}>
15-
<div id="appBarSpacer"></div>
16-
{props.children}
17-
</Box>
18-
</>
19-
);
14+
return (
15+
<>
16+
{showHeader && <Header />}
17+
18+
<Box sx={{ width: "100%" }}>
19+
{showHeader && <div id="appBarSpacer"></div>}
20+
{props.children}
21+
</Box>
22+
</>
23+
);
24+
};
2025
/*
2126
const [donationError, setDonationError] = React.useState<boolean>(false);
2227
const [isFormMember, setIsFormMember] = React.useState<boolean>(false);

src/profile/ProfilePage.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ export const ProfilePage = () => {
3636
}
3737
}, []);
3838

39+
const sendEventToReactNative = (eventName: string, data?: any) => {
40+
if ((window as any).ReactNativeWebView) {
41+
(window as any).ReactNativeWebView.postMessage(JSON.stringify({ event: eventName, data }));
42+
}
43+
};
44+
3945
const updateProfileMutation = useMutation({
4046
mutationFn: async () => {
4147
const promises: Promise<any>[] = [];
@@ -73,6 +79,7 @@ export const ProfilePage = () => {
7379
setSaveMessage(Locale.label("profile.profilePage.saveChange"));
7480
setPassword("");
7581
setPasswordVerify("");
82+
sendEventToReactNative("profile_updated");
7683
},
7784
onError: (error) => {
7885
console.error("Error saving profile:", error);
@@ -83,6 +90,7 @@ export const ProfilePage = () => {
8390
const deleteAccountMutation = useMutation({
8491
mutationFn: () => ApiHelper.delete("/users", "MembershipApi"),
8592
onSuccess: () => {
93+
sendEventToReactNative("profile_deleted");
8694
navigate("/logout", { replace: true });
8795
},
8896
});

0 commit comments

Comments
 (0)