Files
discord-decomp/modules/user_profile/native/ActionSheetBackdropToast.tsx
T
2026-11-01 12:12:55 +02:00

87 lines
3.7 KiB
TypeScript

// Metro module 12228 (f12229).
import { useEffect } from "react";
import { View, StyleSheet } from "react-native";
import { ACTION_SHEET_START_HEIGHT_RATIO } from "../../action_sheet/native/ActionSheetConstants";
import * as _PlatformUtils from "../../../utils/PlatformUtils";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import useWindowDimensions_native from "../../screen/useWindowDimensions.native";
import { NAV_BAR_HEIGHT_MULTILINE } from "../../../design/components/Navigator/native/NavigatorConstants.native";
import ReanimatedRexport, { useSharedValue, withDelay, Easing, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import { withTiming } from "../../../design/animation/reanimated/timing/timing";
import { Text } from "../../../design/components/Text/native/Text";
const isIOS = _PlatformUtils.isIOS();
const useStyles = createStyles({
container: {
...StyleSheet.absoluteFillObject,
flex: 1,
alignItems: "center",
justifyContent: "center"
},
toast: {
position: "absolute",
bottom: 16,
backgroundColor: Module712.colors.MOBILE_TOAST_BACKGROUND_DEFAULT,
borderRadius: Module712.radii.round,
paddingTop: 6,
paddingBottom: 8,
paddingHorizontal: 16
}
});
const __initData = {
code: "function ActionSheetBackdropToastTsx1(){const{isInIOS,isExpanded,maxDynamicContentSize,TOAST_BOTTOM_MARGIN,nonExpandedHeight,ACTION_SHEET_START_HEIGHT_RATIO,TOAST_BOTTOM_GAP,positionDelta,TOAST_ANIMATION_Y_DELTA,opacity}=this.__closure;return{bottom:(isInIOS?isExpanded?maxDynamicContentSize+TOAST_BOTTOM_MARGIN:nonExpandedHeight+TOAST_BOTTOM_MARGIN:isExpanded?maxDynamicContentSize+TOAST_BOTTOM_MARGIN:ACTION_SHEET_START_HEIGHT_RATIO*maxDynamicContentSize+TOAST_BOTTOM_GAP)+ +(1-positionDelta.get())*TOAST_ANIMATION_Y_DELTA,opacity:opacity.get()};}"
};
export function ActionSheetBackdropToast(props) {
const { text, isExpanded } = props;
const styles = useStyles();
const top = useSafeAreaInsets_native().top;
const height = useWindowDimensions_native().height;
const nonExpandedHeight = height * ACTION_SHEET_START_HEIGHT_RATIO;
let c19748_1 = nonExpandedHeight;
const maxDynamicContentSize = height - NAV_BAR_HEIGHT_MULTILINE - top;
let c19748_2 = maxDynamicContentSize;
const sharedValue = useSharedValue(0);
const sharedValue2 = useSharedValue(0);
useEffect(() => {
sharedValue.set(withDelay(100, withTiming(1, {
duration: 200,
easing: Easing.in(Easing.ease)
})));
sharedValue2.set(withTiming(1, {
duration: 300,
easing: Easing.in(Easing.linear)
}));
return () => {
sharedValue.set(withDelay(200, withTiming(0)));
sharedValue2.set(withTiming(0, {
duration: 200,
easing: Easing.out(Easing.exp)
}));
};
}, [sharedValue, sharedValue2]);
const x = () => ({
bottom: (isIOS ? isExpanded ? c19748_2 + 24 : c19748_1 + 24 : isExpanded ? c19748_2 + 24 : ACTION_SHEET_START_HEIGHT_RATIO * c19748_2 + 46) + 15 * (1 - sharedValue.get()),
opacity: sharedValue2.get()
});
x.__closure = {
isInIOS: isIOS,
isExpanded,
maxDynamicContentSize,
TOAST_BOTTOM_MARGIN: 24,
nonExpandedHeight,
ACTION_SHEET_START_HEIGHT_RATIO,
TOAST_BOTTOM_GAP: 46,
positionDelta: sharedValue,
TOAST_ANIMATION_Y_DELTA: 15,
opacity: sharedValue2
};
x.__workletHash = 9630436597435;
x.__initData = __initData;
return <View style={[styles.container]} pointerEvents="none">
<ReanimatedRexport.View style={[styles.toast, useAnimatedStyle(x)]}>
<Text variant="text-sm/medium" color="mobile-text-heading-primary">{text}</Text>
</ReanimatedRexport.View>
</View>;
}