47 lines
1.7 KiB
TypeScript
47 lines
1.7 KiB
TypeScript
// Metro module 12303 (f12304).
|
|
import { useState, useEffect } from "react";
|
|
import { MediaViewerSourcesStore } from "./useMediaViewerSources";
|
|
import * as _ReanimatedRexport from "../../reanimated/ReanimatedRexport";
|
|
import { useSharedValue, useAnimatedStyle } from "../../reanimated/ReanimatedRexport";
|
|
import { withTiming } from "../../../design/animation/reanimated/timing/timing";
|
|
import { STANDARD_EASING } from "../../../design/void/native";
|
|
const __initData = {
|
|
code: "function useMediaItemSpoilerStateTsx1(){const{runOnJS,setSpoilerActive,hasSpoiler}=this.__closure;runOnJS(setSpoilerActive)(hasSpoiler);}"
|
|
};
|
|
const __initData2 = {
|
|
code: "function useMediaItemSpoilerStateTsx2(){const{spoilerOpacity}=this.__closure;return{opacity:spoilerOpacity.get()};}"
|
|
};
|
|
export function useMediaItemSpoilerState(c19781_0) {
|
|
let sharedValue;
|
|
const hasSpoiler = MediaViewerSourcesStore.useState((a0) => a0.spoilerIndexes.has(c19781_0));
|
|
const [state, setState] = useState(hasSpoiler);
|
|
sharedValue = useSharedValue(hasSpoiler ? 1 : 0);
|
|
useEffect(() => {
|
|
const r0 = hasSpoiler ? 1 : 0;
|
|
const r7 = {
|
|
duration: 200,
|
|
easing: STANDARD_EASING
|
|
};
|
|
const t = function t() {
|
|
_ReanimatedRexport.runOnJS(setState)(hasSpoiler);
|
|
};
|
|
t.__closure = {
|
|
runOnJS: _ReanimatedRexport.runOnJS,
|
|
setSpoilerActive: setState,
|
|
hasSpoiler
|
|
};
|
|
t.__workletHash = 15930548853488;
|
|
t.__initData = __initData;
|
|
sharedValue.set(withTiming(r0, r7, "respect-motion-settings", t));
|
|
}, [hasSpoiler, sharedValue]);
|
|
const S = () => ({
|
|
opacity: sharedValue.get()
|
|
});
|
|
S.__closure = {
|
|
spoilerOpacity: sharedValue
|
|
};
|
|
S.__workletHash = 8496335051493;
|
|
S.__initData = __initData2;
|
|
return [state, useAnimatedStyle(S)];
|
|
}
|