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

72 lines
3.2 KiB
TypeScript

// Metro module 10383 (f10384).
import { useCallback } from "react";
import { Keyboard } from "react-native";
import { DEFAULT_ANIMATION_TIMING } from "./InAppNotificationConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import { useInAppNotificationContext } from "./InAppNotificationContext";
import { intl, t } from "../../../intl/index.native";
import useAnimatedKeyboardHeight from "../../keyboard/native/useAnimatedKeyboardHeight";
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
import ReanimatedRexport, { useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
import * as _timing from "../../../design/animation/reanimated/timing/timing";
import { ConfirmationToast } from "./ConfirmationToast";
import { MessageReplyInput } from "./MessageReplyInput";
const useStyles = createStyles({
expandFooterContainer: {
position: "absolute",
left: 0,
right: 0
}
});
const __initData = {
code: "function MessageNotificationDetachedContentTsx1(){const{withTiming,expandedSV,DEFAULT_ANIMATION_TIMING,keyboardHeight,safeAreaBottom}=this.__closure;return{opacity:withTiming(expandedSV.get()?1:0,DEFAULT_ANIMATION_TIMING),transform:[{scale:withTiming(expandedSV.get()?1:0.8,DEFAULT_ANIMATION_TIMING)}],bottom:4+Math.max(keyboardHeight.get(),safeAreaBottom)};}"
};
export function MessageNotificationDetachedContent(props) {
let c17915_5, bottom;
const notification = props.notification;
c17915_5 = void 0;
bottom = void 0;
const styles = useStyles();
const inAppNotificationContext = useInAppNotificationContext();
const { isExpanded, expandedSV, showReplyInput, setActionTaken, setExpanded, setAutoDismissing, confirmation, setConfirmation } = inAppNotificationContext;
const callback = useCallback(() => {
Keyboard.dismiss();
setActionTaken(true);
setExpanded(false);
setAutoDismissing(true);
setConfirmation({
type: "message",
reaction: null,
message: intl.string(t["b/4dOF"])
});
}, [setActionTaken, setExpanded, setAutoDismissing, setConfirmation]);
const animatedKeyboardHeight = useAnimatedKeyboardHeight();
c17915_5 = animatedKeyboardHeight;
bottom = useSafeAreaInsets_native().bottom;
const _ = function _() {
return {
opacity: _timing.withTiming(expandedSV.get() ? 1 : 0, DEFAULT_ANIMATION_TIMING),
transform: [{
scale: _timing.withTiming(expandedSV.get() ? 1 : 0.8, DEFAULT_ANIMATION_TIMING)
}],
bottom: 4 + Math.max(c17915_5.get(), bottom)
};
};
_.__closure = {
withTiming: _timing.withTiming,
expandedSV,
DEFAULT_ANIMATION_TIMING,
keyboardHeight: animatedKeyboardHeight,
safeAreaBottom: bottom
};
_.__workletHash = 1331449062174;
_.__initData = __initData;
const animatedStyle = useAnimatedStyle(_);
return <>
{confirmation != null ? <ConfirmationToast message={confirmation.message} reaction={confirmation.reaction} /> : null}
{isExpanded ? showReplyInput ? <ReanimatedRexport.View style={[styles.expandFooterContainer, animatedStyle]}>
<MessageReplyInput notification={notification} onMessageSent={callback} />
</ReanimatedRexport.View> : null : null}
</>;
}