Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const useTransition = <
T extends typeof withSpringTransition | typeof withTimingTransition
>(
state: boolean,
config: Parameters[1],
withTransition: T
) => {
const value = useMemoOne(() => new Value(0), []);
useCode(set(value, bin(state)), [state]);
const transition = useMemoOne(() => withTransition(value, config), []);
return transition;
};
export default ({ list }: ListProps) => {
const [open, setOpen] = useState(false);
const transition = useTransition(
open,
not(bin(open)),
bin(open),
400,
Easing.inOut(Easing.ease)
);
const height = bInterpolate(
transition,
0,
LIST_ITEM_HEIGHT * list.items.length
);
const bottomRadius = interpolate(transition, {
inputRange: [0, 16 / 400],
outputRange: [8, 0]
});
return (
<>
setOpen(prev => !prev)}>
export default ({ list }: ListProps) => {
const [open, setOpen] = useState(false);
const transition = useTransition(
open,
not(bin(open)),
bin(open),
400,
Easing.inOut(Easing.ease)
);
const height = bInterpolate(
transition,
0,
LIST_ITEM_HEIGHT * list.items.length
);
const bottomRadius = interpolate(transition, {
inputRange: [0, 16 / 400],
outputRange: [8, 0]
});
return (
<>
setOpen(prev => !prev)}>