Fix click handling for stories

This commit is contained in:
Fedor Indutny 2022-09-27 13:24:21 -07:00 committed by GitHub
parent c0082adc56
commit 698c7a7739
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
78 changed files with 274 additions and 46 deletions

View file

@ -1,7 +1,7 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import { useState } from 'react';
import { useState, useCallback } from 'react';
import type { SpringValues } from '@react-spring/web';
import { useChain, useSpring, useSpringRef } from '@react-spring/web';
@ -59,9 +59,10 @@ export function useAnimated(
});
useChain(isOpen ? [overlayRef, modalRef] : [modalRef, overlayRef]);
const close = useCallback(() => setIsOpen(false), []);
return {
close: () => setIsOpen(false),
close,
overlayStyles,
modalStyles,
};