120 lines
4.2 KiB
TypeScript
120 lines
4.2 KiB
TypeScript
// Metro module 8925 (f8926).
|
|
import { useState, useCallback } from "react";
|
|
import { ScrollView, View } from "react-native";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import ModalActionCreators from "../../../actions/ModalActionCreators";
|
|
import { presentFailedToast } from "../../toast/native/ToastUtils";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import RelationshipActionCreators from "../../../actions/RelationshipActionCreators";
|
|
import { SafeAreaPaddingView } from "../../../components_native/common/SafeAreaView";
|
|
import TouchableHitBox from "../../../design/void/TouchableHitBox/native/TouchableHitBox";
|
|
import Module7734 from "../../../_bundle/Module7734";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { Button } from "../../../design/components/Button/native/Button.native";
|
|
const useStyles = createStyles({
|
|
root: {
|
|
display: "flex",
|
|
flexDirection: "column",
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOW,
|
|
height: "100%",
|
|
paddingTop: Module712.space.PX_24
|
|
},
|
|
closeButton: {
|
|
marginRight: 8,
|
|
alignSelf: "flex-end"
|
|
},
|
|
content: {
|
|
flexGrow: 1,
|
|
padding: Module712.space.PX_16
|
|
},
|
|
container: {
|
|
display: "flex",
|
|
flexDirection: "column",
|
|
height: "100%",
|
|
marginTop: Module712.space.PX_24
|
|
},
|
|
footer: {
|
|
flexGrow: 0,
|
|
flexShrink: 1,
|
|
backgroundColor: Module712.colors.BORDER_SUBTLE,
|
|
paddingVertical: Module712.space.PX_24,
|
|
paddingHorizontal: Module712.space.PX_16
|
|
},
|
|
header: {
|
|
display: "flex",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
marginBottom: Module712.space.PX_16
|
|
},
|
|
headerText: {
|
|
marginTop: Module712.space.PX_16,
|
|
marginBottom: Module712.space.PX_4
|
|
},
|
|
body: {
|
|
padding: Module712.space.PX_24,
|
|
borderRadius: Module712.radii.md,
|
|
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
|
|
},
|
|
noticeHeader: {
|
|
marginBottom: Module712.space.PX_4
|
|
},
|
|
buttonWrapper: {
|
|
marginBottom: Module712.space.PX_4
|
|
}
|
|
});
|
|
export default function ClearAllIncomingRequestsConfirmationModal(props) {
|
|
let callback2;
|
|
const incomingPendingRequestCount = props.incomingPendingRequestCount;
|
|
callback2 = void 0;
|
|
const styles = useStyles();
|
|
const [disabled, setState] = useState(false);
|
|
const callback = useCallback(() => {
|
|
setState(false);
|
|
ModalActionCreators.pop();
|
|
}, []);
|
|
callback2 = useCallback(() => {
|
|
setState(false);
|
|
presentFailedToast(intl.string(t.R0RpRX));
|
|
}, []);
|
|
const callback3 = useCallback(() => {
|
|
setState(true);
|
|
RelationshipActionCreators.clearPendingRelationships().then(callback).catch(callback2);
|
|
}, [callback, callback2]);
|
|
return <SafeAreaPaddingView top>
|
|
<View style={styles.root}>
|
|
<TouchableHitBox accessibilityRole="button" accessibilityLabel={intl.string(t.cpT0Cq)} source={Module7734} style={[styles.closeButton]} onPress={() => ModalActionCreators.pop()} />
|
|
<View style={styles.container}>
|
|
<ScrollView style={styles.content}>
|
|
<>
|
|
<View style={styles.header}>
|
|
<Text style={styles.headerText} variant="text-lg/bold">
|
|
{intl.string(t.eVjfAu)}
|
|
</Text>
|
|
</View>
|
|
<View style={styles.body}>
|
|
<Text style={styles.noticeHeader} variant="text-xs/normal" color="mobile-text-heading-primary">
|
|
{intl.format(t.jaXsA3, {
|
|
incomingRequestCount: incomingPendingRequestCount
|
|
})}
|
|
</Text>
|
|
</View>
|
|
</>
|
|
</ScrollView>
|
|
<View style={styles.footer}>
|
|
<SafeAreaPaddingView bottom>
|
|
<>
|
|
<View style={styles.buttonWrapper}>
|
|
<Button disabled={disabled} loading={disabled} variant="destructive" size="md" text={intl.string(t.Eq9seb)} onPress={callback3} grow />
|
|
</View>
|
|
<View style={styles.buttonWrapper}>
|
|
<Button variant="secondary" size="md" text={intl.string(t["ETE/oC"])} onPress={ModalActionCreators.pop} grow />
|
|
</View>
|
|
</>
|
|
</SafeAreaPaddingView>
|
|
</View>
|
|
</View>
|
|
</View>
|
|
</SafeAreaPaddingView>;
|
|
};
|