- Replace ViewWrapper/NewWrapper with NewWrapper_V2 in all Profile screens - Add enableKeyboardHandling to form screens (create, edit, detail-blocked) - Wrap all TextInput/SelectCustom with View onStartShouldSetResponder - Fix keyboard handling issues (footer lift, white area, input cutoff) - Migrate 7 Profile screens: create, edit, index, detail-blocked, blocked-list, update-photo, update-background Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
95 lines
2.5 KiB
TypeScript
95 lines
2.5 KiB
TypeScript
import {
|
|
AlertDefaultSystem,
|
|
AvatarUsernameAndOtherComponent,
|
|
BaseBox,
|
|
BoxButtonOnFooter,
|
|
BoxWithHeaderSection,
|
|
ButtonCustom,
|
|
NewWrapper_V2,
|
|
StackCustom,
|
|
TextCustom,
|
|
} from "@/components";
|
|
import AvatarAndBackground from "@/screens/Profile/AvatarAndBackground";
|
|
import {
|
|
apiGetBlockedById,
|
|
apiUnblock,
|
|
} from "@/service/api-client/api-blocked";
|
|
import { router, useLocalSearchParams } from "expo-router";
|
|
import _ from "lodash";
|
|
import { useEffect, useState } from "react";
|
|
|
|
export default function ProfileDetailBlocked() {
|
|
const { id } = useLocalSearchParams();
|
|
const [data, setData] = useState<any>(null);
|
|
const [isLoading, setIsLoading] = useState<boolean>(false);
|
|
|
|
useEffect(() => {
|
|
fetchData();
|
|
}, [id]);
|
|
|
|
const fetchData = async () => {
|
|
const response = await apiGetBlockedById({ id: String(id) });
|
|
setData(response.data);
|
|
};
|
|
|
|
const handleSubmit = async () => {
|
|
try {
|
|
setIsLoading(true);
|
|
await apiUnblock({ id: String(id) });
|
|
router.back();
|
|
} catch (error) {
|
|
console.log("[ERROR >>]", JSON.stringify(error, null, 2));
|
|
} finally {
|
|
setIsLoading(false);
|
|
}
|
|
};
|
|
|
|
return (
|
|
<>
|
|
<NewWrapper_V2
|
|
enableKeyboardHandling
|
|
keyboardScrollOffset={100}
|
|
footerComponent={
|
|
<BoxButtonOnFooter>
|
|
<ButtonCustom
|
|
isLoading={isLoading}
|
|
onPress={() => {
|
|
AlertDefaultSystem({
|
|
title: "Buka Blokir",
|
|
message: "Apakah anda yakin ingin membuka blokir ini?",
|
|
textLeft: "Tidak",
|
|
textRight: "Ya",
|
|
onPressRight: () => {
|
|
handleSubmit();
|
|
},
|
|
});
|
|
}}
|
|
>
|
|
Buka Blokir
|
|
</ButtonCustom>
|
|
</BoxButtonOnFooter>
|
|
}
|
|
>
|
|
<BoxWithHeaderSection>
|
|
<StackCustom>
|
|
<AvatarUsernameAndOtherComponent
|
|
avatarHref={`/profile/${data?.blocked?.Profile?.id}`}
|
|
avatar={data?.blocked?.Profile?.imageId}
|
|
name={data?.blocked?.username}
|
|
/>
|
|
|
|
<TextCustom align="center">
|
|
Jika anda membuka blokir ini maka semua postingan terkait user ini
|
|
akan muncul kembali di beranda
|
|
<TextCustom bold color="red">
|
|
{" "}
|
|
{_.upperCase(data?.menuFeature?.name)}
|
|
</TextCustom>
|
|
</TextCustom>
|
|
</StackCustom>
|
|
</BoxWithHeaderSection>
|
|
</NewWrapper_V2>
|
|
</>
|
|
);
|
|
}
|