Files
discord-decomp/modules/premium/native/gifting/PremiumGiftBackgroundSelect.tsx
T
2026-11-01 12:12:55 +02:00

65 lines
2.7 KiB
TypeScript

// Metro module 8777 (f8778).
import { useState, useEffect } from "react";
import { ScrollView } from "react-native";
import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../reanimated/ReanimatedRexport";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import useWindowDimensions_native from "../../../screen/useWindowDimensions.native";
import * as _timing from "../../../../design/animation/reanimated/timing/timing";
import * as _native from "../../../../design/void/native";
import PremiumGiftBackgroundAnimation_android from "./PremiumGiftBackgroundAnimation.android";
import { useNativeGiftContext } from "../../../payments/native/NativeGiftContext";
let AnimatedComponent, useStyles, __initData;
const GiftBackgroundSelect = function GiftBackgroundSelect(props) {
const { giftStyle, withConsistentHeight = true } = props;
const styles = useStyles();
const width = useWindowDimensions_native().width;
const [state, setState] = useState();
const sharedValue = useSharedValue(false);
useEffect(() => {
sharedValue.set(state != null);
}, [state, sharedValue]);
const N = function N() {
return {
opacity: _timing.withTiming(sharedValue.get() ? 1 : 0, {
easing: _native.STANDARD_EASING,
duration: 100
})
};
};
N.__closure = {
STANDARD_EASING: _native.STANDARD_EASING,
withTiming: _timing.withTiming,
visibility: sharedValue
};
N.__workletHash = 5743780040676;
N.__initData = __initData;
return <>
{[<PremiumGiftBackgroundAnimation_android giftStyle={giftStyle} withConsistentHeight={withConsistentHeight} />, <AnimatedComponent onContentSizeChange={(event) => {
if (state == null) {
setState(event);
}
}} contentContainerStyle={[styles.contentContainer, state != null && state < width && {
flex: 1
}]} style={[styles.scrollView, useAnimatedStyle(N)]} horizontal showsHorizontalScrollIndicator={false} />]}
</>;
};
AnimatedComponent = ReanimatedRexport.createAnimatedComponent(ScrollView);
useStyles = createStyles({
scrollView: {
flex: 1,
marginTop: Module712.space.PX_24
},
contentContainer: {
justifyContent: "center"
}
});
__initData = {
code: "function PremiumGiftBackgroundSelectTsx1(){const{STANDARD_EASING,withTiming,visibility}=this.__closure;const animationSettings={easing:STANDARD_EASING,duration:100};return{opacity:withTiming(visibility.get()?1:0,animationSettings)};}"
};
export default function PremiumGiftBackgroundSelect() {
const nativeGiftContext = useNativeGiftContext();
return <GiftBackgroundSelect giftStyle={nativeGiftContext.giftStyle} setGiftStyle={nativeGiftContext.setGiftStyle} />;
};
export { GiftBackgroundSelect };