Skip to content

Commit

Permalink
fix(core): fix viewtransition and css property missing (#7377)
Browse files Browse the repository at this point in the history
  • Loading branch information
EYHN authored Jun 28, 2024
1 parent fbf6760 commit 824be0d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ import {
borderAngle3,
} from './styles.css';

if (typeof window !== 'undefined' && window.CSS) {
if (
typeof window !== 'undefined' &&
window.CSS &&
window.CSS.registerProperty
) {
const getName = (nameWithVar: string) => nameWithVar.slice(4, -1);
const registerAngle = (varName: string, initialValue: number) => {
window.CSS.registerProperty({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ export const PeekViewModalContainer = forwardRef<
) {
const [vtOpen, setVtOpen] = useState(open);
useEffect(() => {
document.startViewTransition(() => {
flushSync(() => {
setVtOpen(open);
if (document.startViewTransition) {
document.startViewTransition(() => {
flushSync(() => {
setVtOpen(open);
});
});
});
} else {
setVtOpen(open);
}
}, [open]);

useEffect(() => {
Expand Down

0 comments on commit 824be0d

Please sign in to comment.